From 4e7c58093669ee469971cd01eeee224665249eb6 Mon Sep 17 00:00:00 2001 From: walkpan Date: Fri, 27 Mar 2026 08:39:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=96=B0=E6=B3=A2?= =?UTF-8?q?=E6=AC=A1=E5=BC=80=E5=A7=8B=E5=90=8E=E6=B8=B8=E6=88=8F=E9=98=B6?= =?UTF-8?q?=E6=AE=B5=E7=8A=B6=E6=80=81=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 MissionComp 中新增波次时调用 enterPreparePhase 进入准备阶段 - 在 MissionMonComp 中检查战斗状态,避免波次结束后继续生成怪物 - 在 MissionCardComp 中监听新波次事件并进入准备阶段 --- assets/script/game/map/MissionCardComp.ts | 5 +++++ assets/script/game/map/MissionComp.ts | 1 + assets/script/game/map/MissionMonComp.ts | 1 + 3 files changed, 7 insertions(+) diff --git a/assets/script/game/map/MissionCardComp.ts b/assets/script/game/map/MissionCardComp.ts index b31dbf02..71f21fbb 100644 --- a/assets/script/game/map/MissionCardComp.ts +++ b/assets/script/game/map/MissionCardComp.ts @@ -144,6 +144,7 @@ export class MissionCardComp extends CCComp { /** 生命周期事件 */ this.on(GameEvent.MissionStart, this.onMissionStart, this); this.on(GameEvent.MissionEnd, this.onMissionEnd, this); + this.on(GameEvent.NewWave, this.onNewWave, this); this.on(GameEvent.FightStart, this.onFightStart, this); this.on(GameEvent.CoinAdd, this.onCoinAdd, this); oops.message.on(GameEvent.MasterCalled, this.onMasterCalled, this); @@ -174,6 +175,10 @@ export class MissionCardComp extends CCComp { private onFightStart() { this.enterBattlePhase(); } + + private onNewWave() { + this.enterPreparePhase(); + } /** 解除按钮监听,避免节点销毁后回调泄漏 */ private unbindEvents() { diff --git a/assets/script/game/map/MissionComp.ts b/assets/script/game/map/MissionComp.ts index c5792319..e6a5f604 100644 --- a/assets/script/game/map/MissionComp.ts +++ b/assets/script/game/map/MissionComp.ts @@ -254,6 +254,7 @@ export class MissionComp extends CCComp { private onNewWave(event: string, data: any) { const wave = Number(data?.wave ?? 0); if (wave <= 0) return; + this.enterPreparePhase(); this.currentWave = wave; smc.vmdata.mission_data.level = wave; this.grantPrepareCoinByWave(wave); diff --git a/assets/script/game/map/MissionMonComp.ts b/assets/script/game/map/MissionMonComp.ts index 1a685ce6..3b262ce6 100644 --- a/assets/script/game/map/MissionMonComp.ts +++ b/assets/script/game/map/MissionMonComp.ts @@ -92,6 +92,7 @@ export class MissionMonCompComp extends CCComp { if(smc.mission.stop_mon_action) return; if(!smc.mission.in_fight) return; this.tryAdvanceWave(); + if(!smc.mission.in_fight) return; if(smc.mission.stop_spawn_mon) return; this.updateSpecialQueue(dt); this.updateWaveSpawn(dt);