From 343e14b56c6b3e13b2ce7f4cfa6d49990cd8d8ef Mon Sep 17 00:00:00 2001 From: walkpan Date: Tue, 6 Jan 2026 19:50:20 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=8B=B1=E9=9B=84=E7=A7=BB=E5=8A=A8):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9A=82=E5=81=9C=E6=80=AA=E7=89=A9=E8=A1=8C?= =?UTF-8?q?=E5=8A=A8=E6=97=B6=E8=8B=B1=E9=9B=84=E4=B9=9F=E5=81=9C=E6=AD=A2?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当开启四选一界面时暂停怪物行动,现在英雄移动也会同步暂停。同时在MissionCardComp中添加对stop_mon_action状态的管理,确保界面开关时游戏状态正确切换。 --- assets/script/game/hero/HeroMove.ts | 2 ++ assets/script/game/map/MissionCardComp.ts | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/assets/script/game/hero/HeroMove.ts b/assets/script/game/hero/HeroMove.ts index 8a66bd6e..713d2792 100644 --- a/assets/script/game/hero/HeroMove.ts +++ b/assets/script/game/hero/HeroMove.ts @@ -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); diff --git a/assets/script/game/map/MissionCardComp.ts b/assets/script/game/map/MissionCardComp.ts index 0d82d40c..44775349 100644 --- a/assets/script/game/map/MissionCardComp.ts +++ b/assets/script/game/map/MissionCardComp.ts @@ -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;