From f456e93fd88d086ed9e066200df13f482326ebb3 Mon Sep 17 00:00:00 2001 From: walkpan Date: Sat, 3 Jan 2026 22:03:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(hero):=20=E4=BF=AE=E5=A4=8D=E8=8B=B1?= =?UTF-8?q?=E9=9B=84=E8=A7=86=E5=9B=BE=E5=88=9D=E5=A7=8B=E5=8C=96=E6=97=B6?= =?UTF-8?q?=E6=9C=AA=E6=9B=B4=E6=96=B0=E4=BF=A1=E6=81=AF=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在HeroViewComp初始化时调用smc.updateHeroInfo更新英雄信息,确保视图与模型同步 --- assets/script/game/hero/Hero.ts | 1 + assets/script/game/hero/HeroViewComp.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/assets/script/game/hero/Hero.ts b/assets/script/game/hero/Hero.ts index 96779f38..73772e47 100644 --- a/assets/script/game/hero/Hero.ts +++ b/assets/script/game/hero/Hero.ts @@ -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); diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index 85011a22..07f29d60 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -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) }