From 4aa4dfb4142606d95e9c922f8ca1dc3e78bbd599 Mon Sep 17 00:00:00 2001 From: TuanAnh2901 Date: Fri, 6 Jun 2025 10:00:26 +0700 Subject: [PATCH] fixed a thing in DrawCard --- .../Patches/Managers/DrawCardManager_Patch.cs | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/MelonLoader/Patches/Managers/DrawCardManager_Patch.cs b/MelonLoader/Patches/Managers/DrawCardManager_Patch.cs index 3b90229..20489ac 100644 --- a/MelonLoader/Patches/Managers/DrawCardManager_Patch.cs +++ b/MelonLoader/Patches/Managers/DrawCardManager_Patch.cs @@ -17,7 +17,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects private static void Postfix_UpdateText(DrawCardManager __instance) { Il2CppSystem.Collections.Generic.List texts = __instance.texts; - + __instance.upName = StringStore.TranslateText(__instance.upName); if (texts != null && texts.Count > 0) { foreach (TextMeshProUGUI textComponent in texts) @@ -32,5 +32,31 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects } } } + + + + [HarmonyPatch(nameof(DrawCardManager.Update))] + [HarmonyPostfix] + private static void Postfix_Update(DrawCardManager __instance) + { + Il2CppSystem.Collections.Generic.List texts = __instance.texts; + __instance.upName = StringStore.TranslateText(__instance.upName); + + if (texts != null && texts.Count > 0) + { + foreach (TextMeshProUGUI textComponent in texts) + { + if (textComponent != null) + { + string translatedText = StringStore.TranslateText(textComponent.text); + TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); + textComponent.text = translatedText; + textComponent.font = fontAsset; + } + } + } + + } } } +