From d49fae11bbc68a00b690a9081e9943e164927c2f Mon Sep 17 00:00:00 2001 From: SillyStar-Github <90102598+SillyStar-Github@users.noreply.github.com> Date: Thu, 24 Jul 2025 12:20:19 -0400 Subject: [PATCH] Update ShootingSelectWindow_Patch.cs --- .../GameObjects/ShootingSelectWindow_Patch.cs | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/MelonLoader/Patches/GameObjects/ShootingSelectWindow_Patch.cs b/MelonLoader/Patches/GameObjects/ShootingSelectWindow_Patch.cs index e778974..2e49428 100644 --- a/MelonLoader/Patches/GameObjects/ShootingSelectWindow_Patch.cs +++ b/MelonLoader/Patches/GameObjects/ShootingSelectWindow_Patch.cs @@ -10,7 +10,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects [HarmonyPatch(typeof(ShootingSelectWindow))] public static class ShootingSelectWindow_Patch { - [HarmonyPatch(nameof(ShootingSelectWindow.SetUpgradePlantTypes))] + [HarmonyPatch(nameof(ShootingSelectWindow.InitPlantType))] [HarmonyPostfix] private static void InitCard(ShootingSelectWindow __instance) { @@ -33,5 +33,41 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects introduceText.text = StringStore.TranslateText(introduceText.text); introduceText.font = fontAsset; } + + [HarmonyPatch(nameof(ShootingSelectWindow.SetUpgradePlantTypes))] + [HarmonyPostfix] + private static void SetUpgradePlantTypes(ShootingSelectWindow __instance) + { + Transform introduceTransform = __instance.transform.FindChild("Images").FindChild("Introduce"); + TextMeshProUGUI introduceText = introduceTransform.GetComponent(); + TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); + + introduceText.text = StringStore.TranslateText(introduceText.text); + introduceText.font = fontAsset; + } + + [HarmonyPatch(nameof(ShootingSelectWindow.GetMaxIndexInRoutes))] + [HarmonyPostfix] + private static void GetMaxIndexInRoutes(ShootingSelectWindow __instance) + { + Transform introduceTransform = __instance.transform.FindChild("Images").FindChild("Introduce"); + TextMeshProUGUI introduceText = introduceTransform.GetComponent(); + TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); + + introduceText.text = StringStore.TranslateText(introduceText.text); + introduceText.font = fontAsset; + } + + [HarmonyPatch(nameof(ShootingSelectWindow.Start))] + [HarmonyPostfix] + private static void Start(ShootingSelectWindow __instance) + { + Transform introduceTransform = __instance.transform.FindChild("Images").FindChild("Introduce"); + TextMeshProUGUI introduceText = introduceTransform.GetComponent(); + TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); + + introduceText.text = StringStore.TranslateText(introduceText.text); + introduceText.font = fontAsset; + } } }