From 1bb275607a14fe78b685206548f19fa2561410b6 Mon Sep 17 00:00:00 2001 From: pan Date: Thu, 24 Sep 2026 15:45:46 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=94=B9=E8=8B=B1?= =?UTF-8?q?=E9=9B=84=E5=9B=BE=E9=89=B4=E5=92=8C=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E7=9A=84=E6=8E=92=E5=BA=8F=E8=A7=84=E5=88=99=E4=B8=BA=E6=8C=89?= =?UTF-8?q?=E8=81=8C=E4=B8=9A=E5=8D=87=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 调整英雄列表排序逻辑,从原有的按品质降序改为按职业升序,保持与养成进度解耦的稳定展示。 --- assets/script/game/map/HeroInfoComp.ts | 10 ++++++---- assets/script/game/map/HerosListComp.ts | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/assets/script/game/map/HeroInfoComp.ts b/assets/script/game/map/HeroInfoComp.ts index b961c86e..923ec7d6 100644 --- a/assets/script/game/map/HeroInfoComp.ts +++ b/assets/script/game/map/HeroInfoComp.ts @@ -247,11 +247,13 @@ export class HeroInfoComp extends CCComp { * @param delta 1 下一个,-1 上一个 */ private switchHero(delta: 1 | -1) { - // 与图鉴页面排序同源:仅按品质降序 → uuid 升序 + // 与图鉴页面排序同源:按职业(HRole)升序 → uuid 升序 const sorted = [...HeroList].sort((a, b) => { - const ra = HeroInfo[a]?.rarity ?? 1; - const rb = HeroInfo[b]?.rarity ?? 1; - if (ra !== rb) return rb - ra; + const heroA = HeroInfo[a]; + const heroB = HeroInfo[b]; + const roleA = heroA?.role ?? 0; + const roleB = heroB?.role ?? 0; + if (roleA !== roleB) return roleA - roleB; return a - b; }); if (sorted.length === 0) return; diff --git a/assets/script/game/map/HerosListComp.ts b/assets/script/game/map/HerosListComp.ts index ca3b81f7..4cfd27dc 100644 --- a/assets/script/game/map/HerosListComp.ts +++ b/assets/script/game/map/HerosListComp.ts @@ -113,11 +113,13 @@ export class HerosListComp extends CCComp { this.cards_node.removeAllChildren() - // 图鉴排序:仅按品质降序 → uuid 升序(与养成进度解耦,保持展示稳定) + // 图鉴排序:按职业(HRole)升序 → uuid 升序(与养成进度解耦,保持展示稳定) const sorted = [...HeroList].sort((a, b) => { - const ra = HeroInfo[a]?.rarity ?? 1; - const rb = HeroInfo[b]?.rarity ?? 1; - if (ra !== rb) return rb - ra; + const heroA = HeroInfo[a]; + const heroB = HeroInfo[b]; + const roleA = heroA?.role ?? 0; + const roleB = heroB?.role ?? 0; + if (roleA !== roleB) return roleA - roleB; return a - b; })