Ver Fonte

fixed bug

woso_javan há 3 meses atrás
pai
commit
f24119aec2
1 ficheiros alterados com 25 adições e 12 exclusões
  1. 25 12
      assets/module_take_goblet/Script/LevelAction.ts

+ 25 - 12
assets/module_take_goblet/Script/LevelAction.ts

@@ -311,16 +311,7 @@ export class LevelAction extends Component {
             const remaining = originCup.waters.children.filter(n => n.active).length;
             if (hasUnprocessed || remaining > 0) {
                 // console.log("游戏结束:仍有未处理的水层");
-                this.isProcessing = true;
-
-                const waitLength = this.waitArea!.getCups().length;
-                const outLength = this.outArea!.getCups().length;
-                let remain = waitLength + outLength;
-                console.log(`waitLength:${waitLength} +  outLenght:${outLength} = remain:${remain}`);
-                LevelManager.instance.levelModel.remainCupCount = remain;
-
-                LevelManager.instance.levelModel.isWin = false;
-                tgxUIMgr.inst.showUI(UI_BattleResult);
+                this.loadResultPanel(false);
             } else {
                 // 所有水层处理完毕,销毁原浆杯
                 await originCup.destroyOriginCup();
@@ -427,12 +418,34 @@ export class LevelAction extends Component {
         }
 
         await GameUtil.delay(0.2);
+
+        //失败检查:制作区大于5个杯子就失败
+        console.log('制作区水杯数量:', this.outArea.getCups().length);
+        if (this.outArea.getCups().length > 5) {
+            this.loadResultPanel(false);
+        }
+
         // 在添加完成后处理暂存区倒水
         await this.handlePourTempCupToOutArea();
-
         // 胜利条件检测:当两个区域都没有杯子时触发胜利
         if (this.outArea.getCups().length === 0 && this.waitArea.cups.length === 0) {
-            this.isProcessing = true;
+            this.loadResultPanel(true);
+        }
+    }
+
+    //加载结算面板
+    loadResultPanel(win: boolean) {
+        this.isProcessing = true;
+        if (!win) {
+            const waitLength = this.waitArea!.getCups().length;
+            const outLength = this.outArea!.getCups().length;
+            let remain = waitLength + outLength;
+            console.log(`waitLength:${waitLength} +  outLenght:${outLength} = remain:${remain}`);
+            LevelManager.instance.levelModel.remainCupCount = remain;
+
+            LevelManager.instance.levelModel.isWin = false;
+            tgxUIMgr.inst.showUI(UI_BattleResult);
+        } else {
             LevelManager.instance.levelModel.isWin = true;
             tgxUIMgr.inst.showUI(UI_BattleResult);
         }