Explorar el Código

【BUG】修改游戏结束界面报错问题

mojunshou hace 1 año
padre
commit
4d0940e951

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 961 - 1097
assets/bundle/gui/eliminate/eliminate.prefab


+ 59 - 12
assets/bundle/gui/eliminate/prefab/gameOver.prefab

@@ -31,17 +31,17 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 124
-      },
-      {
         "__id__": 126
       },
       {
         "__id__": 128
+      },
+      {
+        "__id__": 130
       }
     ],
     "_prefab": {
-      "__id__": 130
+      "__id__": 132
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -461,11 +461,11 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 121
+        "__id__": 123
       }
     ],
     "_prefab": {
-      "__id__": 123
+      "__id__": 125
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -2438,10 +2438,13 @@
       },
       {
         "__id__": 118
+      },
+      {
+        "__id__": 120
       }
     ],
     "_prefab": {
-      "__id__": 120
+      "__id__": 122
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -2721,7 +2724,7 @@
     "controller": false,
     "watchPath": "",
     "componentName": "cc.ProgressBar",
-    "componentProperty": "*.cd",
+    "componentProperty": "progress",
     "refreshRate": 0.1,
     "watchPathArr": [
       "*.cd",
@@ -2735,6 +2738,48 @@
     "fileId": "78FUu7YAJNJpAM+n+gvRlg"
   },
   {
+    "__type__": "47052uw/Y5O1LXaLObj4ARx",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 105
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 121
+    },
+    "watchPath": "*.cd",
+    "foreachChildMode": false,
+    "condition": 2,
+    "foreachChildType": 0,
+    "valueA": 0,
+    "valueB": 0,
+    "valueAction": 0,
+    "valueActionOpacity": 0,
+    "valueActionColor": {
+      "__type__": "cc.Color",
+      "r": 155,
+      "g": 155,
+      "b": 155,
+      "a": 255
+    },
+    "valueComponentName": "",
+    "valueComponentProperty": "",
+    "valueComponentDefaultValue": "",
+    "valueComponentActionValue": "",
+    "watchNodes": [
+      {
+        "__id__": 106
+      }
+    ],
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "36C9tolAdBlZC96+N6ubwv"
+  },
+  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1
@@ -2757,7 +2802,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 122
+      "__id__": 124
     },
     "_contentSize": {
       "__type__": "cc.Size",
@@ -2798,7 +2843,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 125
+      "__id__": 127
     },
     "_contentSize": {
       "__type__": "cc.Size",
@@ -2826,8 +2871,10 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 127
+      "__id__": 129
     },
+    "lab_bar": null,
+    "progressBar": null,
     "_id": ""
   },
   {
@@ -2844,7 +2891,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 129
+      "__id__": 131
     },
     "_alignFlags": 45,
     "_target": null,

BIN
assets/bundle/gui/eliminate/texture/guide_title.png


+ 134 - 0
assets/bundle/gui/eliminate/texture/guide_title.png.meta

@@ -0,0 +1,134 @@
+{
+  "ver": "1.0.27",
+  "importer": "image",
+  "imported": true,
+  "uuid": "82d58626-fd04-4f5f-ae1c-ada363439ba3",
+  "files": [
+    ".json",
+    ".png"
+  ],
+  "subMetas": {
+    "6c48a": {
+      "importer": "texture",
+      "uuid": "82d58626-fd04-4f5f-ae1c-ada363439ba3@6c48a",
+      "displayName": "guide_title",
+      "id": "6c48a",
+      "name": "texture",
+      "userData": {
+        "wrapModeS": "clamp-to-edge",
+        "wrapModeT": "clamp-to-edge",
+        "imageUuidOrDatabaseUri": "82d58626-fd04-4f5f-ae1c-ada363439ba3",
+        "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": "82d58626-fd04-4f5f-ae1c-ada363439ba3@f9941",
+      "displayName": "guide_title",
+      "id": "f9941",
+      "name": "spriteFrame",
+      "userData": {
+        "trimThreshold": 1,
+        "rotated": false,
+        "offsetX": 0,
+        "offsetY": -0.5,
+        "trimX": 0,
+        "trimY": 1,
+        "width": 604,
+        "height": 254,
+        "rawWidth": 604,
+        "rawHeight": 255,
+        "borderTop": 0,
+        "borderBottom": 0,
+        "borderLeft": 0,
+        "borderRight": 0,
+        "packable": true,
+        "pixelsToUnit": 100,
+        "pivotX": 0.5,
+        "pivotY": 0.5,
+        "meshType": 0,
+        "vertices": {
+          "rawPosition": [
+            -302,
+            -127,
+            0,
+            302,
+            -127,
+            0,
+            -302,
+            127,
+            0,
+            302,
+            127,
+            0
+          ],
+          "indexes": [
+            0,
+            1,
+            2,
+            2,
+            1,
+            3
+          ],
+          "uv": [
+            0,
+            254,
+            604,
+            254,
+            0,
+            0,
+            604,
+            0
+          ],
+          "nuv": [
+            0,
+            0,
+            1,
+            0,
+            0,
+            0.996078431372549,
+            1,
+            0.996078431372549
+          ],
+          "minPos": [
+            -302,
+            -127,
+            0
+          ],
+          "maxPos": [
+            302,
+            127,
+            0
+          ]
+        },
+        "isUuid": true,
+        "imageUuidOrDatabaseUri": "82d58626-fd04-4f5f-ae1c-ada363439ba3@6c48a",
+        "atlasUuid": "",
+        "trimType": "auto"
+      },
+      "ver": "1.0.12",
+      "imported": true,
+      "files": [
+        ".json"
+      ],
+      "subMetas": {}
+    }
+  },
+  "userData": {
+    "type": "sprite-frame",
+    "hasAlpha": true,
+    "fixAlphaTransparencyArtifacts": false,
+    "redirect": "82d58626-fd04-4f5f-ae1c-ada363439ba3@6c48a"
+  }
+}

+ 3 - 3
assets/script/game/common/config/GameUIConfig.ts

@@ -1,7 +1,7 @@
 /*
  * @Date: 2021-08-12 09:33:37
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-16 19:16:51
+ * @LastEditTime: 2025-04-17 18:43:01
  */
 import { LayerType, UIConfig } from "../../../../../extensions/oops-plugin-framework/assets/core/gui/layer/LayerManager";
 
@@ -64,11 +64,11 @@ export var UIConfigData: { [key: number]: UIConfig } = {
     [UIID.KindTips]: { layer: LayerType.PopUp, prefab: "common/prefab/kind_tips" },
     [UIID.Retention]: { layer: LayerType.PopUp, prefab: "common/prefab/retention" },
     [UIID.Eliminate]: { layer: LayerType.UI, prefab: "gui/eliminate/eliminate" },
-    [UIID.Setting]: { layer: LayerType.UI, prefab: "common/prefab/setting", vacancy: true, mask: true },
+    [UIID.Setting]: { layer: LayerType.PopUp, prefab: "common/prefab/setting", vacancy: true, mask: true },
     [UIID.AboutUs]: { layer: LayerType.UI, prefab: "common/prefab/about" },
     [UIID.RedPacketWithdraw]: { layer: LayerType.UI, prefab: "gui/eliminate/prefab/redPacketWithdrawal" },
     [UIID.DoubleSpeed]: { layer: LayerType.PopUp, prefab: "gui/eliminate/prefab/doubleSpeed", vacancy: true, mask: true },
-    [UIID.GameOver]: { layer: LayerType.UI, prefab: "gui/eliminate/prefab/gameOver", vacancy: true, mask: true },
+    [UIID.GameOver]: { layer: LayerType.PopUp, prefab: "gui/eliminate/prefab/gameOver", vacancy: true, mask: true },
     [UIID.Game]: { layer: LayerType.UI, prefab: "gui/eliminate/Game" },
     [UIID.CashRebate]: { layer: LayerType.PopUp, prefab: "gui/eliminate/prefab/cashRebate" },
     [UIID.DoubleRewards]: { layer: LayerType.PopUp, prefab: "gui/eliminate/prefab/doubleRewards" },

+ 4 - 11
assets/script/game/initialize/view/LoadingViewComp.ts

@@ -12,16 +12,13 @@ import { oops } from "../../../../../extensions/oops-plugin-framework/assets/cor
 import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
 import { CCVMParentComp } from "../../../../../extensions/oops-plugin-framework/assets/module/common/CCVMParentComp";
 import { AndroidEvent } from "../../common/config/AndroidEvent";
+import { AD_TYPE } from "../../common/config/GameDefine";
 import { GameEvent } from "../../common/config/GameEvent";
 import { UIID } from "../../common/config/GameUIConfig";
-import { CocosHandler } from "../../common/manager/CocosHandler";
-import { smc } from "../../common/SingletonModuleComp";
-import { AD_TYPE } from "../../common/config/GameDefine";
-import { EliminateViewComp } from "../../view/EliminateViewComp";
-import { ServerHandler } from "../../common/manager/ServerHandler";
 import { ADHandler } from "../../common/manager/ADHandler";
 import { LoginHandler } from "../../common/manager/LoginHandler";
-import { GameView } from "../../view/core/GameView";
+import { smc } from "../../common/SingletonModuleComp";
+import { EliminateViewComp } from "../../view/EliminateViewComp";
 const { ccclass, property } = _decorator;
 
 /** 游戏资源加载 */
@@ -38,8 +35,6 @@ export class LoadingViewComp extends CCVMParentComp {
         progress: "0",
         /** 加载流程中提示文本 */
         prompt: "",
-        /**btn_show*/
-        btn_show: 0
     };
 
     private progress: number = 0;
@@ -79,8 +74,6 @@ export class LoadingViewComp extends CCVMParentComp {
 
     private userLogin() {
         const isLogin = smc.account.AccountModel.isLogined;
-        console.log("登录状态>>>>>>>>>>>>>>>>", isLogin);
-
         //暂时隐藏
         if (isLogin) {
             //登录过
@@ -149,7 +142,7 @@ export class LoadingViewComp extends CCVMParentComp {
         // 获取用户信息的多语言提示文本
         this.data.prompt = oops.language.getLangByID("loading_load_player");
         await ModuleUtil.addViewUiAsync(smc.account, EliminateViewComp, UIID.Eliminate);
-        // await oops.gui.open(UIID.GameView);
+
         ModuleUtil.removeViewUi(this.ent, LoadingViewComp, UIID.Loading);
     }
 

+ 47 - 38
assets/script/game/view/EliminateViewComp.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-20 15:01:09
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-17 17:49:16
+ * @LastEditTime: 2025-04-17 18:12:06
  * @Description: 消除游戏主场景
  */
 import { _decorator, Button, Color, EventTouch, instantiate, JsonAsset, Label, Node, Prefab, randomRangeInt, Sprite, tween, UITransform, Vec2, Vec3, Widget } from "cc";
@@ -138,7 +138,7 @@ export class EliminateViewComp extends CCComp {
     private yOffset = 100;
     private aniBrickRotate = 0
 
-    private operateFlag: boolean = false
+    private operateFlag: boolean = false  //是否可以操作
     private touchStartPos = new Vec2()
 
     private gameState: GameState = GameState.READY;
@@ -341,12 +341,14 @@ export class EliminateViewComp extends CCComp {
     startGuideMode() {
         this.isGuideMode = true
         this.guideStep = 1
-        this.gridNode.active = true;
+        this.guideNode.active = true;
         this.setupGuideStep(this.guideStep)
     }
 
     setupGuideStep(step: number) {
         this.clearAllGuideGrids()
+        this.gameState = GameState.PLAYING;
+        this.operateFlag = true
         this.bricksList.length = 0
         this.brickNode.destroyAllChildren();
 
@@ -468,7 +470,7 @@ export class EliminateViewComp extends CCComp {
             gridColorKey: "colorKey",
             brickInitPos: new Vec3(),
             type: colorIndex,
-            rotateNode: null,
+            rotateNode: new Node(),
         }
         const node = this.generateBrick(brickKey, colorIndex)
         this.brickNode.addChild(node);
@@ -482,6 +484,13 @@ export class EliminateViewComp extends CCComp {
             this.bricksList.push(brickData)
             this.brickAddEvent(brickData)
         }
+        if (brickData.rotateFlag) {
+            brickData.rotateNode = instantiate(this.rotatePrefab)
+            this.rotateNode.addChild(brickData.rotateNode);
+            //先隐藏
+            brickData.rotateNode.active = false;
+            brickData.rotateNode.setWorldPosition(this.brickNode.getWorldPosition())
+        }
     }
 
 
@@ -838,8 +847,7 @@ export class EliminateViewComp extends CCComp {
         return brickNode
     }
 
-    touchStartLocation = new Vec2()
-    touchStartFlag = false
+
     brickAddEvent(brickData: BrickData) {
         const brickNode = brickData.brickNode
         if (!brickNode) {
@@ -849,15 +857,10 @@ export class EliminateViewComp extends CCComp {
         // 记录初始位置和状态
         let startPos = new Vec3();
         let originalParent: Node | null = null;
-        let isDragging = false;
-
         // 触摸开始事件
         brickNode.on(Node.EventType.TOUCH_START, (event: EventTouch) => {
             // 如果正在编辑其他方块,则忽略
             if (!this.operateFlag) return;
-
-            isDragging = true;
-
             // 清空编辑中的数据
             this.editingData.brickData = null;
             this.editingData.gridList.length = 0;
@@ -881,7 +884,7 @@ export class EliminateViewComp extends CCComp {
 
         // 触摸移动事件
         brickNode.on(Node.EventType.TOUCH_MOVE, (event: EventTouch) => {
-            if (!isDragging || !this.operateFlag) return;
+            if (!this.operateFlag) return;
 
             const movePos: Vec2 = event.getUILocation().subtract(this.touchStartPos)
             // 挪动很小时,不移动方块组合
@@ -954,10 +957,9 @@ export class EliminateViewComp extends CCComp {
 
         // 触摸结束或取消事件
         const touchEndHandler = (event: EventTouch) => {
-            if (!isDragging) return;
-            isDragging = false;
-            this.touchStartFlag = false;
 
+            if (this.adShowingFlag || !this.operateFlag) return
+            this.operateFlag = false
             // 单击旋转
             if (!this.editingData.brickData) {
                 console.log("没有数据")
@@ -1005,6 +1007,7 @@ export class EliminateViewComp extends CCComp {
                                 })
                                 .call(() => {
                                     if (brickData.brickNode) {
+                                        this.operateFlag = true
                                         this.brickNode.addChild(brickData.brickNode)
                                         brickData.brickNode.setWorldPosition(brickData.brickInitPos)
                                     }
@@ -1025,7 +1028,7 @@ export class EliminateViewComp extends CCComp {
                     const canEliminate = simulateResult.gridEliminateList.length > 0
 
                     if (!canEliminate) {
-                        this.bricksList.push(brickData)
+                        this.bricksList.push(brickData);
                         if (brickData.brickNode) {
                             tween(brickData.brickNode)
                                 .to(0.15, {
@@ -1034,6 +1037,7 @@ export class EliminateViewComp extends CCComp {
                                 })
                                 .call(() => {
                                     if (brickData.brickNode) {
+                                        this.operateFlag = true
                                         this.brickNode.addChild(brickData.brickNode)
                                         brickData.brickNode.setWorldPosition(brickData.brickInitPos)
                                     }
@@ -1091,6 +1095,8 @@ export class EliminateViewComp extends CCComp {
                         if (!hasElimination) {
                             this.shouldResetEliminateCount = true;
                         }
+
+                        this.operateFlag = true;
                         //新手引导
                         if (this.isGuideMode) {
                             this.scheduleOnce(() => {
@@ -1118,7 +1124,7 @@ export class EliminateViewComp extends CCComp {
                 const brickData = this.editingData.brickData;
                 if (brickData) {
                     this.bricksList.push(brickData);
-
+                    this.operateFlag = false
                     // 添加回弹动画
                     tween(brickNode)
                         .to(0.2, {
@@ -1127,6 +1133,7 @@ export class EliminateViewComp extends CCComp {
                         })
                         .call(() => {
                             if (originalParent) {
+                                this.operateFlag = true
                                 brickNode.setParent(originalParent);
                                 brickNode.setWorldPosition(brickData.brickInitPos);
                             }
@@ -2157,27 +2164,29 @@ export class EliminateViewComp extends CCComp {
     }
 
     btn_text() {
-        const param = {
-            "ssid": "7308c662d2264b1a952d2690e585872e",
-            "props": {
-                "1004": 0,
-                "1005": 2786919,
-                "1006": 9,
-                "1007": 71,
-                "2001": 2,
-                "8001": 20,
-                "9001": 0
-            },
-            "changes": {
-                "1004": -200000,
-                "8001": 20
-            },
-            "transferStatus": 1,
-            "outTransferNo": "2504161109911229182337024"
-        }
-
-        let str = JSON.stringify(param);
-        ServerHandler.inst.onHbReward(str);
+        //     const param = {
+        //         "ssid": "7308c662d2264b1a952d2690e585872e",
+        //         "props": {
+        //             "1004": 0,
+        //             "1005": 2786919,
+        //             "1006": 9,
+        //             "1007": 71,
+        //             "2001": 2,
+        //             "8001": 20,
+        //             "9001": 0
+        //         },
+        //         "changes": {
+        //             "1004": -200000,
+        //             "8001": 20
+        //         },
+        //         "transferStatus": 1,
+        //         "outTransferNo": "2504161109911229182337024"
+        //     }
+
+        //     let str = JSON.stringify(param);
+        //     ServerHandler.inst.onHbReward(str);
+        // this.restartGame();
+        this.gameOver();
     }
 
 

+ 24 - 11
assets/script/game/view/GameOverView.ts

@@ -2,18 +2,18 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-27 18:19:53
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-16 10:48:30
+ * @LastEditTime: 2025-04-17 18:53:19
  * @Description: 游戏结束界面
  */
-import { _decorator } from 'cc';
+import { _decorator, Label, ProgressBar } from 'cc';
 import { oops } from 'db://oops-framework/core/Oops';
 import { GameComponent } from "db://oops-framework/module/common/GameComponent";
-import { UIID } from '../common/config/GameUIConfig';
+import { AD_TYPE } from '../common/config/GameDefine';
 import { GameEvent } from '../common/config/GameEvent';
-import { smc } from '../common/SingletonModuleComp';
+import { UIID } from '../common/config/GameUIConfig';
 import { ADHandler } from '../common/manager/ADHandler';
-import { AD_TYPE } from '../common/config/GameDefine';
 import { ServerHandler } from '../common/manager/ServerHandler';
+import { smc } from '../common/SingletonModuleComp';
 import VMParent from 'db://oops-framework/libs/model-view/VMParent';
 
 const { ccclass, property } = _decorator;
@@ -21,10 +21,16 @@ const { ccclass, property } = _decorator;
 /** 显示对象控制 */
 @ccclass('GameOverView')
 export class GameOverView extends VMParent {
+    @property(Label)
+    private lab_bar: Label = null!; //分数
+
+    @property(ProgressBar)
+    private progressBar: ProgressBar = null!; //进度条
+
     data: any = {
-        cd: 0,
+        cd: 20,
         cdMax: 100,
-        schedule: 0,
+        schedule: 0
     }
 
     protected start() {
@@ -32,10 +38,15 @@ export class GameOverView extends VMParent {
         //计算分数,取后两位小数*100
         let score = smc.game.GameModel.curScore;
         let targetScore = smc.game.GameModel.targetScore;
-        //除,然后取后两位小数*100
-        this.data.cd = Math.floor(score / targetScore);
-        //计算进度条
-        this.data.schedule = Math.floor((score / targetScore) * 100);
+        let progress = score / targetScore;
+        if (progress > 1) {
+            progress = 1;
+        }
+        this.data.cd = score;
+        this.data.cdMax = targetScore;
+        //取整数
+        let scoreInt = Math.floor(progress);
+        this.data.schedule = scoreInt * 100;
     }
 
     private btn_restart() {
@@ -44,6 +55,8 @@ export class GameOverView extends VMParent {
         oops.gui.remove(UIID.GameOver);
     }
 
+
+
     private btn_resurrection() {
         //打开广告
         //我这调你登录,你登录后,返回给我,可以登录,我这边加载资源,userinfo-头像,UID nickname,关卡,还有配置,

+ 0 - 9
assets/script/game/view/core.meta

@@ -1,9 +0,0 @@
-{
-  "ver": "1.2.0",
-  "importer": "directory",
-  "imported": true,
-  "uuid": "8336e54b-8e56-4551-b776-3aef3a25e41b",
-  "files": [],
-  "subMetas": {},
-  "userData": {}
-}

+ 0 - 921
assets/script/game/view/core/GameView.ts

@@ -1,921 +0,0 @@
-import { _decorator, Component, Node, find, assetManager, JsonAsset, Prefab, UITransform, Widget, Vec3, instantiate, Sprite, randomRangeInt, EventTouch, Vec2, tween, Label, Color } from 'cc'
-import { oops } from 'db://oops-framework/core/Oops';
-import { ecs } from 'db://oops-framework/libs/ecs/ECS';
-import { CCComp } from 'db://oops-framework/module/common/CCComp';
-import { GameComponent } from 'db://oops-framework/module/common/GameComponent';
-const { ccclass, property } = _decorator;
-
-export enum GameStatus {
-    init,      //初始化
-    running,   //运行中
-    end,       //结束
-    pass        //通关
-}
-
-enum GridStatus {
-    notUse,
-    used,
-}
-
-interface GridDataInterface {
-    name: string,
-    status: GridStatus,
-    gridNode: Node | null,
-    row: number,
-    column: number,
-    gridColorKey: string | null,
-    gridType: number,            //代替gridColorKey
-}
-
-interface GridConfigDataInterface {
-    row: number,
-    column: number,
-}
-
-interface BrickDataInterface {
-    index: number,
-    brickKey: string,
-    rotateFlag: boolean,
-    gridConfig: GridConfigDataInterface[],
-    deg: number,
-    brickNode: Node | null,
-    gridColorKey: string,
-    brickInitPos: Vec3 | null,
-    rotateNode: Node | null,
-    gridType: number,            //gridColorKey
-}
-
-interface EditingDataInterface {
-    brickData: BrickDataInterface,
-    gridList: GridDataInterface[],
-}
-
-@ccclass('GameView')
-export class GameView extends GameComponent {
-
-    row = 8
-    column = 8
-    gridSize = 76.25
-    gridMargin = 1
-    brickNum = 3
-    yOffset = 100
-    aniBrickMove = 0.15    //动画时长
-    aniBrickRotate = 0.1     //
-    aniBrickEliminate = 0.2
-
-    notUseColor = new Color(255, 255, 255, 255)
-    usableColor = new Color(0, 255, 0, 100)
-    unavailableColor = new Color(255, 0, 0, 100)
-    rotateFaultTolerant = 10
-
-    bundleName = 'movebrick'
-    gameConfig = {}
-    gameStatus = GameStatus.init
-    _score = 0
-    editingData: EditingDataInterface = {
-        brickData: null!,
-        gridList: [],
-    }  //修改的数据
-    gridList: GridDataInterface[][] = []
-    bricksList: BrickDataInterface[] = []
-    gridColorList: GridDataInterface[] = []
-    deltaTime: number = 1
-    operateFlag = false
-    touchStartPos = new Vec2()
-    adShowingFlag = false
-
-    canvasNode: Node = null!
-    gridsNode: Node = null!         //网格层
-    bricksNode: Node = null!       //底部方块
-    movingNode: Node = null!       //移动层
-    rotateContainer: Node = null!  //旋转层
-    scoreLabel: Label = null!
-    gameOverPopupNode: Node = null!
-
-    gridPrefab: Prefab = null!     //空格子预制体
-    rotatePrefab: Prefab = null!    //旋转预制体
-    prefabUrlMap = {}  //格子预制体   //所有的格子预制体
-
-    //游戏新增的
-    @property([Prefab])             //所有的预制体,代替prefabUrlMap
-    allBrickList: any[] = [];
-    Lab_target: Label = null!        //目标分数
-    brickListConfig: { bricks?: any } = {}  //方块配置
-    @property(Prefab)
-    gridPb: Prefab = null!   //空格子预制体
-    @property({ type: Prefab, displayName: "旋转标志" })
-    rotatePb: Prefab = null!   //空格子预制体
-
-
-    get score() {
-        return this._score
-    }
-
-    set score(v: number) {
-        this._score = v
-        this.scoreLabel.string = `${this.score}`
-    }
-
-    setAdShowingFlag(v: boolean) {
-        this.adShowingFlag = v
-        // 打开激励视频时暂停背景音乐
-
-    }
-    onLoad() {
-
-        this.gridsNode = this.node.getChildByPath('Scene/Center/gridNode')!
-        this.bricksNode = this.node.getChildByPath('Scene/Bottom/bricksNode')!
-        this.movingNode = this.node.getChildByPath('Scene/moveNode')!
-        this.rotateContainer = this.node.getChildByPath('Scene/rotateNode')!
-        const scoreNode = this.node.getChildByPath('Scene/Top/scoreNode/lab_score')
-        if (!scoreNode) {
-            console.error('Score node not found')
-            return
-        }
-        const label = scoreNode.getComponent(Label)
-        if (!label) {
-            console.error('Label component not found on score node')
-            return
-        }
-        this.scoreLabel = label
-    }
-
-    start() {
-        // 模拟延时
-        this.scheduleOnce(() => {
-            this.loadGameConfig().then(() => {
-                // 生成游戏网格
-                this.generateGrids()
-                this.scheduleOnce(() => {
-                    this.initData()
-                })
-            })
-        }, 1)
-    }
-
-    loadGameConfig() {
-        let json_name: string = "gui/eliminate/config/GridConfig";
-        return new Promise<void>((resolve, reject) => {
-            oops.res.load(json_name, JsonAsset, (err: Error | null, res: any) => {
-                if (res) {
-                    this.brickListConfig = res.json;
-                    resolve();
-                } else {
-                    console.log("JSON数据加载失,请检查文件");
-                    reject(err);
-                }
-            });
-        });
-    }
-
-    setGameStauts(stauts: GameStatus) {
-        if (stauts === this.gameStatus) return
-        this.gameStatus = stauts
-        if (this.gameStatus === GameStatus.init) {
-            // this.gameOverPopupNode.active = false
-        }
-        else if (this.gameStatus === GameStatus.running) {
-            // this.gameOverPopupNode.active = false
-        }
-        else if (this.gameStatus === GameStatus.end) {
-            // this.gameOverPopupNode.active = true
-        }
-    }
-
-    initData() {
-        this.setGameStauts(GameStatus.init)
-        this.score = 0
-        this.gridColorList.length = 0
-        this.operateFlag = false
-        this.adShowingFlag = false
-        this.touchStartPos.set(Vec2.ZERO)
-        this.rotateContainer.destroyAllChildren()
-        // 初始化格子状态
-        for (let rowIndex = 0; rowIndex < this.row; rowIndex++) {
-            for (let columnIndex = 0; columnIndex < this.column; columnIndex++) {
-                this.gridList[rowIndex][columnIndex].status = GridStatus.notUse
-                this.generateGrid(this.gridList[rowIndex][columnIndex])
-            }
-        }
-        // 初始化方块
-        this.bricksNode.destroyAllChildren()
-        this.bricksList.length = 0
-        for (let i = 1; i <= this.brickNum; i++) {
-            this.addBrick(i)
-        }
-
-        this.setGameStauts(GameStatus.running)
-        this.operateFlag = true
-    }
-
-    generateGrids() {
-        this.gridsNode.destroyAllChildren()
-        const transform = this.gridsNode.getComponent(UITransform)
-        if (transform) {
-            transform.setContentSize(
-                this.gridSize * this.column + this.gridMargin * 2,
-                this.gridSize * this.row + this.gridMargin * 2,
-            )
-        }
-
-        for (let rowIndex = 0; rowIndex < this.row; rowIndex++) {
-            this.gridList.push([])
-            for (let columnIndex = 0; columnIndex < this.column; columnIndex++) {
-                let gridData: GridDataInterface = {
-                    name: `Grid-${rowIndex}-${columnIndex}`,
-                    status: GridStatus.notUse,
-                    gridNode: null,
-                    row: rowIndex,
-                    column: columnIndex,
-                    gridColorKey: "null",
-                    gridType: 0
-                }
-                this.gridList[rowIndex].push(gridData)
-                // 节点
-                gridData.gridNode = new Node()
-                this.gridsNode.addChild(gridData.gridNode)
-                gridData.gridNode.name = `Grid-${rowIndex}-${columnIndex}`
-                gridData.gridNode.addComponent(UITransform).setContentSize(this.gridSize, this.gridSize)
-                const gridWidget: Widget = gridData.gridNode.addComponent(Widget)
-                gridWidget.isAlignLeft = true
-                gridWidget.left = this.gridSize * columnIndex + this.gridMargin
-                gridWidget.isAlignBottom = true
-                gridWidget.bottom = this.gridSize * rowIndex + this.gridMargin
-            }
-        }
-    }
-    generateGrid(gridData: GridDataInterface) {
-        if (!gridData.gridNode) return;
-        gridData.gridNode.children.forEach(node => { node.destroy() })
-        let prefab = null
-        if (gridData.status === GridStatus.notUse) {
-            // prefab = this.gridPrefab
-            prefab = this.gridPb;
-        }
-        else if (gridData.status === GridStatus.used) {
-
-            //什么颜色的格子  --可以通过下标获取
-            // prefab = this.prefabUrlMap[this.gameConfig['gridColor'][gridData.gridColorKey]['prefabUrl']]
-            prefab = this.allBrickList[gridData.gridType];
-
-        }
-        const node = instantiate(prefab);
-        if (!node) return;
-        if (gridData.status === GridStatus.notUse) {
-            node.getComponent(Sprite).color = this.notUseColor
-        }
-        gridData.gridNode.addChild(node)
-        node.getComponent(UITransform).setContentSize(
-            this.gridSize - this.gridMargin * 2,
-            this.gridSize - this.gridMargin * 2,
-        )
-        node.setPosition(Vec3.ZERO)
-    }
-
-    generateBrick(brickKey: string, gridColorKey: string, gridType: number) {
-        const brickConfig = this.brickListConfig['bricks'][brickKey]
-        let rowMin = 0
-        let rowMax = 0
-        let columnMin = 0
-        let columnMax = 0
-        brickConfig['gridConfig'].forEach((gridConfigData: GridConfigDataInterface) => {
-            if (gridConfigData.row < rowMin) {
-                rowMin = gridConfigData.row
-            }
-            else if (gridConfigData.row > rowMax) {
-                rowMax = gridConfigData.row
-            }
-            if (gridConfigData.column < columnMin) {
-                columnMin = gridConfigData.column
-            }
-            else if (gridConfigData.column > columnMax) {
-                columnMax = gridConfigData.column
-            }
-        })
-        const rowNum = (rowMax - rowMin + 1)
-        const columnNum = (columnMax - columnMin + 1)
-        // 生成独立的方块节点
-        const brickNode = new Node()
-        brickNode.name = brickKey
-        const transformCom: UITransform = brickNode.addComponent(UITransform)
-        transformCom.setContentSize(
-            this.gridSize * columnNum,
-            this.gridSize * rowNum
-        )
-        transformCom.setAnchorPoint(0.5, 0.5)
-        // const gridPrefab = this.prefabUrlMap[this.gameConfig['gridColor'][gridColorKey]['prefabUrl']]
-        const gridPrefab = this.allBrickList[gridType];
-        //通过配置初始化
-        brickConfig['gridConfig'].forEach((gridConfigData: GridConfigDataInterface) => {
-            const gridNode = new Node()
-            gridNode.name = 'grid'
-            brickNode.addChild(gridNode)
-            gridNode.addComponent(UITransform).setContentSize(this.gridSize, this.gridSize)
-            const gridWidget: Widget = gridNode.addComponent(Widget)
-            gridWidget.isAlignLeft = true
-            gridWidget.left = this.gridSize * gridConfigData.column - this.gridSize * columnMin
-            gridWidget.isAlignBottom = true
-            gridWidget.bottom = this.gridSize * gridConfigData.row - this.gridSize * rowMin
-            const node = instantiate(gridPrefab)
-            gridNode.addChild(node)
-            node.getComponent(UITransform).setContentSize(
-                this.gridSize - this.gridMargin * 2,
-                this.gridSize - this.gridMargin * 2,
-            )
-
-
-
-            node.setPosition(Vec3.ZERO)
-            node.on(Node.EventType.TOUCH_START, (event: EventTouch) => {
-                event.preventSwallow = true;
-            }, this);
-            node.on(Node.EventType.TOUCH_MOVE, (event: EventTouch) => {
-                event.preventSwallow = true;
-            }, this);
-            node.on(Node.EventType.TOUCH_END, (event: EventTouch) => {
-                event.preventSwallow = true;
-            }, this);
-        })
-
-        return brickNode
-    }
-    addBrick(index: number) {
-        const bricks = this.brickListConfig.bricks || {};
-        // const gridColors = this.gameConfig.gridColor || {};
-        //获取方块的类型
-        const brickKey = Object.keys(bricks)[randomRangeInt(0, Object.keys(bricks).length)];
-        //获取方块的颜色随机下标
-        // const gridColorKey = Object.keys(gridColors)[randomRangeInt(0, Object.keys(gridColors).length)];
-
-        const gridColorKey = "GridColor1";
-        //通过Key获取具体配置
-        const brickConfig = bricks[brickKey];
-        const gridType = randomRangeInt(0, this.allBrickList.length);
-        const brickData: BrickDataInterface = {
-            index,
-            brickKey,
-            rotateFlag: brickConfig['rotateFlag'],
-            gridConfig: brickConfig['gridConfig'],
-            deg: 0,
-            brickNode: null,
-            gridColorKey,
-            brickInitPos: null,
-            rotateNode: null,
-            gridType: 0
-        }
-        this.bricksList.push(brickData)
-        // 生成方块
-        const brickNode = this.generateBrick(brickKey, gridColorKey, gridType)
-        this.bricksNode.addChild(brickNode)
-        brickData.brickNode = brickNode
-        // 方块间隔
-        let offset = 220
-        if (this.brickNum % 2 === 1) {
-            const middleNum = Math.floor(this.brickNum / 2) + 1
-            if (index < middleNum) {
-                offset = - offset
-            }
-            else if (index === middleNum) {
-                offset = 0
-            }
-        }
-        if (brickData && brickData.brickNode) {
-            brickData.brickNode.setPosition(offset, 0)
-            brickData.brickNode.scale_x = 0.6;
-            brickData.brickNode.scale_y = 0.6;
-            brickData.brickInitPos = brickData.brickNode.getWorldPosition()
-        }
-        // 添加旋转图标
-        if (brickData.rotateFlag) {
-            // brickData.rotateNode = instantiate(this.rotatePrefab)
-            brickData.rotateNode = instantiate(this.rotatePb);
-            this.rotateContainer.addChild(brickData.rotateNode)
-            brickData.rotateNode.setWorldPosition(brickNode.getWorldPosition())
-        }
-        // 方块添加事件
-        this.brickAddEvent(brickData)
-    }
-
-    brickAddEvent(brickData: BrickDataInterface) {
-        const brickNode = brickData.brickNode
-        if (!brickNode) return
-        // 触摸时
-        brickNode.on(Node.EventType.TOUCH_START, (event: EventTouch) => {
-            if (this.adShowingFlag || !this.operateFlag) return
-
-            this.editingData.brickData = brickData
-            this.editingData.gridList.length = 0
-            // 记录开始触摸的位置
-            this.touchStartPos.set(event.getUILocation())
-            // 添加到移动节点里进行移动
-            const pos = brickNode.getWorldPosition()
-            brickNode.setParent(this.movingNode)
-            brickNode.setWorldPosition(pos)
-
-            const index = this.bricksList.findIndex(data => data === brickData)
-            if (index > -1) {
-                this.editingData.brickData = this.bricksList.splice(index, 1)[0]
-            } else {
-                console.error("bricksList not find brickData:", brickData)
-            }
-        })
-        // 触摸移动时
-        brickNode.on(Node.EventType.TOUCH_MOVE, (event: EventTouch) => {
-            if (this.adShowingFlag || !this.operateFlag) return
-
-            const movePos: Vec2 = event.getUILocation().subtract(this.touchStartPos)
-            // 挪动很小时,不移动方块组合
-            if (movePos.length() <= this.rotateFaultTolerant) {
-                return
-            }
-            // 隐藏旋转节点
-            if (this.editingData.brickData?.rotateFlag && this.editingData.brickData.rotateNode) {
-                this.editingData.brickData.rotateNode.active = false
-            }
-            // 格子颜色恢复
-            this.gridColorRecovery()
-            // 移动
-            brickNode.setWorldPosition(event.getUILocation().toVec3().add3f(0, this.yOffset, 0))
-            // 每次移动重置数据
-            this.editingData.gridList.length = 0
-            // 实时获取方块位置判断在哪个格子上
-            const tempGridList: GridDataInterface[] = []
-            brickNode.children.forEach((brickGridNode) => {
-                const brickGridPos = brickGridNode.getWorldPosition()
-                let gridData: GridDataInterface | null = null
-                for (let rowIndex = 0; rowIndex < this.row && gridData === null; rowIndex++) {
-                    for (let columnIndex = 0; columnIndex < this.column && gridData === null; columnIndex++) {
-                        const nowGridData = this.gridList[rowIndex][columnIndex]
-                        if (!nowGridData?.gridNode) continue
-                        const gridPos = nowGridData.gridNode.getWorldPosition()
-                        if (Vec3.distance(gridPos, brickGridPos) <= (this.gridSize / 2 - this.gridMargin)) {
-                            gridData = nowGridData
-                        }
-                    }
-                }
-                if (gridData === null) return
-                tempGridList.push(gridData)
-            })
-            // 检查整体情况
-            let checkFlag = false
-            if (
-                tempGridList.length === brickData.gridConfig.length &&
-                tempGridList.filter(d => d.status === GridStatus.notUse).length === brickData.gridConfig.length
-            ) {
-                checkFlag = true
-                tempGridList.forEach((gridData) => {
-                    this.editingData.gridList.push(gridData)
-                })
-            }
-            // 格子给用户提示
-            tempGridList.forEach((gridData) => {
-                if (gridData.status !== GridStatus.notUse || !gridData.gridNode) return
-                const sprite = gridData.gridNode.children[0]?.getComponent(Sprite)
-                if (sprite) {
-                    sprite.color = checkFlag ? this.usableColor : this.unavailableColor
-                    // 用于恢复格子
-                    this.gridColorList.push(gridData)
-                }
-            })
-        })
-        // 触摸松开后
-        brickNode.on(Node.EventType.TOUCH_END, this.brickTouchEnd, this)
-        brickNode.on(Node.EventType.TOUCH_CANCEL, this.brickTouchEnd, this)
-    }
-
-    brickTouchEnd(event: EventTouch) {
-        if (this.adShowingFlag || !this.operateFlag) return
-        this.operateFlag = false
-        // 单击旋转
-        if (
-            this.editingData.brickData.rotateFlag &&
-            event.getUILocation().subtract(this.touchStartPos).length() <= this.rotateFaultTolerant
-        ) {
-            const brickData = this.editingData.brickData
-            // 方块放回待选区
-            if (brickData.brickNode && brickData.brickInitPos) {
-                this.bricksList.push(brickData)
-                this.bricksNode.addChild(brickData.brickNode)
-                brickData.brickNode.setWorldPosition(brickData.brickInitPos)
-                // 旋转
-                this.brickGridRotate(brickData).then(() => {
-                    this.operateFlag = true
-                })
-            }
-        }
-        // 方块到格子
-        else if (this.editingData.brickData && this.editingData.gridList.length > 0) {
-            // 修改格子
-            this.editingData.gridList.forEach((gridData) => {
-                gridData.status = GridStatus.used
-                gridData.gridColorKey = this.editingData.brickData.gridColorKey
-                this.generateGrid(gridData)
-            })
-            // 销毁方块
-            if (this.editingData.brickData.brickNode) {
-                this.editingData.brickData.brickNode.destroy()
-            }
-            // 销毁旋转节点
-            if (this.editingData.brickData.rotateFlag && this.editingData.brickData.rotateNode) {
-                this.editingData.brickData.rotateNode.destroy()
-            }
-            // 新增方块
-            this.addBrick(this.editingData.brickData.index)
-            this.scheduleOnce(() => {
-                // 格子消除
-                this.gridEliminate().then(() => {
-                    // 检查方块是否还能消除格子
-                    this.prompt(false).then((promptFlag: boolean) => {
-                        if (!promptFlag) {
-                            this.gameOver()
-                        }
-                        this.operateFlag = true
-                    })
-                })
-            })
-        }
-        // 方块回到待选区
-        else {
-            const brickData = this.editingData.brickData
-            this.bricksList.push(brickData)
-            this.operateFlag = false
-            // 回弹动画
-            if (brickData.brickNode) {
-                const pos = this.editingData.brickData.brickInitPos
-                if (!pos) {
-                    return;
-                }
-                tween(brickData.brickNode)
-                    .to(this.aniBrickMove, { worldPosition: pos })
-                    .call(() => {
-                        if (brickData.brickNode && brickData.brickInitPos && brickData.rotateNode) {
-                            this.bricksNode.addChild(brickData.brickNode)
-                            brickData.brickNode.setWorldPosition(brickData.brickInitPos)
-                            if (brickData.rotateFlag) {
-                                brickData.rotateNode.active = true
-                            }
-                            this.operateFlag = true
-                        }
-                    })
-                    .start()
-
-            }
-
-        }
-        // 格子颜色恢复
-        this.gridColorRecovery()
-    }
-
-
-    //格子颜色恢复
-    gridColorRecovery() {
-        while (this.gridColorList.length > 0) {
-            const gridData = this.gridColorList.pop()
-            if (gridData?.gridNode && gridData.status === GridStatus.notUse) {
-                const sprite = gridData.gridNode.children[0]?.getComponent(Sprite)
-                if (sprite) {
-                    sprite.color = this.notUseColor
-                }
-            }
-        }
-    }
-
-    nextGridRotate(gridConfig: GridConfigDataInterface[], deg: number) {
-        const newGridConfig: GridConfigDataInterface[] = []
-        // 顺时针旋转
-        let newDeg = deg - 90
-        gridConfig.forEach((gridConfigData) => {
-            // 例如(1,2) => (-2,1),可以画图分析
-            newGridConfig.push({
-                row: -gridConfigData.column,
-                column: gridConfigData.row
-            })
-        })
-        return { gridConfig: newGridConfig, deg: newDeg }
-    }
-
-    'brickGridRotate'(brickData: BrickDataInterface) {
-        return new Promise((resolve, reject) => {
-            // this.audioManager.playRotate()
-            const next = this.nextGridRotate(brickData.gridConfig, brickData.deg)
-            brickData.deg = next.deg
-            brickData.gridConfig = next.gridConfig
-
-            if (brickData.brickNode) {
-                tween(brickData.brickNode)
-                    .to(this.aniBrickRotate, { angle: next.deg })
-                    .call(() => {
-                        resolve(true)
-                    }).start()
-            }
-
-        })
-    }
-
-    gridEliminateCheck(gridList: GridDataInterface[][]) {
-        const gridEliminateList: GridDataInterface[] = []
-        let eliminateRowNum = 0
-        let eliminateColumnNum = 0
-        // 行检查
-        for (let rowIndex = 0; rowIndex < this.row; rowIndex++) {
-            const rowData = gridList[rowIndex]
-            if (rowData.every(gridData => gridData.status === GridStatus.used)) {
-                rowData.forEach(gridData => {
-                    if (gridEliminateList.findIndex(data => data === gridData) < 0) {
-                        gridEliminateList.push(gridData)
-                    }
-                })
-                eliminateRowNum += 1
-            }
-        }
-        // 列检查
-        for (let columnIndex = 0; columnIndex < this.column; columnIndex++) {
-            if (gridList.every(rowData => rowData[columnIndex].status === GridStatus.used)) {
-                gridList.forEach(rowData => {
-                    const gridData = rowData[columnIndex]
-                    if (gridEliminateList.findIndex(data => data === gridData) < 0) {
-                        gridEliminateList.push(gridData)
-                    }
-                })
-                eliminateColumnNum += 1
-            }
-        }
-        return {
-            gridEliminateList,
-            eliminateRowNum,
-            eliminateColumnNum,
-        }
-    }
-
-    // 消除
-    gridEliminate() {
-        return new Promise((resolve, reject) => {
-            const d = this.gridEliminateCheck(this.gridList)
-            const gridEliminateList = d.gridEliminateList
-            const eliminateRowNum = d.eliminateRowNum
-            const eliminateColumnNum = d.eliminateColumnNum
-            // 无行可消除
-            if (gridEliminateList.length < 1) {
-                resolve(false)
-                return
-            }
-            // 消除格子
-            gridEliminateList.forEach((gridData) => {
-                if (gridData.gridNode) {
-                    tween(gridData.gridNode.children[0])
-                        .to(this.aniBrickEliminate, { scale: new Vec3(0.5, 0.5) })
-                        .call(() => {
-                            gridData.status = GridStatus.notUse
-                            this.generateGrid(gridData)
-                        })
-                        .start()
-                }
-            })
-            // 音效
-            // this.audioManager.playEliminate()
-            this.scheduleOnce(() => {
-                // 成绩
-                let score = 0
-                for (let i = 1; i <= eliminateRowNum; i++) {
-                    score += this.column * i
-                }
-                for (let i = 1; i <= eliminateColumnNum; i++) {
-                    score += this.row * i
-                }
-                this.score += score
-                resolve(true)
-            }, 0.2)
-        })
-    }
-
-    gameOver() {
-        // this.audioManager.playGameOver()
-        this.setGameStauts(GameStatus.end)
-    }
-
-    moveIf(row: number, column: number, gridConfig: GridConfigDataInterface[]) {
-        let moveFlag = true
-        for (let i = 0; i < gridConfig.length; i++) {
-            const gridConfigData = gridConfig[i]
-            const gridI = row + gridConfigData.row
-            const gridJ = column + gridConfigData.column
-            // 边界判断
-            if (
-                gridI < 0 ||
-                gridI > this.row - 1 ||
-                gridJ < 0 ||
-                gridJ > this.column - 1
-            ) {
-                moveFlag = false
-                break
-            }
-            // 已用
-            else if (this.gridList[gridI][gridJ].status === GridStatus.used) {
-                moveFlag = false
-                break
-            }
-        }
-        return moveFlag
-    }
-
-    copyGridList() {
-        const gridList: GridDataInterface[][] = []
-        for (let rowIndex = 0; rowIndex < this.row; rowIndex++) {
-            gridList.push([])
-            for (let columnIndex = 0; columnIndex < this.column; columnIndex++) {
-                const gridData = this.gridList[rowIndex][columnIndex]
-                gridList[rowIndex].push({
-                    name: gridData.name,
-                    status: gridData.status,
-                    gridNode: null,
-                    row: gridData.row,
-                    column: gridData.column,
-                    gridColorKey: gridData.gridColorKey,
-                    gridType: gridData.gridType
-                })
-            }
-        }
-        return gridList
-    }
-
-    prompt(tipFlag = true) {
-        return new Promise((resolve, reject) => {
-            const gridPromptList: GridDataInterface[] = []
-            let moveFlag = false
-            // 找方块可消除位置
-            for (let rowIndex = 0; rowIndex < this.row && !moveFlag; rowIndex++) {
-                for (let columnIndex = 0; columnIndex < this.column && !moveFlag; columnIndex++) {
-                    const gridData = this.gridList[rowIndex][columnIndex]
-                    if (gridData.status !== GridStatus.notUse) continue
-                    // 方块不旋转检测是否能放
-                    for (let brickI = 0; brickI < this.bricksList.length && !moveFlag; brickI++) {
-                        const brickData = this.bricksList[brickI]
-                        if (this.moveIf(rowIndex, columnIndex, brickData.gridConfig)) {
-                            // 复制整体网格,以方块设置网格状态
-                            const gridList = this.copyGridList()
-                            brickData.gridConfig.forEach((gridConfigData) => {
-                                gridList[gridConfigData.row + rowIndex][gridConfigData.column + columnIndex].status = GridStatus.used
-                            })
-                            // 检查复制的整体网格是否有可消除
-                            if (this.gridEliminateCheck(gridList).gridEliminateList.length > 0) {
-                                moveFlag = true
-                                brickData.gridConfig.forEach((gridConfigData) => {
-                                    gridPromptList.push(this.gridList[gridConfigData.row + rowIndex][gridConfigData.column + columnIndex])
-                                })
-                            }
-                        }
-                    }
-                    // 方块旋转检测是否能放
-                    for (let brickI = 0; brickI < this.bricksList.length && !moveFlag; brickI++) {
-                        const brickData = this.bricksList[brickI]
-                        if (!brickData.rotateFlag) continue
-                        let gridConfig = brickData.gridConfig
-                        let deg = brickData.deg
-                        // 获得旋转的方块网格配置
-                        for (let count = 1; count <= 3 && !moveFlag; count++) {
-                            const next = this.nextGridRotate(gridConfig, deg)
-                            if (this.moveIf(rowIndex, columnIndex, next.gridConfig)) {
-                                // 复制整体网格,以方块设置网格状态
-                                const gridList = this.copyGridList()
-                                next.gridConfig.forEach((gridConfigData) => {
-                                    gridList[gridConfigData.row + rowIndex][gridConfigData.column + columnIndex].status = GridStatus.used
-                                })
-                                // 检查复制的整体网格是否有可消除
-                                if (this.gridEliminateCheck(gridList).gridEliminateList.length > 0) {
-                                    moveFlag = true
-                                    next.gridConfig.forEach((gridConfigData) => {
-                                        gridPromptList.push(this.gridList[gridConfigData.row + rowIndex][gridConfigData.column + columnIndex])
-                                    })
-                                }
-                            }
-                            gridConfig = next.gridConfig
-                            deg = next.deg
-                        }
-                    }
-                }
-            }
-            // 找方块可放置位置
-            for (let rowIndex = 0; rowIndex < this.row && !moveFlag; rowIndex++) {
-                for (let columnIndex = 0; columnIndex < this.column && !moveFlag; columnIndex++) {
-                    const gridData = this.gridList[rowIndex][columnIndex]
-                    if (gridData.status !== GridStatus.notUse) continue
-                    // 方块不旋转检测是否能放
-                    for (let brickI = 0; brickI < this.bricksList.length && !moveFlag; brickI++) {
-                        const brickData = this.bricksList[brickI]
-                        if (this.moveIf(rowIndex, columnIndex, brickData.gridConfig)) {
-                            moveFlag = true
-                            brickData.gridConfig.forEach((gridConfigData) => {
-                                gridPromptList.push(this.gridList[gridConfigData.row + rowIndex][gridConfigData.column + columnIndex])
-                            })
-                        }
-                    }
-                    // 方块旋转检测是否能放
-                    for (let brickI = 0; brickI < this.bricksList.length && !moveFlag; brickI++) {
-                        const brickData = this.bricksList[brickI]
-                        if (!brickData.rotateFlag) continue
-                        let gridConfig = brickData.gridConfig
-                        let deg = brickData.deg
-                        for (let count = 1; count <= 3 && !moveFlag; count++) {
-                            const next = this.nextGridRotate(gridConfig, deg)
-                            if (this.moveIf(rowIndex, columnIndex, next.gridConfig)) {
-                                moveFlag = true
-                                next.gridConfig.forEach((gridConfigData) => {
-                                    gridPromptList.push(this.gridList[gridConfigData.row + rowIndex][gridConfigData.column + columnIndex])
-                                })
-                            }
-                            gridConfig = next.gridConfig
-                            deg = next.deg
-                        }
-                    }
-                }
-            }
-
-            if (gridPromptList.length < 1) {
-                resolve(false)
-                return
-            }
-            if (!tipFlag) {
-                resolve(true)
-                return
-            }
-            // 提示用户(网格变绿)
-            gridPromptList.forEach((gridData) => {
-                if (gridData.gridNode) {
-                    const sprite = gridData.gridNode.children[0]?.getComponent(Sprite)
-                    if (sprite) {
-                        sprite.color = this.usableColor
-                        // 用于恢复格子
-                        this.gridColorList.push(gridData)
-                    }
-                }
-            })
-            resolve(true)
-        })
-    }
-
-
-    //重新开始
-    onRefreshBtnClick() {
-        if (
-            this.gameStatus !== GameStatus.running ||
-            !this.operateFlag ||
-            this.adShowingFlag
-        ) return
-
-        this.setAdShowingFlag(true)
-        this.bricksNode.destroyAllChildren()
-        this.rotateContainer.destroyAllChildren()
-        this.bricksList.length = 0
-        for (let i = 1; i <= this.brickNum; i++) {
-            this.addBrick(i)
-        }
-        // 恢复格子颜色
-        this.gridColorRecovery()
-        this.setAdShowingFlag(false)
-
-    }
-
-    //--复活
-    onPromptBtnClick() {
-        if (
-            this.gameStatus !== GameStatus.running ||
-            !this.operateFlag ||
-            this.adShowingFlag
-        ) return
-
-        // 先检查是否死局
-        this.prompt(false).then((flag) => {
-            if (!flag) {
-                this.gameOver()
-                return
-            }
-            // 非死局,打开广告
-            this.setAdShowingFlag(true)
-            // SDKManager.showVideoAd().then((isEnded: boolean) => {
-            //     if (isEnded) {
-            //         this.gridColorRecovery()
-            //         this.prompt()
-            //     }
-            //     this.setAdShowingFlag(false)
-            // }).catch((err) => {
-            //     console.error('onPromptBtnClick', err)
-            //     this.setAdShowingFlag(false)
-            // })
-        })
-    }
-
-    //再来一次
-    onAgainBtnClick() {
-        if (!this.operateFlag) return
-
-        this.initData()
-    }
-
-    //确认游戏
-    onContinueBtnClick() {
-        this.setGameStauts(GameStatus.running)
-    }
-
-}
-
-

+ 0 - 9
assets/script/game/view/core/GameView.ts.meta

@@ -1,9 +0,0 @@
-{
-  "ver": "4.0.24",
-  "importer": "typescript",
-  "imported": true,
-  "uuid": "362651a5-a95e-4b3a-b54b-deccbf778a76",
-  "files": [],
-  "subMetas": {},
-  "userData": {}
-}