refactor(HerosListComp): 重命名职业展示相关变量与方法

1. 将 type_node 重命名为 role_node,updateTypeDisplay 重命名为 updateRoleDisplay
2. 更新注释说明子节点按 HRole 枚举值命名
3. 同步修改调用处的变量名和方法名
This commit is contained in:
panFD
2026-08-30 21:45:55 +08:00
parent 69aa1863b7
commit 5edaae639d
11 changed files with 10072 additions and 5526 deletions

View File

@@ -73,8 +73,9 @@ export class HerosListComp extends CCComp {
@property(Label)
lv_label = null!
/** 职业展示节点(子节点按 HRole 枚举值命名 0~5:0=坦克 1=战士 2=刺客 3=射手 4=法师 5=辅助) */
@property(Node)
type_node = null!
role_node = null!
/** 升级按钮节点(smalltip 气泡已作为其子节点挂在下面) */
@property(Node)
@@ -415,7 +416,7 @@ export class HerosListComp extends CCComp {
this.updatePoolLvBg(hero.card_lv ?? 1)
this.updateLvDisplay(uuid)
this.updateTypeDisplay(hero)
this.updateRoleDisplay(hero)
this.updateHeroAnimation(uuid)
this.updateGrowthPanel(uuid)
this.updateSkillIcons(hero)
@@ -446,12 +447,12 @@ export class HerosListComp extends CCComp {
this.lv_label.string = `lv.${outerLv}`
}
private updateTypeDisplay(hero: typeof HeroInfo[number]) {
if (!this.type_node) return
this.type_node.active = true
const typeStr = `${hero.type ?? 0}`
this.type_node.children.forEach(child => {
child.active = (child.name === typeStr)
private updateRoleDisplay(hero: typeof HeroInfo[number]) {
if (!this.role_node) return
this.role_node.active = true
const roleStr = `${hero.role ?? 0}`
this.role_node.children.forEach(child => {
child.active = (child.name === roleStr)
})
}