fix: 修复新波次开始后游戏阶段状态错误的问题
- 在 MissionComp 中新增波次时调用 enterPreparePhase 进入准备阶段 - 在 MissionMonComp 中检查战斗状态,避免波次结束后继续生成怪物 - 在 MissionCardComp 中监听新波次事件并进入准备阶段
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user