refactor(map): 优化英雄列表排序和英雄等级展示逻辑

1. 新增英雄列表按pool_lv升序排序的逻辑
2. 从cardData中获取英雄等级替代直接读取HeroInfo,优化数据读取方式
This commit is contained in:
panw
2026-05-28 09:59:33 +08:00
parent f114fca2ce
commit f7f6c57b56
2 changed files with 6 additions and 3 deletions

View File

@@ -678,9 +678,8 @@ export class CardComp extends CCComp {
}
if(this.card_type===CardType.Hero){
// 英雄卡:显示英雄名 + AP/HP
const hero = HeroInfo[this.card_uuid];
const heroLv = Math.max(1, hero?.lv);
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}`;

View File

@@ -115,7 +115,11 @@ export class HerosListComp extends CCComp {
this.cards_node.removeAllChildren()
for (const uuid of HeroList) {
const sorted = [...HeroList].sort((a, b) => {
return (HeroInfo[a]?.pool_lv ?? 1) - (HeroInfo[b]?.pool_lv ?? 1);
});
for (const uuid of sorted) {
const hero = HeroInfo[uuid]
if (!hero) continue