this should be the last of 3.0 code
This commit is contained in:
parent
e19f1d0ba3
commit
ee41cfd777
13 changed files with 152 additions and 1136 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -17,6 +17,11 @@ namespace PvZ_Fusion_Translator.Patches.BaseTextObjects
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(__instance.text))
|
if (!string.IsNullOrEmpty(__instance.text))
|
||||||
{
|
{
|
||||||
|
if(__instance.transform.parent.parent.name.Contains("AbyssBagMenu"))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string originalText = __instance.text;
|
string originalText = __instance.text;
|
||||||
__instance = StringStore.TranslateText(__instance);
|
__instance = StringStore.TranslateText(__instance);
|
||||||
__instance.autoSizeTextContainer = false;
|
__instance.autoSizeTextContainer = false;
|
||||||
|
|
@ -44,8 +49,13 @@ namespace PvZ_Fusion_Translator.Patches.BaseTextObjects
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
private static void Awake(TextMeshProUGUI __instance)
|
private static void Awake(TextMeshProUGUI __instance)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(__instance.text))
|
if (!string.IsNullOrEmpty(__instance.text))
|
||||||
{
|
{
|
||||||
|
if (__instance.transform.parent.parent.name.Contains("AbyssBagMenu"))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
__instance = StringStore.TranslateText(__instance);
|
__instance = StringStore.TranslateText(__instance);
|
||||||
__instance.autoSizeTextContainer = false;
|
__instance.autoSizeTextContainer = false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,14 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||||
{
|
{
|
||||||
[HarmonyPatch(nameof(AbyssBagMenu.Awake))]
|
[HarmonyPatch(nameof(AbyssBagMenu.Awake))]
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
private static void MoveFromBag(AbyssCheckInBag __instance)
|
private static void Awake_Post(AbyssCheckInBag __instance)
|
||||||
{
|
{
|
||||||
|
foreach(TextMeshProUGUI text in __instance.transform.FindChild("Background").GetComponentsInChildren<TextMeshProUGUI>())
|
||||||
|
{
|
||||||
|
text.text = text.text + "_深渊";
|
||||||
|
text.text = StringStore.TranslateText("背包_深渊");
|
||||||
|
text.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||||
|
}
|
||||||
AbyssMenu2.Instance.UpdateIcons();
|
AbyssMenu2.Instance.UpdateIcons();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,11 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||||
UpdateAbyss2Text(__instance);
|
UpdateAbyss2Text(__instance);
|
||||||
|
|
||||||
Utils.ConvertButtonText(__instance.transform, "Help");
|
Utils.ConvertButtonText(__instance.transform, "Help");
|
||||||
|
|
||||||
|
// custom bag text :D
|
||||||
|
|
||||||
|
__instance.transform.FindChild("Bag").FindChild("text").GetComponent<Text>().text += "_深渊";
|
||||||
|
|
||||||
Utils.ConvertButtonText(__instance.transform, "Bag");
|
Utils.ConvertButtonText(__instance.transform, "Bag");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,21 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects.ButtonObjects
|
||||||
|
|
||||||
foreach(TextMeshProUGUI txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
foreach(TextMeshProUGUI txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||||
{
|
{
|
||||||
txt.text = StringStore.TranslateText(txt.text);
|
string text = txt.text;
|
||||||
txt.font = fontAsset;
|
Transform menuTransform = __instance.transform.parent.parent.parent.parent.parent.parent; // guys i'm really sorry please forgive me
|
||||||
|
string customIZStringKey = StringStore.translationString.FirstOrDefault(x => x.Value == text).Key + "_IZ"; // dawg what the fuck
|
||||||
|
bool hasCustomIZString = StringStore.translationString.ContainsKey(customIZStringKey);
|
||||||
|
|
||||||
|
if (hasCustomIZString && menuTransform.name.Contains("IZMenu"))
|
||||||
|
{
|
||||||
|
txt.text = StringStore.TranslateText(customIZStringKey);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
txt.text = StringStore.TranslateText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
txt.font = fontAsset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,28 +9,28 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects.ButtonObjects
|
||||||
[HarmonyPatch(typeof(MainMenu_Btn))]
|
[HarmonyPatch(typeof(MainMenu_Btn))]
|
||||||
public static class MainMenu_Btn_Patch
|
public static class MainMenu_Btn_Patch
|
||||||
{
|
{
|
||||||
public static List<GameObject> speechBubbles = new List<GameObject>();
|
//public static List<GameObject> speechBubbles = new List<GameObject>();
|
||||||
|
|
||||||
[HarmonyPatch(nameof(MainMenu_Btn.OnMouseEnter))]
|
//[HarmonyPatch(nameof(MainMenu_Btn.OnMouseEnter))]
|
||||||
[HarmonyPostfix]
|
//[HarmonyPostfix]
|
||||||
private static void OnMouseEnter(MainMenu_Btn __instance)
|
//private static void OnMouseEnter(MainMenu_Btn __instance)
|
||||||
{
|
//{
|
||||||
string textToShow = null;
|
// string textToShow = null;
|
||||||
|
|
||||||
if(__instance.transform.parent.name == "recipe")
|
// if(__instance.transform.parent.name == "recipe")
|
||||||
{
|
// {
|
||||||
textToShow = "探索模式";
|
// textToShow = "探索模式";
|
||||||
}
|
// }
|
||||||
else if (__instance.name == "mysterious")
|
// else if (__instance.name == "mysterious")
|
||||||
{
|
// {
|
||||||
textToShow = "神秘模式";
|
// textToShow = "神秘模式";
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(textToShow != null)
|
// if(textToShow != null)
|
||||||
{
|
// {
|
||||||
InGameText.Instance.ShowText(textToShow, 2.0f);
|
// InGameText.Instance.ShowText(textToShow, 2.0f);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -142,8 +142,6 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects.MinorObjects
|
||||||
string fStr = HPStrings.ElementAt(fIndex).Value;
|
string fStr = HPStrings.ElementAt(fIndex).Value;
|
||||||
string DPS = originalText.Split("\n")[1].Replace("DPS:", "");
|
string DPS = originalText.Split("\n")[1].Replace("DPS:", "");
|
||||||
|
|
||||||
Log.LogInfo(DPS);
|
|
||||||
|
|
||||||
switch (fIndex)
|
switch (fIndex)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||||
private static void Update(TravelStore __instance)
|
private static void Update(TravelStore __instance)
|
||||||
{
|
{
|
||||||
foreach (TextMeshProUGUI intr in __instance.introduces)
|
foreach (TextMeshProUGUI intr in __instance.introduces)
|
||||||
StringStore.TranslateTextUI(intr);
|
intr.text = StringStore.TranslateText(intr.text);
|
||||||
foreach (var textMesh in __instance.points)
|
foreach (var textMesh in __instance.points)
|
||||||
StringStore.TranslateTextUI(textMesh);
|
textMesh.text = StringStore.TranslateText(textMesh.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPatch(nameof(TravelStore.RefreshBuff))]
|
[HarmonyPatch(nameof(TravelStore.RefreshBuff))]
|
||||||
|
|
@ -26,14 +26,14 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||||
foreach (TravelBuff buff in __instance.travelBuffs)
|
foreach (TravelBuff buff in __instance.travelBuffs)
|
||||||
{
|
{
|
||||||
TextMeshProUGUI cost = buff.transform.GetChild(1).GetComponent<TextMeshProUGUI>();
|
TextMeshProUGUI cost = buff.transform.GetChild(1).GetComponent<TextMeshProUGUI>();
|
||||||
if (!cost.text.Contains('0'))
|
cost.text = StringStore.TranslateText(cost.text);
|
||||||
StringStore.TranslateTextUI(cost);
|
cost.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||||
cost.font = Resources.Load<TMP_FontAsset>("fonts/Dynamic");
|
FileLoader.DumpUntranslatedStrings(cost.text);
|
||||||
}
|
}
|
||||||
foreach (TextMeshProUGUI intr in __instance.introduces)
|
foreach (TextMeshProUGUI intr in __instance.introduces)
|
||||||
StringStore.TranslateTextUI(intr);
|
intr.text = StringStore.TranslateText(intr.text);
|
||||||
foreach (var textMesh in __instance.points)
|
foreach (var textMesh in __instance.points)
|
||||||
StringStore.TranslateTextUI(textMesh);
|
textMesh.text = StringStore.TranslateText(textMesh.text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
61
MelonLoader/Patches/Managers/IZBottomMenu_Patch.cs
Normal file
61
MelonLoader/Patches/Managers/IZBottomMenu_Patch.cs
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
using HarmonyLib;
|
||||||
|
using Il2Cpp;
|
||||||
|
using Il2CppTMPro;
|
||||||
|
using PvZ_Fusion_Translator.AssetStore;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace PvZ_Fusion_Translator.Patches.Managers
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(IZBottomMenu))]
|
||||||
|
public static class IZBottomMenu_Patch
|
||||||
|
{
|
||||||
|
[HarmonyPatch(nameof(IZBottomMenu.ChangeString))]
|
||||||
|
[HarmonyPostfix]
|
||||||
|
public static void ChangeStringz(IZBottomMenu __instance)
|
||||||
|
{
|
||||||
|
TextMeshProUGUI[] array =
|
||||||
|
[
|
||||||
|
__instance.transform.GetChild(0).GetComponent<TextMeshProUGUI>(),
|
||||||
|
__instance.transform.GetChild(0).GetChild(0).GetComponent<TextMeshProUGUI>(),
|
||||||
|
];
|
||||||
|
for (int i = 0; i < array.Length; i++)
|
||||||
|
{
|
||||||
|
string fStr = StringStore.translationStringRegex["([^\\s]+),推荐难度:(\\d+)"];
|
||||||
|
string[] parts = array[i].text.Split(",推荐难度:");
|
||||||
|
|
||||||
|
if(new Regex("([^\\s]+),推荐难度:(\\d+)").IsMatch(array[i].text))
|
||||||
|
{
|
||||||
|
array[i].text = string.Format(fStr, StringStore.TranslateText(parts[0]), parts[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
array[i] = StringStore.TranslateText(array[i]);
|
||||||
|
array[i].text = array[i].text.Replace("\n", " ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(nameof(IZBottomMenu.SetLevelName))]
|
||||||
|
[HarmonyPostfix]
|
||||||
|
public static void SetLevelName(IZBottomMenu __instance)
|
||||||
|
{
|
||||||
|
TextMeshProUGUI[] array =
|
||||||
|
[
|
||||||
|
__instance.transform.GetChild(0).GetComponent<TextMeshProUGUI>(),
|
||||||
|
__instance.transform.GetChild(0).GetChild(0).GetComponent<TextMeshProUGUI>(),
|
||||||
|
];
|
||||||
|
for (int i = 0; i < array.Length; i++)
|
||||||
|
{
|
||||||
|
string fStr = StringStore.translationStringRegex["([^\\s]+),推荐难度:(\\d+)"];
|
||||||
|
string[] parts = array[i].text.Split(",推荐难度:");
|
||||||
|
|
||||||
|
if (new Regex("([^\\s]+),推荐难度:(\\d+)").IsMatch(array[i].text))
|
||||||
|
{
|
||||||
|
array[i].text = string.Format(fStr, StringStore.TranslateText(parts[0]), parts[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
array[i] = StringStore.TranslateText(array[i]);
|
||||||
|
array[i].text = array[i].text.Replace("\n", " ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
using HarmonyLib;
|
|
||||||
using Il2Cpp;
|
|
||||||
using Il2CppTMPro;
|
|
||||||
using PvZ_Fusion_Translator.AssetStore;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace PvZ_Fusion_Translator.Patches.Managers
|
|
||||||
{
|
|
||||||
[HarmonyPatch(typeof(IZBottomMenu))]
|
|
||||||
public static class IZBottomMenu_Patch
|
|
||||||
{
|
|
||||||
[HarmonyPatch(nameof(IZBottomMenu.ChangeString))]
|
|
||||||
[HarmonyPostfix]
|
|
||||||
public static void Start(IZBottomMenu __instance)
|
|
||||||
{
|
|
||||||
TextMeshProUGUI[] array =
|
|
||||||
[
|
|
||||||
__instance.transform.GetChild(0).GetComponent<TextMeshProUGUI>(),
|
|
||||||
__instance.transform.GetChild(0).GetChild(0).GetComponent<TextMeshProUGUI>(),
|
|
||||||
];
|
|
||||||
for (int i = 0; i < array.Length; i++)
|
|
||||||
{
|
|
||||||
array[i] = StringStore.TranslateText(array[i]);
|
|
||||||
array[i].text = array[i].text.Replace("\n", " ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -27,14 +27,15 @@ namespace PvZ_Fusion_Translator.Patches.Managers
|
||||||
for (int i = 0; i < array2.Length; i++)
|
for (int i = 0; i < array2.Length; i++)
|
||||||
{
|
{
|
||||||
array2[i].text = array2[i].text.Replace("\n", " ");
|
array2[i].text = array2[i].text.Replace("\n", " ");
|
||||||
|
Regex checkFusionChallenge = new Regex("^超级([^\\s:]+)(:?挑战1?)");
|
||||||
|
|
||||||
if (array2[i].text.Contains("配方:"))
|
if (array2[i].text.Contains("配方:") && !checkFusionChallenge.IsMatch(array2[i].text))
|
||||||
{
|
{
|
||||||
string[] lines = array2[i].text.Split(":");
|
string[] lines = array2[i].text.Split(":");
|
||||||
lines[1] = Utils.GetPlantNameFromAlmanac(lines[1]);
|
lines[1] = Utils.GetPlantNameFromAlmanac(lines[1]);
|
||||||
if (lines[1] == "")
|
if (lines[1] == "")
|
||||||
{
|
{
|
||||||
Log.LogInfo("Couldn't find plant! (Fusion Showcase)");
|
Log.LogError("Couldn't find plant! (Fusion Showcase)");
|
||||||
lines[1] = StringStore.TranslateText(lines[1]);
|
lines[1] = StringStore.TranslateText(lines[1]);
|
||||||
}
|
}
|
||||||
array2[i].text = StringStore.TranslateText("配方:") + lines[1];
|
array2[i].text = StringStore.TranslateText("配方:") + lines[1];
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Configurations>Debug;DebugEnglish;ReleaseMulti;ReleaseEnglish;DebugTesting;ReleaseOther;DebugObfuscate;ReleaseObfuscate</Configurations>
|
<Configurations>Debug;DebugEnglish;ReleaseMulti;ReleaseEnglish;DebugTesting;ReleaseOther;DebugObfuscate;ReleaseObfuscate</Configurations>
|
||||||
<GamePath>C:\Users\rainb\Desktop\PC_PVZ-Fusion_3.0</GamePath>
|
<GamePath>C:\Users\rainb\Desktop\PC_PVZ-Fusion_3.0.1</GamePath>
|
||||||
<Platforms>AnyCPU;ARM64;x64</Platforms>
|
<Platforms>AnyCPU;ARM64;x64</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
@ -479,7 +479,7 @@
|
||||||
<Compile Include="Patches\GameObjects\ButtonObjects\InGameBtn_Patch.cs" />
|
<Compile Include="Patches\GameObjects\ButtonObjects\InGameBtn_Patch.cs" />
|
||||||
<Compile Include="Patches\BaseTextObjects\InGameText_Patch.cs" />
|
<Compile Include="Patches\BaseTextObjects\InGameText_Patch.cs" />
|
||||||
<Compile Include="Patches\Managers\InGameUI_Patch.cs" />
|
<Compile Include="Patches\Managers\InGameUI_Patch.cs" />
|
||||||
<Compile Include="Patches\Managers\IZEMgr_Patch.cs" />
|
<Compile Include="Patches\Managers\IZBottomMenu_Patch.cs" />
|
||||||
<Compile Include="Patches\OtherManagers\MenuText_Patch.cs" />
|
<Compile Include="Patches\OtherManagers\MenuText_Patch.cs" />
|
||||||
<Compile Include="Patches\Managers\OppositeBuffManager_Patch.cs" />
|
<Compile Include="Patches\Managers\OppositeBuffManager_Patch.cs" />
|
||||||
<Compile Include="Patches\GameObjects\ButtonObjects\OptionBtn_Patch.cs" />
|
<Compile Include="Patches\GameObjects\ButtonObjects\OptionBtn_Patch.cs" />
|
||||||
|
|
|
||||||
|
|
@ -210,37 +210,42 @@ namespace PvZ_Fusion_Translator
|
||||||
string originalPath = Path.Combine(dumpDir, "LawnStrings.json");
|
string originalPath = Path.Combine(dumpDir, "LawnStrings.json");
|
||||||
string path = Path.Combine(almanacDir, "LawnStringsTranslate.json");
|
string path = Path.Combine(almanacDir, "LawnStringsTranslate.json");
|
||||||
|
|
||||||
if ((!File.Exists(path)) || (!File.Exists(originalPath)))
|
if ((!File.Exists(path)))
|
||||||
{
|
{
|
||||||
Log.LogError($"LawnStringsTranslate.json file not found at path: {path}");
|
Log.LogError($"LawnStringsTranslate.json file not found at path: {path}");
|
||||||
|
}
|
||||||
|
else if ((!File.Exists(originalPath)))
|
||||||
|
{
|
||||||
|
Log.LogError($"LawnStrings.json file not found at path: {originalPath}");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
originalJson = File.ReadAllText(originalPath);
|
|
||||||
translatedJson = File.ReadAllText(path);
|
|
||||||
AlmanacPlantBank.PlantData originalPlantData = JsonUtility.FromJson<AlmanacPlantBank.PlantData>(originalJson);
|
|
||||||
AlmanacPlantBank.PlantData translatedPlantData = JsonUtility.FromJson<AlmanacPlantBank.PlantData>(translatedJson);
|
|
||||||
|
|
||||||
for(int i = 0; i < originalPlantData.plants.Count; i++)
|
else
|
||||||
|
{
|
||||||
|
originalJson = File.ReadAllText(originalPath);
|
||||||
|
translatedJson = File.ReadAllText(path);
|
||||||
|
AlmanacPlantBank.PlantData originalPlantData = JsonUtility.FromJson<AlmanacPlantBank.PlantData>(originalJson);
|
||||||
|
AlmanacPlantBank.PlantData translatedPlantData = JsonUtility.FromJson<AlmanacPlantBank.PlantData>(translatedJson);
|
||||||
|
|
||||||
|
for (int i = 0; i < originalPlantData.plants.Count; i++)
|
||||||
{
|
{
|
||||||
PlantInfo originalPlantInfo = originalPlantData.plants[i];
|
PlantInfo originalPlantInfo = originalPlantData.plants[i];
|
||||||
PlantInfo translatedPlantInfo = null;
|
PlantInfo translatedPlantInfo = null;
|
||||||
|
|
||||||
foreach (PlantInfo info in translatedPlantData.plants)
|
foreach (PlantInfo info in translatedPlantData.plants)
|
||||||
{
|
{
|
||||||
if(info.seedType == originalPlantInfo.seedType)
|
if (info.seedType == originalPlantInfo.seedType)
|
||||||
{
|
{
|
||||||
translatedPlantInfo = info;
|
translatedPlantInfo = info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(translatedPlantInfo != null)
|
if (translatedPlantInfo != null)
|
||||||
{
|
{
|
||||||
KeyValuePair<int, string> temp = new KeyValuePair<int, string>(translatedPlantInfo.seedType, translatedPlantInfo.name);
|
KeyValuePair<int, string> temp = new KeyValuePair<int, string>(translatedPlantInfo.seedType, translatedPlantInfo.name);
|
||||||
plantIndices.Add(originalPlantInfo.seedType, temp);
|
plantIndices.Add(originalPlantInfo.seedType, temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MULTI_LANGUAGE
|
#if MULTI_LANGUAGE
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue