fix(英雄移动): 添加暂停怪物行动时英雄也停止移动的逻辑

当开启四选一界面时暂停怪物行动,现在英雄移动也会同步暂停。同时在MissionCardComp中添加对stop_mon_action状态的管理,确保界面开关时游戏状态正确切换。
This commit is contained in:
walkpan
2026-01-06 19:50:20 +08:00
parent 0febe02ecc
commit 343e14b56c
2 changed files with 15 additions and 0 deletions

View File

@@ -35,6 +35,8 @@ export class HeroMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
update(e: ecs.Entity) {
// 1. 全局状态检查
if (!smc.mission.play || smc.mission.pause) return;
// 如果开启了暂停怪物行动(通常用于四选一界面),玩家角色也应该停止移动
if (smc.mission.stop_mon_action) return;
const model = e.get(HeroAttrsComp);
const move = e.get(HeroMoveComp);

View File

@@ -177,6 +177,11 @@ export class MissionCardComp extends CCComp {
this.noStop.active = true;
this.checkNoStop()
}
// 如果没有开启 noStop则暂停怪物行动
if (!smc.data.noStop) {
smc.mission.stop_mon_action = true;
}
this.resetCardStates();
this.refCards();
@@ -184,6 +189,11 @@ export class MissionCardComp extends CCComp {
}
checkNoStop(){
this.noStop.getChildByName("no").active=!smc.data.noStop
// 更新暂停状态
if (this.node.active) {
smc.mission.stop_mon_action = !smc.data.noStop;
}
}
switchNoStop(){
smc.data.noStop=!smc.data.noStop
@@ -408,6 +418,9 @@ export class MissionCardComp extends CCComp {
close() {
this.node.active = false;
// 恢复游戏运行状态(取消暂停)
smc.mission.stop_mon_action = false;
// 关闭时隐藏按钮,避免下次打开其他类型时闪烁
if (this.btnClose) {
this.btnClose.active = false;