fix(SingletonModuleComp): 修复进度显示不刷新的问题
将整体替换stage_progress对象改为就地更新字段,确保嵌套属性变更能正确触发视图刷新
This commit is contained in:
@@ -358,11 +358,13 @@ export class SingletonModuleComp extends ecs.Comp {
|
|||||||
*/
|
*/
|
||||||
public syncStageProgressToView(): void {
|
public syncStageProgressToView(): void {
|
||||||
const p = this.data.stage_progress;
|
const p = this.data.stage_progress;
|
||||||
this.vmdata.stage_progress = {
|
// 就地更新字段而非整体替换对象:oops VM(JsonOb)只通知被赋值属性的精确路径,
|
||||||
chapter: p?.chapter ?? 1,
|
// 整体替换仅派发 VC:data.stage_progress,不会触发 HUD 绑定的
|
||||||
stage: p?.stage ?? 1,
|
// data.stage_progress.section 等嵌套末端路径刷新,导致进度显示停留在老节
|
||||||
section: p?.section ?? 1,
|
const view = this.vmdata.stage_progress;
|
||||||
};
|
view.chapter = p?.chapter ?? 1;
|
||||||
|
view.stage = p?.stage ?? 1;
|
||||||
|
view.section = p?.section ?? 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user