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