style(hero): 调整英雄血条UI参数与显示逻辑
1. 调整hp_height和boss_hp_height参数,优化血条显示高度 2. 修复top_node血条方向随对象池复用导致反转的问题 3. 更新血条预制体的尺寸、样式与贴图配置
This commit is contained in:
@@ -859,7 +859,7 @@
|
|||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 40,
|
"width": 40,
|
||||||
"height": 7
|
"height": 11
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
@@ -1037,7 +1037,7 @@
|
|||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 140,
|
"width": 140,
|
||||||
"height": 30
|
"height": 43.333333333333336
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
@@ -1162,7 +1162,7 @@
|
|||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 40,
|
"width": 40,
|
||||||
"height": 7
|
"height": 11
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
@@ -1912,8 +1912,8 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 52,
|
"width": 80,
|
||||||
"height": 75
|
"height": 100
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
@@ -1943,18 +1943,18 @@
|
|||||||
"_dstBlendFactor": 4,
|
"_dstBlendFactor": 4,
|
||||||
"_color": {
|
"_color": {
|
||||||
"__type__": "cc.Color",
|
"__type__": "cc.Color",
|
||||||
"r": 255,
|
"r": 253,
|
||||||
"g": 255,
|
"g": 213,
|
||||||
"b": 255,
|
"b": 0,
|
||||||
"a": 255
|
"a": 255
|
||||||
},
|
},
|
||||||
"_spriteFrame": {
|
"_spriteFrame": {
|
||||||
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@5c7a0",
|
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@79d6f",
|
||||||
"__expectedType__": "cc.SpriteFrame"
|
"__expectedType__": "cc.SpriteFrame"
|
||||||
},
|
},
|
||||||
"_type": 0,
|
"_type": 0,
|
||||||
"_fillType": 0,
|
"_fillType": 0,
|
||||||
"_sizeMode": 1,
|
"_sizeMode": 0,
|
||||||
"_fillCenter": {
|
"_fillCenter": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
"x": 0,
|
"x": 0,
|
||||||
@@ -1964,7 +1964,10 @@
|
|||||||
"_fillRange": 0,
|
"_fillRange": 0,
|
||||||
"_isTrimmedMode": true,
|
"_isTrimmedMode": true,
|
||||||
"_useGrayscale": false,
|
"_useGrayscale": false,
|
||||||
"_atlas": null,
|
"_atlas": {
|
||||||
|
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73",
|
||||||
|
"__expectedType__": "cc.SpriteAtlas"
|
||||||
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2007,8 +2010,8 @@
|
|||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 0,
|
"x": -0.103,
|
||||||
"y": 0,
|
"y": -0.601,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
"_lrot": {
|
"_lrot": {
|
||||||
@@ -2048,7 +2051,7 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 4.38,
|
"width": 7.29,
|
||||||
"height": 40
|
"height": 40
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
@@ -2087,8 +2090,8 @@
|
|||||||
"_string": "1",
|
"_string": "1",
|
||||||
"_horizontalAlign": 1,
|
"_horizontalAlign": 1,
|
||||||
"_verticalAlign": 1,
|
"_verticalAlign": 1,
|
||||||
"_actualFontSize": 15,
|
"_actualFontSize": 25,
|
||||||
"_fontSize": 15,
|
"_fontSize": 25,
|
||||||
"_fontFamily": "Arial",
|
"_fontFamily": "Arial",
|
||||||
"_lineHeight": 40,
|
"_lineHeight": 40,
|
||||||
"_overflow": 0,
|
"_overflow": 0,
|
||||||
@@ -2100,7 +2103,7 @@
|
|||||||
"_isSystemFontUsed": false,
|
"_isSystemFontUsed": false,
|
||||||
"_spacingX": 0,
|
"_spacingX": 0,
|
||||||
"_isItalic": false,
|
"_isItalic": false,
|
||||||
"_isBold": false,
|
"_isBold": true,
|
||||||
"_isUnderline": false,
|
"_isUnderline": false,
|
||||||
"_underlineHeight": 2,
|
"_underlineHeight": 2,
|
||||||
"_cacheMode": 0,
|
"_cacheMode": 0,
|
||||||
@@ -2161,7 +2164,7 @@
|
|||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 10,
|
"width": 10,
|
||||||
"height": 10
|
"height": 13
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ export class HeroViewComp extends CCComp {
|
|||||||
realDeadTime: number = 0.1
|
realDeadTime: number = 0.1
|
||||||
deadCD: number = 0
|
deadCD: number = 0
|
||||||
monDeadTime: number = 0.1
|
monDeadTime: number = 0.1
|
||||||
hp_height: number = 70
|
hp_height: number = 90
|
||||||
boss_hp_height: number = 140
|
boss_hp_height: number = 160
|
||||||
// 血条显示相关
|
// 血条显示相关
|
||||||
lastBarUpdateTime: number = 0; // 最后一次血条/蓝条/护盾更新时间
|
lastBarUpdateTime: number = 0; // 最后一次血条/蓝条/护盾更新时间
|
||||||
// ==================== UI 节点引用 ====================
|
// ==================== 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.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("hp").active = true;
|
||||||
this.top_node.getChildByName("cd").active = false;
|
this.top_node.getChildByName("cd").active = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user