Skip to content

Commit a8dcc72

Browse files
committed
fix: 适配于1.65以下版本
AddSort中所引用的变量,在小于1.65的版本中为`_categorySortSetting`,没有`_before`前缀。
1 parent 02f0311 commit a8dcc72

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

AquaMai.Mods/GameSystem/SongConstantSort.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,18 +164,18 @@ public static bool GetEnumValue(DB.SortTabID self, ref int __result)
164164
[HarmonyPatch]
165165
public static class NavigationPatches
166166
{
167-
private static readonly FieldInfo _beforeSortField =
168-
typeof(Process.MusicSelectProcess).GetField("_beforeCategorySortSetting",
167+
private static readonly FieldInfo _sortField =
168+
typeof(Process.MusicSelectProcess).GetField(GameInfo.GameVersion >= 26500 ? "_beforeCategorySortSetting" : "_categorySortSetting",
169169
BindingFlags.NonPublic | BindingFlags.Instance);
170170

171171
[HarmonyPatch(typeof(Process.MusicSelectProcess), "AddSort")]
172172
[HarmonyPrefix]
173173
public static bool AddSort_Prefix(Process.MusicSelectProcess __instance, DB.SortRootID root)
174174
{
175175
if (root != DB.SortRootID.Tab) return true;
176-
int next = (int)(DB.SortTabID)_beforeSortField.GetValue(__instance) + 1;
176+
int next = (int)(DB.SortTabID)_sortField.GetValue(__instance) + 1;
177177
if (next >= ConstTabId.End) next = ConstTabId.Value;
178-
_beforeSortField.SetValue(__instance, (DB.SortTabID)next);
178+
_sortField.SetValue(__instance, (DB.SortTabID)next);
179179
return false;
180180
}
181181
}

0 commit comments

Comments
 (0)