feat(map): add hero skill info display component

新增英雄技能信息节点的绑定与显示逻辑,补充对应的缓存引用和注释
This commit is contained in:
walkpan
2026-05-24 23:38:15 +08:00
parent fd60191324
commit 217c90377c

View File

@@ -63,6 +63,7 @@ export class HInfoComp extends CCComp {
@property(Node) @property(Node)
Name_node=null! Name_node=null!
/** 技能信息节点 */
@property(Node) @property(Node)
info_node=null! info_node=null!
@@ -81,6 +82,8 @@ export class HInfoComp extends CCComp {
private model: HeroAttrsComp | null = null; private model: HeroAttrsComp | null = null;
/** 英雄名字标签缓存引用 */ /** 英雄名字标签缓存引用 */
private nameLabel: Label | null = null; private nameLabel: Label | null = null;
/** 技能信息标签缓存引用 */
private infoLabel: Label | null = null;
/** AP 标签缓存引用 */ /** AP 标签缓存引用 */
private apLabel: Label | null = null; private apLabel: Label | null = null;
/** AP 加成标签缓存引用 */ /** AP 加成标签缓存引用 */
@@ -183,6 +186,12 @@ export class HInfoComp extends CCComp {
this.nameLabel.string = this.model.hero_name ?? ""; this.nameLabel.string = this.model.hero_name ?? "";
} }
// ---- 技能信息标签 ----
if (this.infoLabel) {
const heroData = HeroInfo[heroUuid];
this.infoLabel.string = heroData?.info ?? "";
}
// ---- 数值标签 ---- // ---- 数值标签 ----
if (this.apLabel) { if (this.apLabel) {
const currentAp = Math.max(0, Math.floor(this.model.ap ?? 0)); const currentAp = Math.max(0, Math.floor(this.model.ap ?? 0));
@@ -229,6 +238,9 @@ export class HInfoComp extends CCComp {
if (!this.nameLabel && this.Name_node) { if (!this.nameLabel && this.Name_node) {
this.nameLabel = this.Name_node.getComponent(Label) || this.Name_node.getComponentInChildren(Label); this.nameLabel = this.Name_node.getComponent(Label) || this.Name_node.getComponentInChildren(Label);
} }
if (!this.infoLabel && this.info_node) {
this.infoLabel = this.info_node.getComponent(Label) || this.info_node.getComponentInChildren(Label);
}
if (!this.apLabel && this.ap_node) { if (!this.apLabel && this.ap_node) {
this.apLabel = this.ap_node.getChildByName("val")?.getComponent(Label) || null; this.apLabel = this.ap_node.getChildByName("val")?.getComponent(Label) || null;
this.apPlusLabel = this.ap_node.getChildByName("plus")?.getComponent(Label) || null; this.apPlusLabel = this.ap_node.getChildByName("plus")?.getComponent(Label) || null;