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

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