Update ShootingSelectWindow_Patch.cs

This commit is contained in:
SillyStar-Github 2025-07-24 12:20:19 -04:00
parent c188f75c9d
commit d49fae11bb

View file

@ -10,7 +10,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
[HarmonyPatch(typeof(ShootingSelectWindow))]
public static class ShootingSelectWindow_Patch
{
[HarmonyPatch(nameof(ShootingSelectWindow.SetUpgradePlantTypes))]
[HarmonyPatch(nameof(ShootingSelectWindow.InitPlantType))]
[HarmonyPostfix]
private static void InitCard(ShootingSelectWindow __instance)
{
@ -33,5 +33,41 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
introduceText.text = StringStore.TranslateText(introduceText.text);
introduceText.font = fontAsset;
}
[HarmonyPatch(nameof(ShootingSelectWindow.SetUpgradePlantTypes))]
[HarmonyPostfix]
private static void SetUpgradePlantTypes(ShootingSelectWindow __instance)
{
Transform introduceTransform = __instance.transform.FindChild("Images").FindChild("Introduce");
TextMeshProUGUI introduceText = introduceTransform.GetComponent<TextMeshProUGUI>();
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
introduceText.text = StringStore.TranslateText(introduceText.text);
introduceText.font = fontAsset;
}
[HarmonyPatch(nameof(ShootingSelectWindow.GetMaxIndexInRoutes))]
[HarmonyPostfix]
private static void GetMaxIndexInRoutes(ShootingSelectWindow __instance)
{
Transform introduceTransform = __instance.transform.FindChild("Images").FindChild("Introduce");
TextMeshProUGUI introduceText = introduceTransform.GetComponent<TextMeshProUGUI>();
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
introduceText.text = StringStore.TranslateText(introduceText.text);
introduceText.font = fontAsset;
}
[HarmonyPatch(nameof(ShootingSelectWindow.Start))]
[HarmonyPostfix]
private static void Start(ShootingSelectWindow __instance)
{
Transform introduceTransform = __instance.transform.FindChild("Images").FindChild("Introduce");
TextMeshProUGUI introduceText = introduceTransform.GetComponent<TextMeshProUGUI>();
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
introduceText.text = StringStore.TranslateText(introduceText.text);
introduceText.font = fontAsset;
}
}
}