fix(card): 修复卡牌信息显示逻辑并调整默认状态
1. 将卡牌预制件默认激活状态改为false 2. 移除冗余的info_node和lvl_node配置,新增lvl_node为空引用 3. 重构卡牌信息文本的获取逻辑,增加多源优先级判断 4. 优化信息节点的Label组件查找方式,适配更灵活的节点结构
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user