using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Il2Cpp; using HarmonyLib; using UnityEngine; using Il2CppTMPro; using PvZ_Fusion_Translator.AssetStore; namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey { [HarmonyPatch(typeof(MultipleChoiceMenu))] public static class MultipleChoiceMenu_Patch { [HarmonyPatch(nameof(MultipleChoiceMenu.Awake))] [HarmonyPatch(nameof(MultipleChoiceMenu.UpdateWindow))] [HarmonyPatch(nameof(MultipleChoiceMenu.Refresh))] [HarmonyPatch(nameof(MultipleChoiceMenu.Cancel))] [HarmonyPostfix] public static void Awake(MultipleChoiceMenu __instance) { TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); foreach(BaseWindow window in __instance.windows) { foreach(TextMeshProUGUI txt in window.GetComponentsInChildren()) { txt.font = fontAsset; if(StringStore.customLevelString.ContainsKey(txt.text)) { txt.text = StringStore.customLevelString[txt.text]; } else { txt.text = StringStore.translationString.ContainsKey(txt.text + "_MC") ? StringStore.TranslateText(txt.text + "_MC") : StringStore.TranslateText(txt.text); } } } } } }