feat(map): add hero skill info display component
新增英雄技能信息节点的绑定与显示逻辑,补充对应的缓存引用和注释
This commit is contained in:
@@ -63,6 +63,7 @@ export class HInfoComp extends CCComp {
|
||||
@property(Node)
|
||||
Name_node=null!
|
||||
|
||||
/** 技能信息节点 */
|
||||
@property(Node)
|
||||
info_node=null!
|
||||
|
||||
@@ -81,6 +82,8 @@ export class HInfoComp extends CCComp {
|
||||
private model: HeroAttrsComp | null = null;
|
||||
/** 英雄名字标签缓存引用 */
|
||||
private nameLabel: Label | null = null;
|
||||
/** 技能信息标签缓存引用 */
|
||||
private infoLabel: Label | null = null;
|
||||
/** AP 标签缓存引用 */
|
||||
private apLabel: Label | null = null;
|
||||
/** AP 加成标签缓存引用 */
|
||||
@@ -183,6 +186,12 @@ export class HInfoComp extends CCComp {
|
||||
this.nameLabel.string = this.model.hero_name ?? "";
|
||||
}
|
||||
|
||||
// ---- 技能信息标签 ----
|
||||
if (this.infoLabel) {
|
||||
const heroData = HeroInfo[heroUuid];
|
||||
this.infoLabel.string = heroData?.info ?? "";
|
||||
}
|
||||
|
||||
// ---- 数值标签 ----
|
||||
if (this.apLabel) {
|
||||
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) {
|
||||
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) {
|
||||
this.apLabel = this.ap_node.getChildByName("val")?.getComponent(Label) || null;
|
||||
this.apPlusLabel = this.ap_node.getChildByName("plus")?.getComponent(Label) || null;
|
||||
|
||||
Reference in New Issue
Block a user