fix(ui): 修复卡片名称等级显示格式错误

- 英雄卡等级现在使用星号后缀表示(例如 "★" 表示二级)
- 特殊卡等级现在使用加号后缀表示(例如 "+" 表示二级)
- 统一处理等级下限为1,避免显示异常
This commit is contained in:
panw
2026-04-03 10:47:10 +08:00
parent 6e0bceff7c
commit 340060c2d2

View File

@@ -405,7 +405,8 @@ export class CardComp extends CCComp {
if(this.card_type===CardType.Hero){
const hero = HeroInfo[this.card_uuid];
const heroLv = Math.max(1, Math.floor(this.cardData.hero_lv ?? hero?.lv ?? 1));
this.setLabel(this.name_node, `${hero?.name || ""}Lv.${heroLv}`);
const suffix = heroLv >= 2 ? "".repeat(heroLv - 1) : "";
this.setLabel(this.name_node, `${suffix}${hero?.name || ""}${suffix}`);
this.info_node.active = true;
this.oinfo_node.active = false;
this.info_node.getChildByName("ap").getChildByName("val").getComponent(Label).string = `${(hero?.ap ?? 0) * heroLv}`;
@@ -414,7 +415,9 @@ export class CardComp extends CCComp {
const specialCard = this.card_type === CardType.SpecialUpgrade
? SpecialUpgradeCardList[this.card_uuid]
: SpecialRefreshCardList[this.card_uuid];
this.setLabel(this.name_node, `${specialCard?.name || ""}Lv.${this.cardData.pool_lv}`);
const poolLv = Math.max(1, Math.floor(this.cardData.pool_lv ?? 1));
const spSuffix = poolLv >= 2 ? "+".repeat(poolLv - 1) : "";
this.setLabel(this.name_node, `${specialCard?.name || ""}${spSuffix}`);
this.info_node.active = false;
this.oinfo_node.active = true;
this.oinfo_node.getChildByName("info").getComponent(Label).string = `${specialCard?.info || ""}`;