using HarmonyLib; using System.Collections.Generic; using System.Runtime.CompilerServices; using UnityEngine; namespace MiuuDiamondTimeViewer.Patches { [HarmonyPatch(typeof(MedalsDisplay))] [HarmonyPatch("Setup")] internal class MedalsDisplaySetupPatch { static bool Prefix(MedalsDisplay __instance, float silver, float gold, List eggUnlock) { // Get diamond time (since it is not passed in as a parameter) float diamond = LevelSelect.instance.level.DiamondTime; bool hasEgg = eggUnlock != null && eggUnlock.Count > 0; bool gotEgg = hasEgg && UnlockManager.Get().IsUnlocked(eggUnlock[0]) && !CosmeticValues.WasPurchased(eggUnlock[0]); string eggText = ""; if (hasEgg) eggText = (gotEgg ? " " : " "); string diamondText = ""; if (LevelSelect.instance.bestScore > 0f && LevelSelect.instance.bestScore <= diamond) diamondText = " " + SegmentedTime.SPTimeText(diamond); __instance.MedalTimes.text = string.Concat(new string[] { " ", SegmentedTime.SPTimeText(silver), " ", SegmentedTime.SPTimeText(gold), diamondText, eggText }); // Skip original method return false; } } }