refactor(HInfoComp): 简化卡牌等级显示逻辑

1. 将lv_node从Node改为Label类型,直接通过string属性更新等级文本
2. 移除原有的子节点遍历匹配逻辑,替换为更简洁的文本赋值方式
3. 新增pool_lv_node节点属性用于后续池等级相关逻辑
4. 同步更新了ha2.prefab的预制体结构与meta配置文件
This commit is contained in:
panw
2026-05-25 09:03:34 +08:00
parent 518a9a1ce9
commit 350b107d2a
6 changed files with 4655 additions and 8013 deletions

View File

@@ -66,9 +66,11 @@ export class HInfoComp extends CCComp {
@property(Node)
info_node=null!
@property(Node)
lv_node=null!
@property(Label)
lv_node: Label = null!
@property(Node)
pool_lv_node: Node = null!
@property(Node)
ap_node=null!
@@ -162,12 +164,7 @@ export class HInfoComp extends CCComp {
// ---- 卡牌等级显示 ----
if (this.lv_node) {
const currentLv = this.model.lv ?? 1;
this.lv_node.children.forEach(child => {
if (child.name.startsWith('lv')) {
const nodeLv = parseInt(child.name.substring(2));
child.active = !isNaN(nodeLv) && nodeLv <= currentLv;
}
});
this.lv_node.string = `Lv.${currentLv}`;
}
// ---- 图标动画(仅在 UUID 变化时重新加载) ----