mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-11 23:17:28 +08:00
[+] Support official quick retry (3456) in UX/QuickSkip
Merge pull request #60 * Official quick retry
This commit is contained in:
@@ -6,6 +6,7 @@ using MAI2.Util;
|
||||
using Main;
|
||||
using Manager;
|
||||
using MelonLoader;
|
||||
using Monitor;
|
||||
using Process;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -84,5 +85,33 @@ namespace AquaMai.UX
|
||||
Singleton<GamePlayManager>.Instance.SetQuickRetryFrag(flag: true);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(QuickRetry), "IsQuickRetryEnable")]
|
||||
public static bool OnQuickRetryIsQuickRetryEnable(ref bool __result)
|
||||
{
|
||||
var isUtageProperty = Traverse.Create(typeof(GameManager)).Property("IsUtage");
|
||||
__result = !isUtageProperty.PropertyExists() || !isUtageProperty.GetValue<bool>();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Fix for the game not resetting Fast and Late counts when quick retrying
|
||||
// For game version < 1.35.0
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(GamePlayManager), "SetQuickRetryFrag")]
|
||||
public static void PostGamePlayManagerSetQuickRetryFrag(GamePlayManager __instance, bool flag)
|
||||
{
|
||||
// Since 1.35.0, `GameScoreList.Initialize()` resets the Fast and Late counts
|
||||
if (flag && !Traverse.Create(typeof(GameScoreList)).Methods().Contains("Initialize"))
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
var gameScoreList = __instance.GetGameScore(i);
|
||||
var traverse = Traverse.Create(gameScoreList);
|
||||
traverse.Property("Fast").SetValue((uint)0);
|
||||
traverse.Property("Late").SetValue((uint)0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user