fixed a thing in DrawCard

This commit is contained in:
TuanAnh2901 2025-06-06 10:00:26 +07:00
parent ea21392df0
commit 4aa4dfb414

View file

@ -17,7 +17,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
private static void Postfix_UpdateText(DrawCardManager __instance)
{
Il2CppSystem.Collections.Generic.List<TextMeshProUGUI> 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<TextMeshProUGUI> 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;
}
}
}
}
}
}