Commit 6ed60f3e authored by haiyoucuv's avatar haiyoucuv

整理代码1

parent e4e96666
This diff is collapsed.
......@@ -3,6 +3,15 @@ import { changeScene, hideWaiting, showWaiting } from "db://assets/Module/UIFast
import { HomeScene } from "./Scenes/HomeScene";
import { AESDecrypt, AESEncrypt } from "./Utils/Crypto";
const en = AESEncrypt(JSON.stringify({
recordId: 232323,
oneGameHammerQuantity: 99,
oneGameProteanQuantity: 99,
}), "FDF817451A60EB8F", "cDOiBC1n2QrkAY2P");
console.log(en);
export default class GameMgr {
private static _ins: GameMgr = null;
......
import Panel from "../../Module/Panel";
import { _decorator, Node } from "cc";
import Svga from "../../Component/Svga/Svga";
import GameMgr from "../GameMgr";
const {ccclass, property} = _decorator;
@ccclass('MergeMaxPanel')
export default class MergeMaxPanel extends Panel {
static bundle: string = "";
static skin = "MergeMaxPanel";
static group = "MergeMaxPanel";
@property(Node)
svga: Node = null;
submitPromise = null;
async start() {
this.svga.on(Svga.EventType.END_FRAME, this.svgaEnd, this);
this.submitPromise = GameMgr.ins.submit(
true,
this.data.useHammerQuantity,
this.data.useProteanQuantity
);
}
svgaEnd = async () => {
const {success, data} = await this.submitPromise;
if (!success) {
return;
}
this.hidePanel();
}
}
{"ver":"4.0.24","importer":"typescript","imported":true,"uuid":"cb0c3ede-2f8c-410f-882a-ffbbebc35e02","files":[],"subMetas":{},"userData":{}}
......@@ -7,9 +7,10 @@ import {
} from "cc";
import Scene from "db://assets/Module/Scene";
import { Ball } from "./Ball";
import { changeScene, showToast } from "../../../Module/UIFast";
import { changeScene, showPanel, showToast } from "../../../Module/UIFast";
import { HomeScene } from "../HomeScene";
import GameMgr from "../../GameMgr";
import MergeMaxPanel from "../../Panels/MergeMaxPanel";
const {ccclass, property} = _decorator;
......@@ -30,6 +31,7 @@ export class MainGame extends Scene {
@property({type: Node, displayName: "线"}) line: Node = null;
@property(Prefab) proteanPrefab: Prefab = null;
@property(Node) readyRoot: Node = null;
@property(Node) ballRoot: Node = null;
@property({type: [Prefab]}) ballPrefab: Prefab[] = [];
......@@ -107,6 +109,9 @@ export class MainGame extends Scene {
}
/**
* 游戏结束
*/
gameOver = (suc) => {
if (this.isOver) return;
......@@ -114,6 +119,15 @@ export class MainGame extends Scene {
this.isOver = true;
PhysicsSystem2D.instance.enable = false;
if (suc) {
const {oneGameHammerQuantity, oneGameProteanQuantity} = GameMgr.ins.gameInfo;
showPanel(MergeMaxPanel, {
useHammerQuantity: oneGameHammerQuantity - this.hammerCount,
useProteanQuantity: oneGameProteanQuantity - this.proteanCount
});
} else {
}
}
......@@ -142,7 +156,7 @@ export class MainGame extends Scene {
this.proteanCount--;
this.ballRoot.removeChild(this.newBall);
this.readyRoot.removeAllChildren();
this.newBall = null;
const ball = instantiate(this.proteanPrefab);
......@@ -167,7 +181,7 @@ export class MainGame extends Scene {
private showNewBall(ball: Node) {
ball.setPosition(0, InitY);
ball.setScale(0, 0);
this.ballRoot.addChild(ball);
this.readyRoot.addChild(ball);
tween(ball)
.to(0.1, {scale: v3(1, 1, 1)})
.call(() => {
......@@ -395,6 +409,7 @@ export class MainGame extends Scene {
ballTs.sleep = false;
ballTs.body.applyAngularImpulse(Math.random() * 30 - 15, true);
this.ballRoot.addChild(this.newBall);
this.newBall = null;
this.readyDrop = false;
......
{"ver":"1.2.0","importer":"directory","imported":true,"uuid":"1fc0b54c-1f47-4b07-9fcc-7a2702c4cfa8","files":[],"subMetas":{},"userData":{}}
This diff is collapsed.
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "955d8229-afe9-4d74-8e2c-428f69d05df3",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "MergeMaxPanel"
}
}
{
"ver": "1.0.0",
"importer": "*",
"imported": true,
"uuid": "d4ddf6f8-85bb-4e3a-afae-44b9a4be9d08",
"files": [
".json",
".svga"
],
"subMetas": {},
"userData": {}
}
{"ver":"1.2.0","importer":"directory","imported":true,"uuid":"619816d6-a8a6-47c5-ae57-3efc325f2b86","files":[],"subMetas":{},"userData":{}}
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "f3c753ca-4552-475b-a4b7-5eabc4188f40",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "f3c753ca-4552-475b-a4b7-5eabc4188f40@6c48a",
"displayName": "bg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "f3c753ca-4552-475b-a4b7-5eabc4188f40",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "f3c753ca-4552-475b-a4b7-5eabc4188f40@f9941",
"displayName": "bg",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 596,
"height": 519,
"rawWidth": 596,
"rawHeight": 519,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-298,
-259.5,
0,
298,
-259.5,
0,
-298,
259.5,
0,
298,
259.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
519,
596,
519,
0,
0,
596,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-298,
-259.5,
0
],
"maxPos": [
298,
259.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "f3c753ca-4552-475b-a4b7-5eabc4188f40@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "f3c753ca-4552-475b-a4b7-5eabc4188f40@6c48a"
}
}
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "7140ba1b-4683-45b6-a169-537fbd822737",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "7140ba1b-4683-45b6-a169-537fbd822737@6c48a",
"displayName": "返回主页",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "7140ba1b-4683-45b6-a169-537fbd822737",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "7140ba1b-4683-45b6-a169-537fbd822737@f9941",
"displayName": "返回主页",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 398,
"height": 155,
"rawWidth": 398,
"rawHeight": 155,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-199,
-77.5,
0,
199,
-77.5,
0,
-199,
77.5,
0,
199,
77.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
155,
398,
155,
0,
0,
398,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-199,
-77.5,
0
],
"maxPos": [
199,
77.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "7140ba1b-4683-45b6-a169-537fbd822737@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "7140ba1b-4683-45b6-a169-537fbd822737@6c48a"
}
}
......@@ -2,5 +2,5 @@
"success": true,
"code": "",
"message": "",
"data": "JQ6ychp7XaxltjGODs4zqEgoz4mc2NEsmpF7avFpBZhX0jhN2gmhHSe5ZgCEOWZ1PXWdV8jU5+CWIO+ZYT60aySNO2rDghGzLXkmQGCpDCM="
"data": "P3mmQEAWoW8YQIDomgCRHDxeHF1lz7GrxKgwZQG/fezdjnKg4bRnWIjmEG3HGfhr9PIuFwN8XgWsZ9Mkw9QkpLyJ2n+0XVdu5v6I/6Fwiig="
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment