From 62fe4d309fb76045d3b0096e243d4ad9d2450123 Mon Sep 17 00:00:00 2001 From: "COMPUTER\\EDY" <249929363@qq.com> Date: Fri, 3 Jul 2026 14:34:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=86=BB=E7=BB=93=EF=BC=8C?= =?UTF-8?q?=E6=9A=82=E5=81=9C=E5=8A=9F=E8=83=BD=E7=AD=89=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Scene/HomeScene.fire | 2 +- assets/Script/Block.ts | 5 ++++- assets/Script/Map.ts | 33 +++++++++++++++++++-------------- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/assets/Scene/HomeScene.fire b/assets/Scene/HomeScene.fire index 8621e40..9435e30 100644 --- a/assets/Scene/HomeScene.fire +++ b/assets/Scene/HomeScene.fire @@ -24720,7 +24720,7 @@ "_prefab": { "__id__": 566 }, - "_opacity": 200, + "_opacity": 250, "_color": { "__type__": "cc.Color", "r": 0, diff --git a/assets/Script/Block.ts b/assets/Script/Block.ts index 4706ccf..7e28268 100644 --- a/assets/Script/Block.ts +++ b/assets/Script/Block.ts @@ -1281,6 +1281,9 @@ export default class Block extends cc.Component { // 8. 延时检测游戏是否结束 // ============================================ removeAction(diraction, type) { + // 记住这次操作开始时的冻结世代。移出动画完成前如果玩家才使用冻结, + // 延时回调不能把这个新冻结解除。 + const actionFreezeVersion = MapConroler._instance.freezeVersion; this.node.off(cc.Node.EventType.TOUCH_START); this.node.off(cc.Node.EventType.TOUCH_MOVE); this.node.off(cc.Node.EventType.TOUCH_CANCEL); @@ -1413,7 +1416,7 @@ export default class Block extends cc.Component { MapConroler._instance.upDoor(tempColor); }, 250); - MapConroler._instance.nextLevel(1); + MapConroler._instance.nextLevel(1, actionFreezeVersion); let colorTemp = this.color; if (this.node) { this.over = true; diff --git a/assets/Script/Map.ts b/assets/Script/Map.ts index 10839ae..bbb4b19 100644 --- a/assets/Script/Map.ts +++ b/assets/Script/Map.ts @@ -132,6 +132,7 @@ export default class MapConroler extends cc.Component { buttonWall: any; //按钮墙数组 riseFallBlock: any; //升降地块数组 scheduleCallback: any;//倒计时用 + freezeVersion: number = 0;//每次启用时间冻结时递增,用于识别冻结前已排队的异步回调 homeCanTouch: boolean = true;//按钮可用状态 againCanTouch: boolean = true;//重玩按钮可以用状态 gameOver: boolean = false;//游戏结束状态 @@ -3143,12 +3144,21 @@ export default class MapConroler extends cc.Component { } //判断游戏成功下一关 - nextLevel(num: number) { + nextLevel(num: number, actionFreezeVersion: number = this.freezeVersion) { if (num == 1) { - this.openIce(); - if (this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) { + // 方块移出动画是延时完成的。如果动画开始后才使用冻结, + // 这个旧回调不应该立即解除新的冻结状态。 + const iceActive = this.node.parent.getChildByName("Ice").active; + const actionStartedBeforeFreeze = iceActive && actionFreezeVersion != this.freezeVersion; + if (!actionStartedBeforeFreeze) { + this.openIce(); + } + if (this.iceTrue() == false && this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) { this.pause = false; } + else if (iceActive) { + this.pause = true; + } } else { if (this.iceTrue() == true) { this.pause = true; @@ -3839,14 +3849,6 @@ export default class MapConroler extends cc.Component { return; } - if (this.node.parent.getChildByName("Ice").active) { - this.freezeMask.active = false; - let freezeBtn = this.node.parent.getChildByName("Bottom").getChildByName("timeBtn"); - freezeBtn.getComponent("btnControl").setTouch(true); - this.node.parent.getChildByName("Ice").getChildByName("skeleton").active = false; - this.node.parent.getChildByName("Ice").active = false; - } - if (data.type == "time") { if (cc.fx.GameConfig.GM_INFO.review < 2) cc.fx.GameConfig.GM_INFO.review += 1; @@ -3875,7 +3877,7 @@ export default class MapConroler extends cc.Component { this.gameOver = false; this.gameWin = false; - if (this.node.parent.parent.parent.getChildByName("Pause").active == false) { + if (this.iceTrue() == false && this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) { this.pause = false; this.stopBoom(); } @@ -3947,7 +3949,7 @@ export default class MapConroler extends cc.Component { MiniGameSdk.API.showToast("继续游戏"); this.gameOver = false; this.gameWin = false; - if (this.node.parent.parent.parent.getChildByName("Pause").active == false) { + if (this.iceTrue() == false && this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) { this.pause = false; } this.timeNumber = 21; @@ -4451,6 +4453,8 @@ export default class MapConroler extends cc.Component { // 6. 时间归零时触发游戏失败 // ============================================ startTimeCutDown() { + // 保证始终只有一个游戏倒计时回调,避免多次启动后时间成倍减少。 + this.stopTimeCutDown(); this.startBoom(); this.lastBlockClickTime = Date.now(); // 初始化上次点击时间 this.noBlockClickDuration = 0; // 重置未点击持续时间 @@ -4588,6 +4592,7 @@ export default class MapConroler extends cc.Component { } cc.fx.AudioManager._instance.playEffect("timePause1", null); const timestamp = Date.now(); + this.freezeVersion += 1; this.freezeMask.active = true; this.stopBoom(); this.pause = true; @@ -4848,7 +4853,7 @@ export default class MapConroler extends cc.Component { this.hammer = false; this.ishammer = false; - if (this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) { + if (this.iceTrue() == false && this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) { this.pause = false; if (this.gameStart == true) this.startBoom(); }