PVZFusionTranslation/MelonLoader/Patches/Managers/EndlessMgr_Patch.cs
SillyStar-Github b7014a341f root rewrite
2025-04-19 13:11:08 -04:00

27 lines
678 B
C#

using HarmonyLib;
using Il2Cpp;
using Il2CppTMPro;
using PvZ_Fusion_Translator.AssetStore;
using UnityEngine;
namespace PvZ_Fusion_Translator.Patches.Managers
{
[HarmonyPatch(typeof(EndlessMgr))]
public static class EndlessMgr_Patch
{
[HarmonyPatch(nameof(EndlessMgr.Awake))]
[HarmonyPostfix]
private static void Awake(EndlessMgr __instance)
{
Transform textTransform = __instance.transform.GetChild(2);
if (textTransform != null && textTransform.gameObject.activeSelf)
{
TextMeshProUGUI textTMP = textTransform.GetComponent<TextMeshProUGUI>();
if (textTMP != null)
{
textTMP = StringStore.TranslateText(textTMP);
}
}
}
}
}