using HarmonyLib; using System; using TMPro; using PvZ_Fusion_Translator__BepInEx_.AssetStore; using UnityEngine; namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects { [HarmonyPatch(typeof(InGameBtn))] public static class InGameBtn_Patch { [HarmonyPatch(nameof(InGameBtn.Update))] [HarmonyPostfix] private static void Update(InGameBtn __instance) { Transform sceneText = __instance.transform.FindChild("SceneText"); if(sceneText != null) { TextMeshProUGUI sceneTextTMP = sceneText.transform.GetComponent(); if(sceneTextTMP != null) { sceneTextTMP = AssetStore.StringStore.TranslateText(sceneTextTMP); } Transform sceneTextShadow = sceneText.transform.FindChild("SceneText"); if(sceneTextShadow != null) { TextMeshProUGUI sceneTextShadowTMP = sceneTextShadow.transform.GetComponent(); if (sceneTextShadowTMP != null) { sceneTextShadowTMP = AssetStore.StringStore.TranslateText(sceneTextShadowTMP); } } } foreach(TextMeshProUGUI text in __instance.transform.GetComponentsInChildren()) { text.text = StringStore.TranslateText(text.text); } } } }