PVZFusionTranslation/MelonLoader/Patches/GameObjects/PVPRandomManager_Patch.cs
2026-02-23 00:20:13 -05:00

33 lines
955 B
C#

using HarmonyLib;
using Il2Cpp;
using Il2CppTMPro;
using PvZ_Fusion_Translator.AssetStore;
using UnityEngine;
using static MelonLoader.MelonLogger;
namespace PvZ_Fusion_Translator.Patches.GameObjects
{
[HarmonyPatch(typeof(PVPRandomManager))]
public static class PVPRandomManager_Patch
{
[HarmonyPatch(nameof(PVPRandomManager.Start))]
[HarmonyPostfix]
private static void Start(PVPRandomManager __instance)
{
foreach(TextMeshPro text in __instance.texts)
{
text.text = StringStore.TranslateText(text.text);
}
}
[HarmonyPatch(nameof(PVPRandomManager.Update))]
[HarmonyPostfix]
private static void ZombieEnterHouse(PVPRandomManager __instance)
{
foreach(TextMeshPro text in __instance.texts)
{
text.text = StringStore.TranslateText(text.text);
}
}
}
}