Update BIE to current ML branch
This commit is contained in:
parent
0e9debc5b8
commit
4447f3c96d
6 changed files with 76 additions and 29 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -130,3 +130,4 @@ MelonLoader/bin/x64/Debug/net6.0/UnityEngine.VRModule.dll
|
||||||
MelonLoader/bin/x64/Debug/net6.0/UnityEngine.WindModule.dll
|
MelonLoader/bin/x64/Debug/net6.0/UnityEngine.WindModule.dll
|
||||||
MelonLoader/bin/x64/Debug/net6.0/UnityEngine.XRModule.dll
|
MelonLoader/bin/x64/Debug/net6.0/UnityEngine.XRModule.dll
|
||||||
MelonLoader/bin/x64/Debug/net6.0/WebSocketDotNet.dll
|
MelonLoader/bin/x64/Debug/net6.0/WebSocketDotNet.dll
|
||||||
|
/BepInEx/bin/Debug/net6.0
|
||||||
|
|
|
||||||
|
|
@ -91,8 +91,11 @@ public class Core : BasePlugin
|
||||||
{
|
{
|
||||||
Utils.OpenTrello();
|
Utils.OpenTrello();
|
||||||
}
|
}
|
||||||
|
if (TowerManager.Instance != null)
|
||||||
|
{
|
||||||
TowerManager_Patch.UpdateText();
|
TowerManager_Patch.UpdateText();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void OnGUI()
|
public void OnGUI()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
|
|
||||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
|
|
@ -7,18 +8,21 @@ namespace PvZ_Fusion_Translator__BepInEx_.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -21,5 +21,20 @@ namespace PvZ_Fusion_Translator__BepInEx_.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -111,7 +111,7 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DumpAlmanacModdedZombies(__instance);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -129,6 +129,25 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[HarmonyPatch(typeof(AlmanacMgrZombie))]
|
||||||
|
public static partial class AlmanacMgrZombie_Patch
|
||||||
|
{
|
||||||
|
[HarmonyPatch(nameof(AlmanacMgrZombie.OnMouseDown))]
|
||||||
|
[HarmonyPostfix]
|
||||||
|
public static void DumpAlmanacModdedZombies(AlmanacMgrZombie __instance)
|
||||||
|
{
|
||||||
|
// Dump the texts if needed using Ctrl key
|
||||||
|
if (Input.GetKey(KeyCode.LeftControl))
|
||||||
|
{
|
||||||
|
FileLoader.DumpUntranslatedStrings(__instance.info.GetComponent<TextMeshPro>().text);
|
||||||
|
Log.LogInfo($"Info: {__instance.info.GetComponent<TextMeshPro>().text}");
|
||||||
|
FileLoader.DumpUntranslatedStrings(__instance.zombieName.GetComponent<TextMeshPro>().text);
|
||||||
|
Log.LogInfo($"Zombie Name: {__instance.zombieName.GetComponent<TextMeshPro>().text}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Patch to translate the modded almanac zombie names and info
|
// Patch to translate the modded almanac zombie names and info
|
||||||
[HarmonyPatch(typeof(AlmanacMgrZombie))]
|
[HarmonyPatch(typeof(AlmanacMgrZombie))]
|
||||||
public static partial class AlmanacMgrZombie_Patch
|
public static partial class AlmanacMgrZombie_Patch
|
||||||
|
|
@ -141,13 +160,7 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
||||||
__instance.introduce.text = StringStore.TranslateText(__instance.introduce.text);
|
__instance.introduce.text = StringStore.TranslateText(__instance.introduce.text);
|
||||||
__instance.introduce.font = FontStore.LoadTMPFont(currentLanguage);
|
__instance.introduce.font = FontStore.LoadTMPFont(currentLanguage);
|
||||||
|
|
||||||
// Dump the texts if needed
|
DumpAlmanacModdedZombies(__instance);
|
||||||
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
|
// translate all TMP components in info
|
||||||
foreach (TextMeshPro text in __instance.info.GetComponentsInChildren<TextMeshPro>())
|
foreach (TextMeshPro text in __instance.info.GetComponentsInChildren<TextMeshPro>())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using Il2CppInterop.Runtime;
|
using Il2CppInterop.Runtime;
|
||||||
using PvZ_Fusion_Translator__BepInEx_;
|
using PvZ_Fusion_Translator__BepInEx_;
|
||||||
|
|
@ -159,6 +159,8 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
||||||
text.text = StringStore.TranslateText(text.text);
|
text.text = StringStore.TranslateText(text.text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TranslateTextAlmanac(__instance);
|
TranslateTextAlmanac(__instance);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -183,6 +185,15 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
||||||
public static void TranslateTextAlmanac(AlmanacPlantBank __instance)
|
public static void TranslateTextAlmanac(AlmanacPlantBank __instance)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Dump the texts if needed
|
||||||
|
if (Input.GetKey(KeyCode.LeftControl))
|
||||||
|
{
|
||||||
|
FileLoader.DumpUntranslatedStrings(__instance.introduce.GetComponent<TextMeshPro>().text);
|
||||||
|
Log.LogInfo($"Info: {__instance.introduce.GetComponent<TextMeshPro>().text}");
|
||||||
|
FileLoader.DumpUntranslatedStrings(__instance.plantName.GetComponent<TextMeshPro>().text);
|
||||||
|
Log.LogInfo($"PlantName Name: {__instance.plantName.GetComponent<TextMeshPro>().text}");
|
||||||
|
Log.LogInfo($"PlantShadow Name: {__instance.plantName.transform.GetChild(0).GetComponent<TextMeshPro>().text}");
|
||||||
|
}
|
||||||
string currentLanguage = Utils.Language.ToString();
|
string currentLanguage = Utils.Language.ToString();
|
||||||
__instance.introduce.text = StringStore.TranslateText(__instance.introduce.text);
|
__instance.introduce.text = StringStore.TranslateText(__instance.introduce.text);
|
||||||
__instance.introduce.font = FontStore.LoadTMPFont(currentLanguage);
|
__instance.introduce.font = FontStore.LoadTMPFont(currentLanguage);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue