From e87be79792b513cf4c491d1348c8dcce8ef4362a Mon Sep 17 00:00:00 2001 From: panw Date: Tue, 14 Apr 2026 17:39:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(mission):=20=E4=BF=AE=E5=A4=8D=E6=B3=A2?= =?UTF-8?q?=E6=AC=A1=E6=9B=B4=E8=BF=AD=E4=B8=8E=E6=88=98=E6=96=97=E7=BB=93?= =?UTF-8?q?=E6=9D=9F=E9=98=B6=E6=AE=B5=E7=9A=84=E9=80=BB=E8=BE=91=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 调整 PhaseTime 计时器间隔为 1 秒,避免更新过于频繁。 在 update 逻辑中,当游戏暂停且当前阶段不是 BattleEnd 时才完全停止,确保战斗结束动画能正常播放并自动流转。 修改波次更迭逻辑:新波次到来时先进入 BattleEnd 阶段,播放结束技能后自动进入准备阶段,避免与 open_Victory 的结算流程冲突。 在 open_Victory 中立即标记暂停,以切断波次自动流转。 --- assets/script/game/map/MissionComp.ts | 50 +++++++++++++++++---------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/assets/script/game/map/MissionComp.ts b/assets/script/game/map/MissionComp.ts index 0b1e9679..e44f10b9 100644 --- a/assets/script/game/map/MissionComp.ts +++ b/assets/script/game/map/MissionComp.ts @@ -127,7 +127,7 @@ export class MissionComp extends CCComp { diamond:0 } /**秒计时 */ - PhaseTime:Timer= new Timer(0.5) + PhaseTime:Timer= new Timer(1) /** 上一次显示的时间字符串(避免重复设置) */ private lastTimeStr: string = ""; /** 上一次显示的秒数(避免重复计算) */ @@ -194,7 +194,9 @@ export class MissionComp extends CCComp { */ protected update(dt: number): void { if(!smc.mission.play) return - if(smc.mission.pause) return + + // 如果是暂停状态,且不在 BattleEnd 阶段(全灭时需要播放完 fend 技能动画并自动流转),才真正停止 update 逻辑 + if(smc.mission.pause && this.currentPhase !== MissionPhase.BattleEnd) return // 处理过渡阶段的计时 if (this.currentPhase === MissionPhase.PrepareStart || @@ -372,23 +374,28 @@ export class MissionComp extends CCComp { case MissionPhase.BattleEnd: // BattleEnd 计时结束后,如果是因为全灭或手动调用的 fight_end,进入 Settle // 需要注意的是,open_Victory / fight_end 现在只需切换到 BattleEnd 即可,Settle 由这里自动接管 - this.changePhase(MissionPhase.Settle); - - // 此时已经经过了 2s,可以真正执行结算弹窗或清理逻辑 - if (smc.mission.play) { - // 如果游戏还在运行中,说明是通过 open_Victory 进来的 - smc.mission.pause = true; - mLogger.log(this.debugMode, 'MissionComp', " autoNextPhase -> open_Victory logic", this.revive_times); - oops.gui.open(UIID.Victory, { - victory: false, - rewards: this.rewards, - game_data: this.game_data, - can_revive: this.revive_times > 0 - }); + // 如果游戏正在运行(波次更迭),则自动进入 PrepareStart 阶段 + if (smc.mission.play && !smc.mission.pause) { + this.changePhase(MissionPhase.PrepareStart); } else { - // 如果 play 已经是 false,说明是通过 fight_end 进来的 - this.cleanComponents(); - this.clearBattlePools(); + this.changePhase(MissionPhase.Settle); + + // 此时已经经过了 2s,可以真正执行结算弹窗或清理逻辑 + if (smc.mission.play) { + // 如果游戏还在运行中,说明是通过 open_Victory 进来的 + smc.mission.pause = true; + mLogger.log(this.debugMode, 'MissionComp', " autoNextPhase -> open_Victory logic", this.revive_times); + oops.gui.open(UIID.Victory, { + victory: false, + rewards: this.rewards, + game_data: this.game_data, + can_revive: this.revive_times > 0 + }); + } else { + // 如果 play 已经是 false,说明是通过 fight_end 进来的 + this.cleanComponents(); + this.clearBattlePools(); + } } break; } @@ -458,6 +465,8 @@ export class MissionComp extends CCComp { * @param is_hero_dead 是否因英雄全灭触发 */ open_Victory(e:any,is_hero_dead: boolean = false){ + // 战斗失败或胜利,标记暂停状态以切断波次流转逻辑 + smc.mission.pause = true; // 直接切入 BattleEnd,触发 fend 表现 // 倒计时逻辑已在 update 中由 PhaseTime 接管,2s 后将触发 autoNextPhase 弹窗结算 this.changePhase(MissionPhase.BattleEnd); @@ -541,7 +550,10 @@ export class MissionComp extends CCComp { private onNewWave(event: string, data: any) { const wave = Number(data?.wave ?? 0); if (wave <= 0) return; - this.enterPreparePhase(); + + // 在新一波到来时,先进入 BattleEnd,触发上一波的战斗结束技能 (fend),2秒后自动进入下一波的准备阶段 + this.changePhase(MissionPhase.BattleEnd); + this.currentWave = wave; smc.vmdata.mission_data.level = wave; this.grantPrepareCoinByWave(wave);