fix(map): 调整英雄站位坐标并新增CD标签显示

1. 修正MissionHeroComp中的6个英雄占位坐标
2. 在HInfoComp中新增CD标签缓存引用并实现技能CD显示逻辑
3. 更新hnode.prefab的UI布局尺寸与元素位置适配新需求
This commit is contained in:
walkpan
2026-05-25 23:02:47 +08:00
parent 988affe2ac
commit 083cd9f195
3 changed files with 40 additions and 18 deletions

View File

@@ -8369,7 +8369,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 22.662,
"x": 30.129,
"y": 0,
"z": 0
},
@@ -8666,7 +8666,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -120,
"x": -121,
"y": 0,
"z": 0
},
@@ -8719,7 +8719,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 75,
"x": 82.5,
"y": 0,
"z": 0
},
@@ -8760,7 +8760,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 300,
"width": 330,
"height": 70
},
"_anchorPoint": {
@@ -8894,7 +8894,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 12.329,
"x": 16.733,
"y": 0,
"z": 0
},
@@ -9030,7 +9030,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 22.662,
"x": 27.066,
"y": 0,
"z": 0
},
@@ -9189,7 +9189,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 67.099,
"x": 71.503,
"y": 0,
"z": 0
},
@@ -9339,7 +9339,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 150,
"width": 165,
"height": 30
},
"_anchorPoint": {
@@ -9486,7 +9486,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 40,
"x": 53,
"y": 0,
"z": 0
},
@@ -9539,7 +9539,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 75,
"x": 82.5,
"y": 0,
"z": 0
},
@@ -9580,7 +9580,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 300,
"width": 330,
"height": 70
},
"_anchorPoint": {
@@ -9714,7 +9714,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 12.329,
"x": 16.733,
"y": 0,
"z": 0
},
@@ -9850,7 +9850,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 22.662,
"x": 27.066,
"y": 0,
"z": 0
},
@@ -10009,7 +10009,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 71.539,
"x": 75.943,
"y": 0,
"z": 0
},
@@ -10159,7 +10159,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 150,
"width": 165,
"height": 30
},
"_anchorPoint": {
@@ -10355,7 +10355,7 @@
"_paddingRight": 0,
"_paddingTop": 0,
"_paddingBottom": 0,
"_spacingX": 10,
"_spacingX": 9,
"_spacingY": 0,
"_verticalDirection": 1,
"_horizontalDirection": 0,

View File

@@ -104,6 +104,8 @@ export class HInfoComp extends CCComp {
private hpLabel: Label | null = null;
/** HP 加成标签缓存引用 */
private hpPlusLabel: Label | null = null;
/** CD 标签缓存引用 */
private cdLabel: Label | null = null;
/** 图标视觉令牌(异步加载竞态保护) */
private iconVisualToken: number = 0;
/** 当前显示的英雄 UUID避免相同 UUID 重复加载动画) */
@@ -184,6 +186,12 @@ export class HInfoComp extends CCComp {
if (this.infoLabel) {
this.infoLabel.string = buildSkillDesc(hero);
}
if (this.cdLabel) {
const skillKeys = hero.skills ? Object.keys(hero.skills) : [];
const displaySkill = skillKeys.length > 1 ? hero.skills[skillKeys[1]] : (skillKeys.length > 0 ? hero.skills[skillKeys[0]] : null);
this.cdLabel.string = displaySkill?.cd ? `${displaySkill.cd.toFixed(1)}s` : "0s";
}
}
/** 是否正在关闭中,防止重复调用 remove */
@@ -317,6 +325,17 @@ export class HInfoComp extends CCComp {
}
}
}
if (this.cdLabel) {
const skillIds = this.model.getSkillIds();
const displaySkillId = skillIds[1] ?? skillIds[0] ?? 0;
if (displaySkillId) {
const effectiveCd = this.model.getEffectiveSkillCd(displaySkillId);
this.cdLabel.string = effectiveCd > 0 ? `${effectiveCd.toFixed(1)}s` : "0s";
} else {
this.cdLabel.string = "0s";
}
}
}
/**
@@ -354,6 +373,9 @@ export class HInfoComp extends CCComp {
this.hpLabel = this.hp_node.getChildByName("val")?.getComponent(Label) || null;
this.hpPlusLabel = this.hp_node.getChildByName("plus")?.getComponent(Label) || null;
}
if (!this.cdLabel && this.cd_node) {
this.cdLabel = this.cd_node.getChildByName("val")?.getComponent(Label) || null;
}
}
/**

View File

@@ -55,10 +55,10 @@ export class MissionHeroComp extends CCComp {
/** 硬编码的6个英雄占位点 */
public static readonly HERO_POSITIONS: Vec3[] = [
v3(-185, BoxSet.GAME_LINE + 90, 0), // index 0 (node_index 1): Top Front
v3(-200, BoxSet.GAME_LINE + 90, 0), // index 0 (node_index 1): Top Front
v3(-170, BoxSet.GAME_LINE, 0), // index 1 (node_index 2): Mid Front
v3(-200, BoxSet.GAME_LINE - 90, 0), // index 2 (node_index 3): Bot Front
v3(-285, BoxSet.GAME_LINE + 90, 0), // index 3 (node_index 4): Top Back
v3(-300, BoxSet.GAME_LINE + 90, 0), // index 3 (node_index 4): Top Back
v3(-270, BoxSet.GAME_LINE, 0), // index 4 (node_index 5): Mid Back
v3(-300, BoxSet.GAME_LINE - 90, 0), // index 5 (node_index 6): Bot Back
];