From dc67f42a331915c797de4a12aea00990773ea88d Mon Sep 17 00:00:00 2001 From: pan Date: Fri, 11 Sep 2026 15:09:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(SingletonModuleComp):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=BF=9B=E5=BA=A6=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将整体替换stage_progress对象改为就地更新字段,确保嵌套属性变更能正确触发视图刷新 --- assets/script/game/common/SingletonModuleComp.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/assets/script/game/common/SingletonModuleComp.ts b/assets/script/game/common/SingletonModuleComp.ts index 5252448d..6add3c8f 100644 --- a/assets/script/game/common/SingletonModuleComp.ts +++ b/assets/script/game/common/SingletonModuleComp.ts @@ -358,11 +358,13 @@ export class SingletonModuleComp extends ecs.Comp { */ public syncStageProgressToView(): void { const p = this.data.stage_progress; - this.vmdata.stage_progress = { - chapter: p?.chapter ?? 1, - stage: p?.stage ?? 1, - section: p?.section ?? 1, - }; + // 就地更新字段而非整体替换对象:oops VM(JsonOb)只通知被赋值属性的精确路径, + // 整体替换仅派发 VC:data.stage_progress,不会触发 HUD 绑定的 + // data.stage_progress.section 等嵌套末端路径刷新,导致进度显示停留在老节 + const view = this.vmdata.stage_progress; + view.chapter = p?.chapter ?? 1; + view.stage = p?.stage ?? 1; + view.section = p?.section ?? 1; } /**