Skip to content

Commit 90e4702

Browse files
committed
chore: lv6 以下的整数合并, lv16 及以上的算其他
1 parent 906fd53 commit 90e4702

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

AquaMai.Mods/GameSystem/SongConstantSort.cs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ public static class CategoryTabPatches
207207

208208
private const string StorageKey = "SongConstantSort_Active";
209209
private static readonly IPersistentStorage Storage = new PlayerPrefsStorage();
210+
private const int OtherCategoryKey = 160;
210211

211212
[HarmonyPatch(typeof(Process.MusicSelectProcess), "OnStart")]
212213
[HarmonyPostfix]
@@ -353,7 +354,7 @@ private static void IsForceMusicBack_Set(Process.MusicSelectProcess __instance,
353354
if (seen.Contains(uniqueKey)) continue;
354355
seen.Add(uniqueKey);
355356

356-
int constKey = notes.level * 10 + notes.levelDecimal;
357+
int constKey = GetConstCategoryKey(notes.level, notes.levelDecimal);
357358

358359
var detail = new Process.MusicSelectProcess.MusicSelectDetailData
359360
{
@@ -369,8 +370,7 @@ private static void IsForceMusicBack_Set(Process.MusicSelectProcess __instance,
369370
int dummy = -1;
370371
if (!grouped.ContainsKey(constKey))
371372
{
372-
nameMap[constKey] = string.Format("Lv.{0}.{1}",
373-
notes.level, notes.levelDecimal);
373+
nameMap[constKey] = GetConstCategoryName(constKey);
374374
grouped[constKey] = new List<Process.MusicSelectProcess.CombineMusicSelectData>();
375375
}
376376
grouped[constKey].Add(
@@ -406,6 +406,20 @@ private static void IsForceMusicBack_Set(Process.MusicSelectProcess __instance,
406406
return result;
407407
}
408408

409+
private static int GetConstCategoryKey(int level, int levelDecimal)
410+
{
411+
if (level >= 16) return OtherCategoryKey;
412+
if (level < 6) return level * 10;
413+
return level * 10 + levelDecimal;
414+
}
415+
416+
private static string GetConstCategoryName(int constKey)
417+
{
418+
if (constKey == OtherCategoryKey) return "其他";
419+
if (constKey < 60) return string.Format("Lv.{0}", constKey / 10);
420+
return string.Format("Lv.{0}.{1}", constKey / 10, constKey % 10);
421+
}
422+
409423
// 统一校验所有反射成员, 失败时记录明确错误
410424
private static void ValidateReflection()
411425
{

0 commit comments

Comments
 (0)