fix(hero): 修复英雄视图初始化时未更新信息的问题
在HeroViewComp初始化时调用smc.updateHeroInfo更新英雄信息,确保视图与模型同步
This commit is contained in:
@@ -104,6 +104,7 @@ export class Hero extends ecs.Entity {
|
|||||||
// 初始化 buff/debuff 系统
|
// 初始化 buff/debuff 系统
|
||||||
model.initAttrs();
|
model.initAttrs();
|
||||||
model.Attrs[Attrs.REVIVE_COUNT]=1
|
model.Attrs[Attrs.REVIVE_COUNT]=1
|
||||||
|
|
||||||
this.add(hv);
|
this.add(hv);
|
||||||
oops.message.dispatchEvent(GameEvent.MasterCalled,{uuid:uuid})
|
oops.message.dispatchEvent(GameEvent.MasterCalled,{uuid:uuid})
|
||||||
const move = this.get(HeroMoveComp);
|
const move = this.get(HeroMoveComp);
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
this.top_node = this.node.getChildByName("top");
|
this.top_node = this.node.getChildByName("top");
|
||||||
let hp_y = this.node.getComponent(UITransform).height+10;
|
let hp_y = this.node.getComponent(UITransform).height+10;
|
||||||
this.top_node.setPosition(0, hp_y, 0);
|
this.top_node.setPosition(0, hp_y, 0);
|
||||||
|
smc.updateHeroInfo(this.model)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user