PVZFusionTranslation/MelonLoader/Patches/GameObjects/UIDifficulty_Patch.cs
SillyStar-Github b7014a341f root rewrite
2025-04-19 13:11:08 -04:00

30 lines
972 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());
string difficultyText = StringStore.patchesStore["Difficulty"][Utils.Language.ToString()];
__instance.t.text = string.Format(difficultyText + " {0}", GameAPP.difficulty);
#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;
}
}
}