feat(card): 实现英雄卡升级标识与交互优化

1. 新增升级专用动画资源与up_icon_node节点
2. 重构等级显示逻辑,升级卡显示前后等级
3. 调整召唤按钮文案为"升级"或"招募"适配场景
4. 移除无用的getLvColor导入与旧的层级控制逻辑
This commit is contained in:
pan
2026-07-21 11:02:27 +08:00
parent 9a0dbaf41d
commit c1d461516b
4 changed files with 748 additions and 26 deletions

View File

@@ -35,7 +35,6 @@ import { UIID } from "../common/config/GameUIConfig";
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
import { FieldSkillType } from "../common/config/SkillSet";
import { FieldSkillHelper } from "../hero/FieldSkillHelper";
import { getLvColor } from "../common/config/GameSet";
import { MissionEconomy } from "./MissionEconomy";
@@ -62,7 +61,7 @@ export class CardComp extends CCComp {
/** 解锁态图标节点(显示时表示本槽位未锁定,可点击上锁) */
@property(Node)
unLock: Node = null!
@property(Node)
call_btn: Node = null!
/** 英雄卡信息面板(显示 AP / HP 废弃,改用直接绑定 */
@@ -88,10 +87,12 @@ export class CardComp extends CCComp {
info_node = null!
@property(Label)
lvl_node: Label = null! //英雄本身的等级
@property(Node)
up_icon_node: Node = null! //升级 icon
@property(Node)
ap_node = null!
@property(Node)
@@ -683,6 +684,10 @@ export class CardComp extends CCComp {
child.active = (child.name === kindName);
});
}
// 升级标识独立由 up_icon_node 控制,不再挂在 Ckind_node 下
if (this.up_icon_node) {
this.up_icon_node.active = isUpgradeCard;
}
const hbNodeUI = this.node.getChildByName("HB");
if (hbNodeUI) hbNodeUI.active = false;
@@ -747,8 +752,12 @@ export class CardComp extends CCComp {
const heroLv = Math.max(1, this.cardData.hero_lv ?? hero?.lv ?? 1);
this.setLabel(this.name_node, `${hero?.name || ""}`);
if (this.lvl_node) {
this.lvl_node.string = `Lv.${heroLv}`;
this.lvl_node.color = getLvColor(heroLv);
// 升级卡:显示「当前→升级后」;普通英雄卡:显示当前等级。统一使用默认颜色
if (isUpgradeCard && heroLv > 1) {
this.lvl_node.string = `Lv.${heroLv - 1} Lv.${heroLv}`;
} else {
this.lvl_node.string = `Lv.${heroLv}`;
}
this.lvl_node.node.active = true;
}
this.ap_node.getChildByName("val").getComponent(Label).string = `${(hero?.ap ?? 0) * heroLv}`;
@@ -783,6 +792,11 @@ export class CardComp extends CCComp {
}
}
// ---- 召唤按钮文案:英雄卡=招募,升级卡=升级 ----
if (this.call_btn) {
this.setLabel(this.call_btn, isUpgradeCard ? "升级" : "招募");
}
// ---- 图标 ----
const iconNode = this.icon_node as Node;
if (renderType === CardType.Hero) {
@@ -914,6 +928,7 @@ export class CardComp extends CCComp {
if (this.ap_node) this.ap_node.active = false;
if (this.hp_node) this.hp_node.active = false;
if (this.lvl_node) this.lvl_node.node.active = false;
if (this.up_icon_node) this.up_icon_node.active = false;
if (this.Ckind_node) {
this.Ckind_node.children.forEach(child => {
child.active = false;