miuu-diamond-time-viewer/Patches/GamePlayManagerPatches.cs

25 lines
674 B
C#
Raw Permalink Normal View History

using HarmonyLib;
using MIU;
namespace DiamondTimeViewer.Patches
{
2024-01-01 14:58:31 -05:00
[HarmonyPatch(typeof(GamePlayManager), nameof(GamePlayManager.FinishPlay))]
internal class GamePlayManagerFinishPlayPatch
{
static void Postfix(GamePlayManager __instance, MarbleController marble)
{
if (Config.Mode == DisplayMode.Never)
return;
if ((__instance.PlayType == PlayType.Normal || __instance.PlayType == PlayType.Ghost) && !MarbleManager.usedRewind && LevelSelect.instance != null)
{
if (marble.ElapsedTime < LevelSelect.instance.bestScore)
{
LevelSelect.instance.bestScore = marble.ElapsedTime;
LevelSelect.instance.UpdateMedals();
}
}
}
}
}