From f7f6c57b56c8ad9749f6613b7d48415eacc72cf5 Mon Sep 17 00:00:00 2001 From: panw Date: Thu, 28 May 2026 09:59:33 +0800 Subject: [PATCH] =?UTF-8?q?refactor(map):=20=E4=BC=98=E5=8C=96=E8=8B=B1?= =?UTF-8?q?=E9=9B=84=E5=88=97=E8=A1=A8=E6=8E=92=E5=BA=8F=E5=92=8C=E8=8B=B1?= =?UTF-8?q?=E9=9B=84=E7=AD=89=E7=BA=A7=E5=B1=95=E7=A4=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 新增英雄列表按pool_lv升序排序的逻辑 2. 从cardData中获取英雄等级替代直接读取HeroInfo,优化数据读取方式 --- assets/script/game/map/CardComp.ts | 3 +-- assets/script/game/map/HerosListComp.ts | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/assets/script/game/map/CardComp.ts b/assets/script/game/map/CardComp.ts index 20792c97..6c26b3d6 100644 --- a/assets/script/game/map/CardComp.ts +++ b/assets/script/game/map/CardComp.ts @@ -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}`; diff --git a/assets/script/game/map/HerosListComp.ts b/assets/script/game/map/HerosListComp.ts index f40833d9..05da6eb0 100644 --- a/assets/script/game/map/HerosListComp.ts +++ b/assets/script/game/map/HerosListComp.ts @@ -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