From 790fc4c66cdac5e1ffded4ae7d74fdf38d7ecfbc Mon Sep 17 00:00:00 2001 From: SillyStar-Github <90102598+SillyStar-Github@users.noreply.github.com> Date: Tue, 15 Jul 2025 00:51:48 -0400 Subject: [PATCH] fixes idk --- MelonLoader/Core.cs | 2 +- .../ButtonObjects/UIButton_Patch.cs | 1 + .../Patches/GameObjects/ShootingMenu_Patch.cs | 25 +++++++++++++++++++ ...PvZ Fusion Translator [MelonLoader].csproj | 1 + 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 MelonLoader/Patches/GameObjects/ShootingMenu_Patch.cs diff --git a/MelonLoader/Core.cs b/MelonLoader/Core.cs index f67dd86..2eebd69 100644 --- a/MelonLoader/Core.cs +++ b/MelonLoader/Core.cs @@ -3,7 +3,7 @@ using MelonLoader.Utils; using PvZ_Fusion_Translator.AssetStore; using UnityEngine; -[assembly: MelonInfo(typeof(PvZ_Fusion_Translator.Core), "PvZ Fusion Translator", "231.0.0", "dynaslash / arifrios1st / lancerx0 / JustNull / Dakosha / Mamoru-kun \ cassidy", null)] +[assembly: MelonInfo(typeof(PvZ_Fusion_Translator.Core), "PvZ Fusion Translator", "231.0.0", "dynaslash / arifrios1st / lancerx0 / JustNull / Dakosha / Mamoru-kun / cassidy", null)] [assembly: MelonGame("LanPiaoPiao", "PlantsVsZombiesRH")] namespace PvZ_Fusion_Translator diff --git a/MelonLoader/Patches/GameObjects/ButtonObjects/UIButton_Patch.cs b/MelonLoader/Patches/GameObjects/ButtonObjects/UIButton_Patch.cs index bd66319..9d52845 100644 --- a/MelonLoader/Patches/GameObjects/ButtonObjects/UIButton_Patch.cs +++ b/MelonLoader/Patches/GameObjects/ButtonObjects/UIButton_Patch.cs @@ -18,6 +18,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects { // Convert and translate legacy Text components Text[] textComponents = __instance.GetComponentsInChildren(true); + TextMeshProUGUI[] textMeshComponents = __instance.GetComponentsInChildren(true); foreach (Text textComponent in textComponents) { if (textComponent != null && !string.IsNullOrEmpty(textComponent.text)) diff --git a/MelonLoader/Patches/GameObjects/ShootingMenu_Patch.cs b/MelonLoader/Patches/GameObjects/ShootingMenu_Patch.cs new file mode 100644 index 0000000..069ee0e --- /dev/null +++ b/MelonLoader/Patches/GameObjects/ShootingMenu_Patch.cs @@ -0,0 +1,25 @@ +using HarmonyLib; +using Il2Cpp; +using Il2CppTMPro; +using PvZ_Fusion_Translator.AssetStore; +using UnityEngine; + +namespace PvZ_Fusion_Translator.Patches.GameObjects +{ + [HarmonyPatch(typeof(ShootingMenu))] + public static class ShootingMenu_Patch + { + [HarmonyPatch(nameof(ShootingMenu.Update))] + [HarmonyPostfix] + private static void Update(ShootingMenu __instance) + { + TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); + + foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren()) + { + txt.text = StringStore.TranslateText(txt.text); + txt.font = fontAsset; + } + } + } +} \ No newline at end of file diff --git a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj index e6e0ca7..711c901 100644 --- a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj +++ b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj @@ -432,6 +432,7 @@ +