PVZFusionTranslation/MelonLoader/Patches/GameObjects/UIDifficulty_Patch.cs
SillyStar-Github e3e1bdac94 bro idk
2025-05-11 01:59:26 -04:00

29 lines
873 B
C#

using HarmonyLib;
using Il2Cpp;
using Il2CppTMPro;
using PvZ_Fusion_Translator.AssetStore;
namespace PvZ_Fusion_Translator.Patches.GameObjects
{
[HarmonyPatch(typeof(UIDifficulty))]
public static class UIDifficulty_Patch
{
[HarmonyPatch(nameof(UIDifficulty.Update))]
[HarmonyPostfix]
private static void Update(UIDifficulty __instance)
{
#if MULTI_LANGUAGE
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
__instance.t.text = StringStore.TranslateText(__instance.t.text);
#else
TMP_FontAsset fontAsset = FontStore.LoadTMPFont();
string difficultyText = StringStore.patchesStore["Difficulty"]["Spanish"];
__instance.t.text = string.Format("Difficulty: {0}", GameAPP.difficulty);
#endif
__instance.t.autoSizeTextContainer = false;
__instance.t.font = fontAsset;
}
}
}