36 lines
No EOL
1.3 KiB
C#
36 lines
No EOL
1.3 KiB
C#
using System.Text.RegularExpressions;
|
|
using HarmonyLib;
|
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
|
{
|
|
[HarmonyPatch(typeof(PlantDamageMenu))]
|
|
public static class PlantDamageMenu_Patch
|
|
{
|
|
[HarmonyPatch(nameof(PlantDamageMenu.Awake))]
|
|
[HarmonyPostfix]
|
|
private static void Awake(PlantDamageMenu __instance)
|
|
{
|
|
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
|
foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
|
{
|
|
text.text = StringStore.TranslateText(text.text);
|
|
text.font = fontAsset;
|
|
}
|
|
}
|
|
|
|
[HarmonyPatch(nameof(PlantDamageMenu.InitCards))]
|
|
[HarmonyPostfix]
|
|
private static void InitCards(PlantDamageMenu __instance)
|
|
{
|
|
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
|
foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
|
{
|
|
text.text = StringStore.TranslateText(text.text);
|
|
text.font = fontAsset;
|
|
}
|
|
}
|
|
}
|
|
} |