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; + } + } + } + + } } } +