fix(hero view): adjust血条顶部节点偏移量

统一配置血条顶部节点的Y轴偏移参数,区分普通英雄和Boss的血条高度,替换硬编码数值
This commit is contained in:
walkpan
2026-05-12 20:58:29 +08:00
parent 91fd86329e
commit 518f15b1c3
2 changed files with 6 additions and 4 deletions

View File

@@ -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

View File

@@ -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){