25 lines
651 B
C#
25 lines
651 B
C#
using HarmonyLib;
|
|
using MIU;
|
|
|
|
namespace DiamondTimeViewer.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)
|
|
{
|
|
if (marble.ElapsedTime < LevelSelect.instance.bestScore)
|
|
{
|
|
LevelSelect.instance.bestScore = marble.ElapsedTime;
|
|
LevelSelect.instance.UpdateMedals();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|