refactor(map): 移除冗余的卡池等级节点并重构显示逻辑

1.  删除HInfoComp和CardLiteComp中不再使用的pool_lv相关节点字段
2.  将卡池等级背景色显示逻辑迁移到HerosListComp中统一处理
3.  简化CardLiteComp的节点初始化隐藏逻辑
This commit is contained in:
panw
2026-05-28 09:08:11 +08:00
parent 76a37049c7
commit 861ed26977
4 changed files with 1339 additions and 1700 deletions

View File

@@ -53,8 +53,6 @@ export class CardLiteComp extends CCComp {
Ckind_node: Node = null!
@property(Node)
BG_node: Node = null!
@property(Node)
pool_lv_node: Node = null!
@property(Label)
lvl_node: Label = null!
@@ -211,10 +209,7 @@ export class CardLiteComp extends CCComp {
hasIcon: !!this.icon_node,
hasCost: !!this.cost_node,
hasBG: !!this.BG_node,
hasPoolLv: !!this.pool_lv_node,
hasLvl: !!this.lvl_node,
bgChildren: this.BG_node?.children.map(c => c.name) || [],
poolChildren: this.pool_lv_node?.children.map(c => c.name) || [],
nodeActive: this.node.active,
nodeScale: this.node.scale.toString(),
nodePos: this.node.position.toString(),
@@ -242,13 +237,6 @@ export class CardLiteComp extends CCComp {
});
}
const cardLvStr = `lv${this.cardData.pool_lv}`;
if (this.pool_lv_node) {
this.pool_lv_node.children.forEach(child => {
child.active = (child.name === cardLvStr);
});
}
if (this.card_type === CardType.Hero) {
const hero = HeroInfo[this.card_uuid];
const heroLv = Math.max(1, this.cardData.hero_lv ?? hero?.lv ?? 1);
@@ -317,10 +305,12 @@ export class CardLiteComp extends CCComp {
}
if (this.lvl_node) this.lvl_node.node.active = false;
if (this.BG_node) {
this.BG_node.children.forEach(child => child.active = false);
}
if (this.pool_lv_node) {
this.pool_lv_node.children.forEach(child => child.active = false);
this.BG_node.children.forEach(child => {
child.active = false;
child.children.forEach(colorChild => {
colorChild.active = false;
});
});
}
if (this.icon_node) {
(this.icon_node as Node).setScale(new Vec3(1, 1, 1));