Merge branch 'cassidy'

This commit is contained in:
SillyStar-Github 2025-08-16 17:34:00 -04:00
parent dc01a905b0
commit 497170aa2c
3 changed files with 40 additions and 17 deletions

View file

@ -4,6 +4,7 @@ using MelonLoader.Utils;
using PvZ_Fusion_Translator.AssetStore; using PvZ_Fusion_Translator.AssetStore;
using PvZ_Fusion_Translator.Patches.Managers; using PvZ_Fusion_Translator.Patches.Managers;
using UnityEngine; using UnityEngine;
using Il2Cpp;
[assembly: MelonInfo(typeof(PvZ_Fusion_Translator.Core), "PvZ Fusion Translator", "231.0.0", "dynaslash / arifrios1st / lancerx0 / JustNull / Dakosha / Mamoru-kun / cassidy / Teyliu", null)] [assembly: MelonInfo(typeof(PvZ_Fusion_Translator.Core), "PvZ Fusion Translator", "231.0.0", "dynaslash / arifrios1st / lancerx0 / JustNull / Dakosha / Mamoru-kun / cassidy / Teyliu", null)]
[assembly: MelonGame("LanPiaoPiao", "PlantsVsZombiesRH")] [assembly: MelonGame("LanPiaoPiao", "PlantsVsZombiesRH")]
@ -74,8 +75,11 @@ namespace PvZ_Fusion_Translator
Utils.OpenTrello(); Utils.OpenTrello();
} }
TowerManager_Patch.UpdateText(); if(TowerManager.Instance != null)
} {
TowerManager_Patch.UpdateText();
}
}
public override void OnGUI() public override void OnGUI()
{ {

View file

@ -1,24 +1,28 @@
using HarmonyLib; using HarmonyLib;
using Il2Cpp; using Il2Cpp;
using PvZ_Fusion_Translator.AssetStore; using PvZ_Fusion_Translator.AssetStore;
using System.Text.RegularExpressions;
namespace PvZ_Fusion_Translator.Patches.GameObjects namespace PvZ_Fusion_Translator.Patches.GameObjects
{ {
[HarmonyPatch(typeof(GardenPlant))] [HarmonyPatch(typeof(GardenPlant))]
public static class GardenPlant_Patch public static class GardenPlant_Patch
{ {
[HarmonyPatch(nameof(GardenPlant.Update))] [HarmonyPatch(nameof(GardenPlant.Start))]
[HarmonyPostfix] [HarmonyPostfix]
private static void Update(GardenPlant __instance) private static void Start(GardenPlant __instance)
{ {
__instance.infoText = StringStore.TranslateText(__instance.infoText); __instance.infoText.font = FontStore.LoadTMPFont(Utils.Language.ToString());
} __instance.infoText.text = StringStore.TranslateText(__instance.infoText.text);
}
[HarmonyPatch(nameof(GardenPlant.UpdateInfo))] [HarmonyPatch(nameof(GardenPlant.UpdateInfo))]
[HarmonyPostfix] [HarmonyPostfix]
private static void UpdateInfo(GardenPlant __instance) private static void UpdateInfo(GardenPlant __instance)
{ {
__instance.infoText = StringStore.TranslateText(__instance.infoText);
} __instance.infoText.font = FontStore.LoadTMPFont(Utils.Language.ToString());
} __instance.infoText.text = StringStore.TranslateText(__instance.infoText.text);
}
}
} }

View file

@ -21,5 +21,20 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
txt.font = fontAsset; txt.font = fontAsset;
} }
} }
[HarmonyPatch(nameof(PlayerShootingMenu.Refresh))]
[HarmonyPostfix]
private static void Refresh(PlayerShootingMenu __instance)
{
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
Transform refreshTransform = __instance.transform.FindChild("Button");
foreach (TextMeshProUGUI text in refreshTransform.GetComponentsInChildren<TextMeshProUGUI>())
{
text.text = StringStore.TranslateText(text.text);
text.font = fontAsset;
text.autoSizeTextContainer = false;
}
}
} }
} }