diff --git a/Patches/GamePlayManagerPatches.cs b/Patches/GamePlayManagerPatches.cs new file mode 100644 index 0000000..4a90285 --- /dev/null +++ b/Patches/GamePlayManagerPatches.cs @@ -0,0 +1,22 @@ +using HarmonyLib; +using MIU; + +namespace MiuuDiamondTimeViewer.Patches +{ + [HarmonyPatch(typeof(GamePlayManager))] + [HarmonyPatch("FinishPlay")] + internal class GamePlayManagerFinishPlayPatch + { + static void Postfix(GamePlayManager __instance, MarbleController marble) + { + if (!Config.Enabled) + return; + + if ((__instance.PlayType == PlayType.Normal || __instance.PlayType == PlayType.Ghost) && !MarbleManager.usedRewind && LevelSelect.instance != null) + { + LevelSelect.instance.bestScore = marble.ElapsedTime; + LevelSelect.instance.UpdateMedals(); + } + } + } +}