fix(英雄移动): 添加暂停怪物行动时英雄也停止移动的逻辑
当开启四选一界面时暂停怪物行动,现在英雄移动也会同步暂停。同时在MissionCardComp中添加对stop_mon_action状态的管理,确保界面开关时游戏状态正确切换。
This commit is contained in:
@@ -35,6 +35,8 @@ export class HeroMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
|
|||||||
update(e: ecs.Entity) {
|
update(e: ecs.Entity) {
|
||||||
// 1. 全局状态检查
|
// 1. 全局状态检查
|
||||||
if (!smc.mission.play || smc.mission.pause) return;
|
if (!smc.mission.play || smc.mission.pause) return;
|
||||||
|
// 如果开启了暂停怪物行动(通常用于四选一界面),玩家角色也应该停止移动
|
||||||
|
if (smc.mission.stop_mon_action) return;
|
||||||
|
|
||||||
const model = e.get(HeroAttrsComp);
|
const model = e.get(HeroAttrsComp);
|
||||||
const move = e.get(HeroMoveComp);
|
const move = e.get(HeroMoveComp);
|
||||||
|
|||||||
@@ -177,6 +177,11 @@ export class MissionCardComp extends CCComp {
|
|||||||
this.noStop.active = true;
|
this.noStop.active = true;
|
||||||
this.checkNoStop()
|
this.checkNoStop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果没有开启 noStop,则暂停怪物行动
|
||||||
|
if (!smc.data.noStop) {
|
||||||
|
smc.mission.stop_mon_action = true;
|
||||||
|
}
|
||||||
|
|
||||||
this.resetCardStates();
|
this.resetCardStates();
|
||||||
this.refCards();
|
this.refCards();
|
||||||
@@ -184,6 +189,11 @@ export class MissionCardComp extends CCComp {
|
|||||||
}
|
}
|
||||||
checkNoStop(){
|
checkNoStop(){
|
||||||
this.noStop.getChildByName("no").active=!smc.data.noStop
|
this.noStop.getChildByName("no").active=!smc.data.noStop
|
||||||
|
|
||||||
|
// 更新暂停状态
|
||||||
|
if (this.node.active) {
|
||||||
|
smc.mission.stop_mon_action = !smc.data.noStop;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
switchNoStop(){
|
switchNoStop(){
|
||||||
smc.data.noStop=!smc.data.noStop
|
smc.data.noStop=!smc.data.noStop
|
||||||
@@ -408,6 +418,9 @@ export class MissionCardComp extends CCComp {
|
|||||||
close() {
|
close() {
|
||||||
this.node.active = false;
|
this.node.active = false;
|
||||||
|
|
||||||
|
// 恢复游戏运行状态(取消暂停)
|
||||||
|
smc.mission.stop_mon_action = false;
|
||||||
|
|
||||||
// 关闭时隐藏按钮,避免下次打开其他类型时闪烁
|
// 关闭时隐藏按钮,避免下次打开其他类型时闪烁
|
||||||
if (this.btnClose) {
|
if (this.btnClose) {
|
||||||
this.btnClose.active = false;
|
this.btnClose.active = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user