refactor: 修改英雄图鉴和详情页的排序规则为按职业升序
调整英雄列表排序逻辑,从原有的按品质降序改为按职业升序,保持与养成进度解耦的稳定展示。
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user