style(hero): 调整英雄血条UI参数与显示逻辑

1. 调整hp_height和boss_hp_height参数,优化血条显示高度
2. 修复top_node血条方向随对象池复用导致反转的问题
3. 更新血条预制体的尺寸、样式与贴图配置
This commit is contained in:
pan
2026-07-21 16:38:43 +08:00
parent 5d55f3bdb1
commit 4f95accfbf
2 changed files with 25 additions and 21 deletions

View File

@@ -859,7 +859,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 40,
"height": 7
"height": 11
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -1037,7 +1037,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 140,
"height": 30
"height": 43.333333333333336
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -1162,7 +1162,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 40,
"height": 7
"height": 11
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -1912,8 +1912,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 52,
"height": 75
"width": 80,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -1943,18 +1943,18 @@
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"r": 253,
"g": 213,
"b": 0,
"a": 255
},
"_spriteFrame": {
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@5c7a0",
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@79d6f",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_sizeMode": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
@@ -1964,7 +1964,10 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_atlas": {
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73",
"__expectedType__": "cc.SpriteAtlas"
},
"_id": ""
},
{
@@ -2007,8 +2010,8 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"x": -0.103,
"y": -0.601,
"z": 0
},
"_lrot": {
@@ -2048,7 +2051,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 4.38,
"width": 7.29,
"height": 40
},
"_anchorPoint": {
@@ -2087,8 +2090,8 @@
"_string": "1",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 15,
"_fontSize": 15,
"_actualFontSize": 25,
"_fontSize": 25,
"_fontFamily": "Arial",
"_lineHeight": 40,
"_overflow": 0,
@@ -2100,7 +2103,7 @@
"_isSystemFontUsed": false,
"_spacingX": 0,
"_isItalic": false,
"_isBold": false,
"_isBold": true,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 0,
@@ -2161,7 +2164,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 10,
"height": 10
"height": 13
},
"_anchorPoint": {
"__type__": "cc.Vec2",

View File

@@ -38,8 +38,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 = 140
hp_height: number = 90
boss_hp_height: number = 160
// 血条显示相关
lastBarUpdateTime: number = 0; // 最后一次血条/蓝条/护盾更新时间
// ==================== UI 节点引用 ====================
@@ -117,7 +117,8 @@ export class HeroViewComp extends CCComp {
/** 方向 */
this.node.setScale(this.scale * Math.abs(this.node.scale.x), 1 * this.node.scale.y); // 确保 scale.x 为正后再乘方向
this.top_node.setScale(this.scale * this.top_node.scale.x, 1 * this.top_node.scale.y);
// top_node 取 abs 避免对象池复用时 scale 累乘导致血条方向反转
this.top_node.setScale(this.scale * Math.abs(this.top_node.scale.x), 1 * this.top_node.scale.y);
/* 显示角色血*/
this.top_node.getChildByName("hp").active = true;
this.top_node.getChildByName("cd").active = false;