From c0243fc15981dddb98137e5f247b3c10c4a0ffd1 Mon Sep 17 00:00:00 2001 From: panw Date: Tue, 14 Apr 2026 10:51:11 +0800 Subject: [PATCH] =?UTF-8?q?feat(map):=20=E6=B7=BB=E5=8A=A0=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E9=98=B6=E6=AE=B5=E5=90=8D=E7=A7=B0=E7=9A=84UI?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在MissionComp中添加阶段名称映射表,并在阶段切换时更新UI显示。 --- assets/script/game/map/MissionComp.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/assets/script/game/map/MissionComp.ts b/assets/script/game/map/MissionComp.ts index cadf9467..0b1e9679 100644 --- a/assets/script/game/map/MissionComp.ts +++ b/assets/script/game/map/MissionComp.ts @@ -100,6 +100,18 @@ export class MissionComp extends CCComp { @property(Node) time_node:Node = null! + /** 阶段名称映射表(用于 UI 显示) */ + private static readonly PhaseNameMap: Record = { + [MissionPhase.None]: "未开始", + [MissionPhase.PrepareStart]: "准备开始", + [MissionPhase.Prepare]: "准备阶段", + [MissionPhase.PrepareEnd]: "准备结束", + [MissionPhase.BattleStart]: "战斗开始", + [MissionPhase.Battle]: "战斗中", + [MissionPhase.BattleEnd]: "战斗结束", + [MissionPhase.Settle]: "结算阶段" + }; + // ======================== 运行时状态 ======================== /** 战斗倒计时(秒) */ @@ -279,6 +291,17 @@ export class MissionComp extends CCComp { const oldPhase = this.currentPhase; this.currentPhase = targetPhase; + // 更新阶段显示 UI + if (this.time_node && this.time_node.isValid) { + const phaseNode = this.time_node.getChildByPath("Phase/Label"); + if (phaseNode) { + const label = phaseNode.getComponent(Label); + if (label) { + label.string = MissionComp.PhaseNameMap[targetPhase] || "未知"; + } + } + } + // 重置状态机的计时器 this.PhaseTime.reset();