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