fix(SingletonModuleComp): 修复进度显示不刷新的问题

将整体替换stage_progress对象改为就地更新字段,确保嵌套属性变更能正确触发视图刷新
This commit is contained in:
pan
2026-09-11 15:09:01 +08:00
parent 04a77ac60c
commit dc67f42a33

View File

@@ -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;
}
/**