From 518f15b1c3719d3cd25d30179aec7d73068212d0 Mon Sep 17 00:00:00 2001 From: walkpan Date: Tue, 12 May 2026 20:58:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(hero=20view):=20adjust=E8=A1=80=E6=9D=A1?= =?UTF-8?q?=E9=A1=B6=E9=83=A8=E8=8A=82=E7=82=B9=E5=81=8F=E7=A7=BB=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 统一配置血条顶部节点的Y轴偏移参数,区分普通英雄和Boss的血条高度,替换硬编码数值 --- assets/resources/game/skill/buff/shielded.prefab | 4 ++-- assets/script/game/hero/HeroViewComp.ts | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/assets/resources/game/skill/buff/shielded.prefab b/assets/resources/game/skill/buff/shielded.prefab index 4ab0efb4..6ddc4f2e 100644 --- a/assets/resources/game/skill/buff/shielded.prefab +++ b/assets/resources/game/skill/buff/shielded.prefab @@ -75,7 +75,7 @@ "__id__": 1 }, "_children": [], - "_active": false, + "_active": true, "_components": [ { "__id__": 3 @@ -214,7 +214,7 @@ "__id__": 1 }, "_children": [], - "_active": true, + "_active": false, "_components": [ { "__id__": 9 diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index 066992e1..6102b2f2 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -35,6 +35,8 @@ export class HeroViewComp extends CCComp { realDeadTime:number=0.1 deadCD:number=0 monDeadTime:number=0.1 + hp_height:number=70 + boss_hp_height:number=120 // 血条显示相关 lastBarUpdateTime:number = 0; // 最后一次血条/蓝条/护盾更新时间 // ==================== UI 节点引用 ==================== @@ -114,8 +116,8 @@ export class HeroViewComp extends CCComp { private initUINodes() { this.top_node = this.node.getChildByName("top"); this.topOpacity = this.top_node.getComponent(UIOpacity) || this.top_node.addComponent(UIOpacity); - this.top_node.setPosition(0, 80, 0); - if(this.model.is_boss) this.top_node.setPosition(0, 105, 0); + this.top_node.setPosition(0, this.hp_height, 0); + if(this.model.is_boss) this.top_node.setPosition(0, this.boss_hp_height, 0); this.topBasePos = this.top_node.position.clone(); const hpNode = this.top_node.getChildByName("hp"); if(this.model.fac==FacSet.HERO){