using HarmonyLib; using System; using TMPro; using PvZ_Fusion_Translator__BepInEx_.AssetStore; using UnityEngine; using static PvZ_Fusion_Translator__BepInEx_.Log; namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects { [HarmonyPatch(typeof(AlmanacZombieMenu))] public static class AlmanacZombieMenu_Patch { [HarmonyPatch(nameof(AlmanacZombieMenu.Awake))] [HarmonyPostfix] private static void Awake(AlmanacZombieMenu __instance) { TMP_FontAsset font = FontStore.LoadTMPFont(Utils.Language.ToString()); foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren(true)) { bool isZombieName = text.gameObject.name.Contains("Name") && text.transform.parent.name != "Background"; if (text.gameObject.name != "Description" && !isZombieName) { text.text = StringStore.TranslateText(text.text); text.font = font; text.autoSizeTextContainer = true; } } } } }