Merge pull request #4 from Teyliu/cassidy
Update to 2.7 thanks to cassidy
This commit is contained in:
commit
0e5383f0db
11 changed files with 234 additions and 8 deletions
|
|
@ -3,7 +3,7 @@ using MelonLoader.Utils;
|
|||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
|
||||
[assembly: MelonInfo(typeof(PvZ_Fusion_Translator.Core), "PvZ Fusion Translator", "231.0.0", "dynaslash / arifrios1st / lancerx0 / JustNull / Dakosha / Mamoru-kun", null)]
|
||||
[assembly: MelonInfo(typeof(PvZ_Fusion_Translator.Core), "PvZ Fusion Translator", "231.0.0", "dynaslash / arifrios1st / lancerx0 / JustNull / Dakosha / Mamoru-kun / cassidy", null)]
|
||||
[assembly: MelonGame("LanPiaoPiao", "PlantsVsZombiesRH")]
|
||||
|
||||
namespace PvZ_Fusion_Translator
|
||||
|
|
|
|||
|
|
@ -1,17 +1,18 @@
|
|||
using MelonLoader;
|
||||
using MelonLoader.Logging;
|
||||
using System.Drawing;
|
||||
|
||||
namespace PvZ_Fusion_Translator
|
||||
{
|
||||
internal static class Log
|
||||
{
|
||||
public static void LogDebug(object txt) => Melon<Core>.Logger.Msg(Color.Gray, txt);
|
||||
public static void LogDebug(string txt) => Melon<Core>.Logger.Msg(Color.Gray, txt);
|
||||
public static void LogDebug(string txt, params object[] args) => Melon<Core>.Logger.Msg(Color.Gray, txt, args);
|
||||
public static void LogDebug(object txt) => Melon<Core>.Logger.Msg(ColorARGB.Gray, txt);
|
||||
public static void LogDebug(string txt) => Melon<Core>.Logger.Msg(ColorARGB.Gray, txt);
|
||||
public static void LogDebug(string txt, params object[] args) => Melon<Core>.Logger.Msg(ColorARGB.Gray, txt, args);
|
||||
|
||||
public static void LogInfo(object txt) => Melon<Core>.Logger.Msg(Color.Blue, txt);
|
||||
public static void LogInfo(string txt) => Melon<Core>.Logger.Msg(Color.Blue, txt);
|
||||
public static void LogInfo(string txt, params object[] args) => Melon<Core>.Logger.Msg(Color.Blue, txt, args);
|
||||
public static void LogInfo(object txt) => Melon<Core>.Logger.Msg(ColorARGB.Blue, txt);
|
||||
public static void LogInfo(string txt) => Melon<Core>.Logger.Msg(ColorARGB.Blue, txt);
|
||||
public static void LogInfo(string txt, params object[] args) => Melon<Core>.Logger.Msg(ColorARGB.Blue, txt, args);
|
||||
|
||||
public static void LogWarning(object txt) => Melon<Core>.Logger.Warning(txt);
|
||||
public static void LogWarning(string txt) => Melon<Core>.Logger.Warning(txt);
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
|
||||
foreach(TextMeshProUGUI txt in mainTransform.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
FileLoader.DumpUntranslatedStrings(txt.text);
|
||||
txt.text = StringStore.TranslateText(txt.text);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
{
|
||||
// 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))
|
||||
|
|
|
|||
37
MelonLoader/Patches/GameObjects/CrisisZombieWindow_Patch.cs
Normal file
37
MelonLoader/Patches/GameObjects/CrisisZombieWindow_Patch.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(CrisisZombieWindow))]
|
||||
public static class CrisisZombieWindow_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(CrisisZombieWindow.Start))]
|
||||
[HarmonyPostfix]
|
||||
private static void Start(CrisisZombieWindow __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(CrisisZombieWindow.SetZombieType))]
|
||||
[HarmonyPostfix]
|
||||
private static void SetZombieType(CrisisZombieWindow __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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(FruitNinjaSelectWindow))]
|
||||
public static class FruitNinjaSelectWindow_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(FruitNinjaSelectWindow.SetType))]
|
||||
[HarmonyPostfix]
|
||||
private static void SetType(FruitNinjaSelectWindow __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(FruitNinjaSelectWindow.OnAnimOver))]
|
||||
[HarmonyPostfix]
|
||||
private static void OnAnimOver(FruitNinjaSelectWindow __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;
|
||||
}
|
||||
}
|
||||
}
|
||||
37
MelonLoader/Patches/GameObjects/RogueCardWindow_Patch.cs
Normal file
37
MelonLoader/Patches/GameObjects/RogueCardWindow_Patch.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(RogueCardWindow))]
|
||||
public static class RogueCardWindow_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(RogueCardWindow.InitCard))]
|
||||
[HarmonyPostfix]
|
||||
private static void InitCard(RogueCardWindow __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(RogueCardWindow.OnAnimOver))]
|
||||
[HarmonyPostfix]
|
||||
private static void OnAnimOver(RogueCardWindow __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;
|
||||
}
|
||||
}
|
||||
}
|
||||
44
MelonLoader/Patches/GameObjects/RogueStartMenu_Patch.cs
Normal file
44
MelonLoader/Patches/GameObjects/RogueStartMenu_Patch.cs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using MelonLoader;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TextCore.Text;
|
||||
using UnityEngine.UI;
|
||||
using static MelonLoader.MelonLogger;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
|
||||
[HarmonyPatch(typeof(RogueStartMenu))]
|
||||
public static class RogueStartMenu_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(RogueStartMenu.SetLeader))]
|
||||
[HarmonyPostfix]
|
||||
private static void SetLeader(RogueStartMenu __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;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(RogueStartMenu.EnterGame))]
|
||||
[HarmonyPostfix]
|
||||
private static void EnterGame(RogueStartMenu __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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
25
MelonLoader/Patches/GameObjects/ShootingMenu_Patch.cs
Normal file
25
MelonLoader/Patches/GameObjects/ShootingMenu_Patch.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(ShootingMenu))]
|
||||
public static class ShootingMenu_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(ShootingMenu.Update))]
|
||||
[HarmonyPostfix]
|
||||
private static void Update(ShootingMenu __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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(ShootingSelectWindow))]
|
||||
public static class ShootingSelectWindow_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(ShootingSelectWindow.SetUpgradePlantTypes))]
|
||||
[HarmonyPostfix]
|
||||
private static void InitCard(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.OnAnimOver))]
|
||||
[HarmonyPostfix]
|
||||
private static void OnAnimOver(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
<LangVersion>latest</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Configurations>Debug;DebugEnglish;ReleaseMulti;ReleaseEnglish;DebugTesting;ReleaseOther;DebugObfuscate;ReleaseObfuscate</Configurations>
|
||||
<GamePath>G:\ML-Fusion 2.6.1\Game Files</GamePath>
|
||||
<GamePath>C:\Users\rainb\Desktop\PC_PVZ-Fusion-2.7</GamePath>
|
||||
<Platforms>AnyCPU;ARM64;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
@ -400,6 +400,11 @@
|
|||
<Compile Include="Log.cs" />
|
||||
<Compile Include="ModFeatures.cs" />
|
||||
<Compile Include="AssetStore\AudioStore.cs" />
|
||||
<Compile Include="Patches\GameObjects\ShootingSelectWindow_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\FruitNinjaSelectWindow_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\RogueCardWindow_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\CrisisZombieWindow_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\RogueStartMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\AbyssBagMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\AbyssCheckInBag_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\AbyssStoreMenu_Patch.cs" />
|
||||
|
|
@ -427,6 +432,7 @@
|
|||
<Compile Include="Patches\GameObjects\AbyssMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TowerOption_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TravelLookBuff_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\ShootingMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TravelLookMenu_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\ChessManager_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\CustomLevelShower_Patch.cs" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue