fix(hero): 修复英雄视图初始化时未更新信息的问题

在HeroViewComp初始化时调用smc.updateHeroInfo更新英雄信息,确保视图与模型同步
This commit is contained in:
walkpan
2026-01-03 22:03:34 +08:00
parent e2ffd739c8
commit f456e93fd8
2 changed files with 2 additions and 0 deletions

View File

@@ -104,6 +104,7 @@ export class Hero extends ecs.Entity {
// 初始化 buff/debuff 系统
model.initAttrs();
model.Attrs[Attrs.REVIVE_COUNT]=1
this.add(hv);
oops.message.dispatchEvent(GameEvent.MasterCalled,{uuid:uuid})
const move = this.get(HeroMoveComp);

View File

@@ -124,6 +124,7 @@ export class HeroViewComp extends CCComp {
this.top_node = this.node.getChildByName("top");
let hp_y = this.node.getComponent(UITransform).height+10;
this.top_node.setPosition(0, hp_y, 0);
smc.updateHeroInfo(this.model)
}