From 15f1d23c344d885d8c3c3e846a681f798c529d18 Mon Sep 17 00:00:00 2001 From: Terry Hearst Date: Wed, 23 Aug 2023 00:50:50 -0400 Subject: [PATCH] Add patch to show diamond time after beating a level (if conditions met) --- Patches/GamePlayManagerPatches.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Patches/GamePlayManagerPatches.cs 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(); + } + } + } +}