refactor: 修改英雄图鉴和详情页的排序规则为按职业升序

调整英雄列表排序逻辑,从原有的按品质降序改为按职业升序,保持与养成进度解耦的稳定展示。
This commit is contained in:
pan
2026-09-24 15:45:46 +08:00
parent 95bf2a4e17
commit 1bb275607a
2 changed files with 12 additions and 8 deletions

View File

@@ -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;
})