feat(gui,logic): 优化战斗结算体验,新增延迟弹窗逻辑

1.  新增结算延迟机制,等待死亡动画播放完成后再弹出结算窗口
2.  调整金币道具、顶部UI、剪辑UI的尺寸、位置和贴图资源
3.  修复重复触发结算的问题,增加调度状态校验
This commit is contained in:
panFD
2026-09-09 22:52:08 +08:00
parent 124bb19005
commit a02bf54ede
8 changed files with 1798 additions and 1431 deletions

View File

@@ -171,6 +171,10 @@ export class MissionComp extends CCComp {
private isWaveCountdown: boolean = false;
/** 本局是否胜利(open_Victory 时记录,供结算弹窗使用) */
private _victory: boolean = false;
/** 结算弹窗延迟(秒):等待最后一个英雄/怪物死亡动画播完再切 BattleEnd */
private static readonly SETTLE_DELAY = 1.5;
/** 结算是否已预约调度(防止 0.2s 同步周期内重复 scheduleOnce) */
private _settleScheduled: boolean = false;
// ======================== ECS 查询匹配器(预缓存) ========================
@@ -913,7 +917,8 @@ export class MissionComp extends CCComp {
allAlive,
fastClear,
});
this.open_Victory(null, false, true);
// 最后一个怪物死亡:延迟结算,等待死亡动画播放完再弹窗
this.scheduleSettle(false, true);
return;
}
@@ -934,14 +939,32 @@ export class MissionComp extends CCComp {
}
/**
* 英雄全灭检测:若场上无存活英雄且处于战斗中,触发结算弹窗。
* 英雄全灭检测:若场上无存活英雄且处于战斗中,预约延迟结算(等待死亡动画播完再弹窗)。
* @param heroCount 当前存活英雄数量
*/
private handleHeroWipe(heroCount: number) {
if (heroCount > 0) return;
if (!smc.mission.play || smc.mission.pause) return;
if (this.currentPhase !== MissionPhase.Battle) return;
this.open_Victory(null, true);
this.scheduleSettle(true, false);
}
/**
* 预约延迟结算:最后一个英雄/怪物死亡时,延迟 SETTLE_DELAY 秒等待死亡动画播完,
* 再切入 BattleEnd(由 autoNextPhase 流转弹窗),避免结算窗立即盖住死亡表现。
* @param is_hero_dead 是否因英雄全灭触发
* @param victory 是否胜利
*/
private scheduleSettle(is_hero_dead: boolean, victory: boolean) {
if (this._settleScheduled) return;
this._settleScheduled = true;
this.scheduleOnce(() => {
this._settleScheduled = false;
// 延迟期间局内状态可能已变化(如复活、任务结束),兜底校验
if (!smc.mission.play || smc.mission.pause) return;
if (this.currentPhase !== MissionPhase.Battle) return;
this.open_Victory(null, is_hero_dead, victory);
}, MissionComp.SETTLE_DELAY);
}
/**