Update BepInEx to 2.8.1 with ML current trans progress
Update to the current progress. Patch to translate mod (LibraHp's) using translation_strings
This commit is contained in:
commit
dc01a905b0
16 changed files with 319 additions and 57 deletions
|
|
@ -3,15 +3,17 @@ using BepInEx.Configuration;
|
|||
using BepInEx.Logging;
|
||||
using BepInEx.Unity.IL2CPP;
|
||||
using BepInEx.Unity.IL2CPP.Utils;
|
||||
using TMPro;
|
||||
using HarmonyLib;
|
||||
using PvZ_Fusion_Translator__BepInEx_;
|
||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||
using PvZ_Fusion_Translator__BepInEx_.Patches.Managers;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
|
||||
[BepInPlugin("PVZFusionTranslator_BepInEx", "PvZ Fusion Translator", "2.8.1")]
|
||||
[BepInProcess("PlantsVsZombiesRH.exe")]
|
||||
public class Core : BasePlugin
|
||||
{
|
||||
|
|
@ -89,6 +91,7 @@ public class Core : BasePlugin
|
|||
{
|
||||
Utils.OpenTrello();
|
||||
}
|
||||
TowerManager_Patch.UpdateText();
|
||||
}
|
||||
|
||||
public void OnGUI()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
using System;
|
||||
using TMPro;
|
||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||
using PvZ_Fusion_Translator__BepInEx_.Patches.Managers;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.BaseTextObjects
|
||||
{
|
||||
|
|
@ -21,7 +23,11 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.BaseTextObjects
|
|||
if (__instance.name.StartsWith("LevelName"))
|
||||
{
|
||||
__instance.text = __instance.text.Replace("\n", " ");
|
||||
}
|
||||
if (__instance.name == "LevelName2" || __instance.name == "LevelName3")
|
||||
{
|
||||
TowerManager_Patch.updatedText.Add(__instance.transform);
|
||||
}
|
||||
}
|
||||
if (__instance.transform.parent != null && __instance.transform.parent.name.StartsWith("Window"))
|
||||
{
|
||||
__instance.fontSizeMin = 10;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using HarmonyLib;
|
||||
using HarmonyLib;
|
||||
using System;
|
||||
using TMPro;
|
||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||
|
|
@ -48,6 +48,12 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
|||
textMesh.text = StringStore.TranslateText(textMesh.text);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
text.font = fontAsset;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(AbyssMenu2.Start))]
|
||||
|
|
@ -56,7 +62,6 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
|||
{
|
||||
UpdateAbyss2Text(__instance);
|
||||
|
||||
Utils.ConvertButtonText(__instance.transform, "Goback");
|
||||
Utils.ConvertButtonText(__instance.transform, "Help");
|
||||
Utils.ConvertButtonText(__instance.transform, "Bag");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,11 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
|||
txt.font = fontAsset;
|
||||
}
|
||||
|
||||
Utils.ConvertButtonText(__instance.transform, "Goback");
|
||||
foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
text.font = fontAsset;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(AbyssMenu.UpdateLevelInfo))]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using HarmonyLib;
|
||||
using HarmonyLib;
|
||||
using System;
|
||||
using TMPro;
|
||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||
|
|
@ -106,8 +106,17 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
|||
StringStore.TranslateTextTransform(pageScaryPotTransform.Find("LastPage"));
|
||||
}
|
||||
|
||||
foreach(TextMeshProUGUI txt in mainTransform.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
Transform pageEndlessLevelTransform = levelsTransform.transform.Find("PageEndlessLevel");
|
||||
if (pageEndlessLevelTransform != null)
|
||||
{
|
||||
StringStore.TranslateTextTransform(pageEndlessLevelTransform.Find("BackToIndex"));
|
||||
StringStore.TranslateTextTransform(pageEndlessLevelTransform.Find("Nextpage"));
|
||||
StringStore.TranslateTextTransform(pageEndlessLevelTransform.Find("LastPage"));
|
||||
}
|
||||
|
||||
foreach (TextMeshProUGUI txt in mainTransform.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
// Still dump untranslated strings for modded plants and zombies
|
||||
FileLoader.DumpUntranslatedStrings(txt.text);
|
||||
txt.text = StringStore.TranslateText(txt.text);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using HarmonyLib;
|
||||
using HarmonyLib;
|
||||
using System;
|
||||
using TMPro;
|
||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||
|
|
@ -16,37 +16,42 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
|||
{
|
||||
try
|
||||
{
|
||||
// Convert and translate legacy Text components
|
||||
Text[] textComponents = __instance.GetComponentsInChildren<Text>(true);
|
||||
TextMeshProUGUI[] textMeshComponents = __instance.GetComponentsInChildren<TextMeshProUGUI>(true);
|
||||
foreach (Text textComponent in textComponents)
|
||||
{
|
||||
if (textComponent != null && !string.IsNullOrEmpty(textComponent.text))
|
||||
{
|
||||
string translatedText = StringStore.TranslateText(textComponent.text);
|
||||
if (!string.IsNullOrEmpty(translatedText) && translatedText != textComponent.text)
|
||||
{
|
||||
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
TextMeshProUGUI newTMP = StringStore.ConvertToTextMeshPro(textComponent, fontAsset, true);
|
||||
|
||||
if (newTMP != null)
|
||||
{
|
||||
newTMP.text = translatedText;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Also handle TMP components directly under the button
|
||||
if (__instance.transform.childCount >= 2)
|
||||
{
|
||||
TextMeshProUGUI text = __instance.transform.GetChild(0).GetComponent<TextMeshProUGUI>();
|
||||
TextMeshProUGUI textShadow = __instance.transform.GetChild(1).GetComponent<TextMeshProUGUI>();
|
||||
|
||||
StringStore.TranslateTextUI(text, false);
|
||||
StringStore.TranslateTextUI(textShadow, false);
|
||||
text.text = StringStore.TranslateText(text.text, false);
|
||||
textShadow.text = StringStore.TranslateText(textShadow.text, false);
|
||||
|
||||
text.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
textShadow.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
text.autoSizeTextContainer = textShadow.autoSizeTextContainer = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Convert and translate legacy Text components
|
||||
Text[] textComponents = __instance.GetComponentsInChildren<Text>(true);
|
||||
TextMeshProUGUI[] textMeshComponents = __instance.GetComponentsInChildren<TextMeshProUGUI>(true);
|
||||
foreach (Text textComponent in textComponents)
|
||||
{
|
||||
if (textComponent != null && !string.IsNullOrEmpty(textComponent.text))
|
||||
{
|
||||
string translatedText = StringStore.TranslateText(textComponent.text);
|
||||
if (!string.IsNullOrEmpty(translatedText) && translatedText != textComponent.text)
|
||||
{
|
||||
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
TextMeshProUGUI newTMP = StringStore.ConvertToTextMeshPro(textComponent, fontAsset, true);
|
||||
|
||||
if (newTMP != null)
|
||||
{
|
||||
newTMP.text = translatedText;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
|
@ -62,8 +67,11 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
|||
TextMeshProUGUI text = __instance.transform.GetChild(0).GetComponent<TextMeshProUGUI>();
|
||||
TextMeshProUGUI textShadow = __instance.transform.GetChild(1).GetComponent<TextMeshProUGUI>();
|
||||
|
||||
StringStore.TranslateTextUI(text, false);
|
||||
StringStore.TranslateTextUI(textShadow, false);
|
||||
text.text = StringStore.TranslateText(text.text, false);
|
||||
textShadow.text = StringStore.TranslateText(textShadow.text, false);
|
||||
|
||||
text.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
textShadow.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
text.autoSizeTextContainer = textShadow.autoSizeTextContainer = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
using HarmonyLib;
|
||||
using TMPro;
|
||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||
|
||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(UIProgress2))]
|
||||
public static class UIProgress2_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(UIProgress2.Update))]
|
||||
[HarmonyPostfix]
|
||||
private static void Update(UIProgress2 __instance)
|
||||
{
|
||||
__instance.t.text = StringStore.TranslateText(__instance.t.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
25
BepInEx/Patches/GameObjects/PlayerShootingMenu_Patch.cs
Normal file
25
BepInEx/Patches/GameObjects/PlayerShootingMenu_Patch.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using HarmonyLib;
|
||||
using TMPro;
|
||||
using BepInEx.Unity.IL2CPP;
|
||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(PlayerShootingMenu))]
|
||||
public static class PlayerShootingMenu_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(PlayerShootingMenu.Update))]
|
||||
[HarmonyPostfix]
|
||||
private static void Update(PlayerShootingMenu __instance)
|
||||
{
|
||||
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
|
||||
foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
txt.text = StringStore.TranslateText(txt.text);
|
||||
txt.font = fontAsset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
36
BepInEx/Patches/GameObjects/PlayerShootingWindow_Patch.cs
Normal file
36
BepInEx/Patches/GameObjects/PlayerShootingWindow_Patch.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using HarmonyLib;
|
||||
using TMPro;
|
||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||
using UnityEngine;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(PlayerShootingWindow))]
|
||||
public static class PlayerShootingWindow_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(PlayerShootingWindow.SetType))]
|
||||
[HarmonyPostfix]
|
||||
private static void SetType(PlayerShootingWindow __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(PlayerShootingWindow.OnAnimOver))]
|
||||
[HarmonyPostfix]
|
||||
private static void OnAnimOver(PlayerShootingWindow __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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +1,21 @@
|
|||
using HarmonyLib;
|
||||
using System;
|
||||
using TMPro;
|
||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||
using UnityEngine;
|
||||
//using HarmonyLib;
|
||||
//using System;
|
||||
//using TMPro;
|
||||
//using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||
//using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(TowerOption))]
|
||||
public static class TowerOption_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(TowerOption.Start))]
|
||||
[HarmonyPostfix]
|
||||
private static void Postfix_Start(TowerOption __instance)
|
||||
{
|
||||
//TextMeshProUGUI[] allTexts = __instance.GetComponentsInChildren<TextMeshProUGUI>(true);
|
||||
__instance.introduce.text = StringStore.TranslateText(__instance.introduce.text);
|
||||
__instance.introduce.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
//namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||
//{
|
||||
// [HarmonyPatch(typeof(TowerOption))]
|
||||
// public static class TowerOption_Patch
|
||||
// {
|
||||
// [HarmonyPatch(nameof(TowerOption.Start))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void Postfix_Start(TowerOption __instance)
|
||||
// {
|
||||
// //TextMeshProUGUI[] allTexts = __instance.GetComponentsInChildren<TextMeshProUGUI>(true);
|
||||
// __instance.introduce.text = StringStore.TranslateText(__instance.introduce.text);
|
||||
// __instance.introduce.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
39
BepInEx/Patches/GameObjects/TowerUpgradeMenu_Patch.cs
Normal file
39
BepInEx/Patches/GameObjects/TowerUpgradeMenu_Patch.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using HarmonyLib;
|
||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(TowerUpgradeMenu))]
|
||||
public static class TowerUpgradeMenu_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(TowerUpgradeMenu.Awake))]
|
||||
[HarmonyPostfix]
|
||||
private static void Awake(TowerUpgradeMenu __instance)
|
||||
{
|
||||
__instance.des.text = StringStore.TranslateText(__instance.des.text);
|
||||
__instance.des2.text = StringStore.TranslateText(__instance.des2.text);
|
||||
|
||||
foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
text.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TowerUpgradeMenu.SetText))]
|
||||
[HarmonyPostfix]
|
||||
private static void SetText(TowerUpgradeMenu __instance)
|
||||
{
|
||||
__instance.des.text = StringStore.TranslateText(__instance.des.text);
|
||||
__instance.des2.text = StringStore.TranslateText(__instance.des2.text);
|
||||
|
||||
foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
text.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
BepInEx/Patches/GameObjects/TravelBuffMenu_Patch.cs
Normal file
21
BepInEx/Patches/GameObjects/TravelBuffMenu_Patch.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
using HarmonyLib;
|
||||
using TMPro;
|
||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(TravelBuffMenu))]
|
||||
public static class TravelBuffMenu_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(TravelBuffMenu.RefeshOptions))]
|
||||
[HarmonyPostfix]
|
||||
private static void RefeshOptions(TravelBuffMenu __instance)
|
||||
{
|
||||
foreach (TravelBuffOptionButton button in __instance.options)
|
||||
{
|
||||
button.introduce.text = StringStore.TranslateText(button.introduce.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using HarmonyLib;
|
||||
using HarmonyLib;
|
||||
using System;
|
||||
using TMPro;
|
||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||
|
|
@ -10,7 +10,7 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
|||
{
|
||||
[HarmonyPatch(nameof(TravelBuffOptionButton.SetBuff))]
|
||||
[HarmonyPostfix]
|
||||
private static void Start(TravelBuffOptionButton __instance)
|
||||
private static void SetBuff(TravelBuffOptionButton __instance)
|
||||
{
|
||||
__instance.introduce.text = StringStore.TranslateText(__instance.introduce.text);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using HarmonyLib;
|
||||
using HarmonyLib;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
|
@ -119,7 +119,7 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
|||
[HarmonyPrefix]
|
||||
private static bool OnMouseDown(AlmanacMgrZombie __instance)
|
||||
{
|
||||
TextMeshPro component = __instance.info.GetComponent<TextMeshPro>();
|
||||
TextMeshPro component = __instance.info.GetComponent<TextMeshPro>();
|
||||
if (component != null)
|
||||
{
|
||||
component.pageToDisplay = component.pageToDisplay > component.m_pageNumber ? 1 : component.pageToDisplay + 1;
|
||||
|
|
@ -128,4 +128,54 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Patch to translate the modded almanac zombie names and info
|
||||
[HarmonyPatch(typeof(AlmanacMgrZombie))]
|
||||
public static partial class AlmanacMgrZombie_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(AlmanacMgrZombie.Start))]
|
||||
[HarmonyPostfix]
|
||||
public static void TranslateTextAlmanac(AlmanacMgrZombie __instance)
|
||||
{
|
||||
string currentLanguage = Utils.Language.ToString();
|
||||
__instance.introduce.text = StringStore.TranslateText(__instance.introduce.text);
|
||||
__instance.introduce.font = FontStore.LoadTMPFont(currentLanguage);
|
||||
|
||||
// Dump the texts if needed
|
||||
if (Input.GetMouseButtonDown(0) && Input.GetKey(KeyCode.LeftControl))
|
||||
{
|
||||
FileLoader.DumpUntranslatedStrings(__instance.info.GetComponent<TextMeshPro>().text);
|
||||
FileLoader.DumpUntranslatedStrings(__instance.zombieName.GetComponent<TextMeshPro>().text);
|
||||
}
|
||||
|
||||
// translate all TMP components in info
|
||||
foreach (TextMeshPro text in __instance.info.GetComponentsInChildren<TextMeshPro>())
|
||||
{
|
||||
if (text != null)
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
text.name = StringStore.TranslateText(text.name);
|
||||
text.font = FontStore.LoadTMPFont(currentLanguage);
|
||||
}
|
||||
}
|
||||
foreach (TextMeshPro text in __instance.zombieName.GetComponentsInChildren<TextMeshPro>())
|
||||
{
|
||||
if (text != null)
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
text.name = StringStore.TranslateText(text.name);
|
||||
text.font = FontStore.LoadTMPFont(currentLanguage);
|
||||
}
|
||||
}
|
||||
|
||||
// Translate zombieName and its child
|
||||
__instance.zombieName.name = StringStore.TranslateText(__instance.zombieName.name);
|
||||
__instance.zombieName.GetComponent<TextMeshPro>().font = FontStore.LoadTMPFont(currentLanguage);
|
||||
__instance.zombieName.transform.GetChild(0).name = StringStore.TranslateText(__instance.zombieName.transform.GetChild(0).name);
|
||||
// Get both for less testing
|
||||
__instance.zombieName.GetComponent<TextMeshPro>().text = StringStore.TranslateText(__instance.zombieName.GetComponent<TextMeshPro>().text);
|
||||
__instance.zombieName.transform.GetChild(0).GetComponent<TextMeshPro>().text = StringStore.TranslateText(__instance.zombieName.transform.GetChild(0).GetComponent<TextMeshPro>().text);
|
||||
__instance.zombieName.transform.GetChild(0).GetComponent<TextMeshPro>().font = FontStore.LoadTMPFont(currentLanguage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
33
BepInEx/Patches/Managers/TowerManager_Patch.cs
Normal file
33
BepInEx/Patches/Managers/TowerManager_Patch.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using HarmonyLib;
|
||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||
using TMPro;
|
||||
using BepInEx.Unity.IL2CPP;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
||||
{
|
||||
[HarmonyPatch(typeof(TowerManager))]
|
||||
public static class TowerManager_Patch
|
||||
{
|
||||
public static List<Transform> updatedText = [];
|
||||
|
||||
public static void UpdateText()
|
||||
{
|
||||
foreach (Transform transform in updatedText)
|
||||
{
|
||||
if (transform != null)
|
||||
{
|
||||
transform.GetComponent<TextMeshProUGUI>().text = StringStore.TranslateText(transform.GetComponent<TextMeshProUGUI>().text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TowerManager.Update))]
|
||||
[HarmonyPostfix]
|
||||
public static void Update(TowerManager __instance)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -120,6 +120,9 @@
|
|||
<Compile Include="AssetStore\AudioStore.cs" />
|
||||
<Compile Include="Patches\GameObjects\Board_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\MinorObjects\Jigsaw_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\MinorObjects\UIProgress2_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\PlayerShootingMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\PlayerShootingWindow_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\ShootingSelectWindow_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\FruitNinjaSelectWindow_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\RogueCardWindow_Patch.cs" />
|
||||
|
|
@ -151,6 +154,8 @@
|
|||
<Compile Include="Patches\GameObjects\AbyssMenu2_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\AbyssMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TowerOption_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TowerUpgradeMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TravelBuffMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TravelLookBuff_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\ShootingMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TravelLookMenu_Patch.cs" />
|
||||
|
|
@ -159,6 +164,7 @@
|
|||
<Compile Include="Patches\Managers\DrawCardManager_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\SaveMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TravelBuffOptionButton_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\TowerManager_Patch.cs" />
|
||||
<Compile Include="Patches\OtherManagers\AchievementClip_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\ButtonObjects\Advanture_Btn_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\AlmanacMgrZombie_Patch.cs" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue