fix(card): 修复卡牌信息显示逻辑并调整默认状态

1.  将卡牌预制件默认激活状态改为false
2.  移除冗余的info_node和lvl_node配置,新增lvl_node为空引用
3.  重构卡牌信息文本的获取逻辑,增加多源优先级判断
4.  优化信息节点的Label组件查找方式,适配更灵活的节点结构
This commit is contained in:
panFD
2026-06-19 18:05:54 +08:00
parent 17452167c3
commit 25346c44a2
3 changed files with 1507 additions and 621 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -5393,7 +5393,7 @@
"__id__": 296
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 302
@@ -6121,11 +6121,9 @@
"__id__": 10
},
"info_node": {
"__id__": 295
},
"lvl_node": {
"__id__": 254
"__id__": 296
},
"lvl_node": null,
"ap_node": {
"__id__": 195
},

View File

@@ -258,7 +258,19 @@ export class SCardComp extends CCComp {
const spSuffix = card_lv >= 2 ? "★".repeat(card_lv - 1) : "";
this.setLabel(this.name_node, `${spSuffix}${skillCard?.name || skill?.name || ""}${spSuffix}`);
if (this.info_node) this.info_node.active = true;
if (this.info_node) {
this.info_node.active = true;
// 描述优先级:卡牌显式配置 > 关联技能 > 驻场技能 > 卡牌数据兜底
let desc = skillCard?.info || skill?.info || this.cardData?.info || "";
if (!desc && this.cardData.field && this.cardData.field.length > 0) {
desc = FieldSkillSet[this.cardData.field[0]]?.info || "";
}
// 与 HlistComp 保持一致:优先查找名为 "info" 的子节点上的 Label
const infoLabel = this.info_node.getChildByName("info")?.getComponent(Label)
|| this.info_node.getComponent(Label)
|| this.info_node.getComponentInChildren(Label);
if (infoLabel) infoLabel.string = desc;
}
if (this.cost_node) {
this.cost_node.active = true;