1 Commits

Author SHA1 Message Date
pan
1bb275607a refactor: 修改英雄图鉴和详情页的排序规则为按职业升序
调整英雄列表排序逻辑,从原有的按品质降序改为按职业升序,保持与养成进度解耦的稳定展示。
2026-09-24 15:45:46 +08:00
2 changed files with 12 additions and 8 deletions

View File

@@ -247,11 +247,13 @@ export class HeroInfoComp extends CCComp {
* @param delta 1 下一个,-1 上一个 * @param delta 1 下一个,-1 上一个
*/ */
private switchHero(delta: 1 | -1) { private switchHero(delta: 1 | -1) {
// 与图鉴页面排序同源:仅按品质降序 → uuid 升序 // 与图鉴页面排序同源:按职业(HRole)升序 → uuid 升序
const sorted = [...HeroList].sort((a, b) => { const sorted = [...HeroList].sort((a, b) => {
const ra = HeroInfo[a]?.rarity ?? 1; const heroA = HeroInfo[a];
const rb = HeroInfo[b]?.rarity ?? 1; const heroB = HeroInfo[b];
if (ra !== rb) return rb - ra; const roleA = heroA?.role ?? 0;
const roleB = heroB?.role ?? 0;
if (roleA !== roleB) return roleA - roleB;
return a - b; return a - b;
}); });
if (sorted.length === 0) return; if (sorted.length === 0) return;

View File

@@ -113,11 +113,13 @@ export class HerosListComp extends CCComp {
this.cards_node.removeAllChildren() this.cards_node.removeAllChildren()
// 图鉴排序:仅按品质降序 → uuid 升序(与养成进度解耦,保持展示稳定) // 图鉴排序:按职业(HRole)升序 → uuid 升序(与养成进度解耦,保持展示稳定)
const sorted = [...HeroList].sort((a, b) => { const sorted = [...HeroList].sort((a, b) => {
const ra = HeroInfo[a]?.rarity ?? 1; const heroA = HeroInfo[a];
const rb = HeroInfo[b]?.rarity ?? 1; const heroB = HeroInfo[b];
if (ra !== rb) return rb - ra; const roleA = heroA?.role ?? 0;
const roleB = heroB?.role ?? 0;
if (roleA !== roleB) return roleA - roleB;
return a - b; return a - b;
}) })