quick changes, removing old odyssey code temporarily, reordering certain files
This commit is contained in:
parent
5532ecc0d8
commit
abe2d8eadc
56 changed files with 490 additions and 488 deletions
|
|
@ -2,7 +2,7 @@
|
|||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using PvZ_Fusion_Translator.Patches.Managers;
|
||||
//using PvZ_Fusion_Translator.Patches.Modes.Odyssey;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml.Linq;
|
||||
using UnityEngine;
|
||||
|
|
@ -20,7 +20,7 @@ namespace PvZ_Fusion_Translator.Patches.BaseTextObjects
|
|||
|
||||
foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
string travelMatch = TravelMgr_Patch.MatchTravelBuff(txt.text);
|
||||
string travelMatch = "";
|
||||
string originalText = txt.text;
|
||||
|
||||
if (txt.gameObject.name.Contains("shadow"))
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects.MinorObjects
|
|||
{
|
||||
string origText = textTMP.text;
|
||||
string translatedText = origText;
|
||||
if (translatedText == null) return;
|
||||
string pattern = "(\\d+)阶\n([\\s\\S]+)";
|
||||
if (StringStore.TestRegex(translatedText, pattern))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using static PvZ_Fusion_Translator.Patches.Managers.TravelMgr_Patch;
|
||||
using UnityEngine;
|
||||
using MelonLoader;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(TravelBuffMenu))]
|
||||
public static class TravelBuffMenu_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(TravelBuffMenu.RefeshOptions))]
|
||||
[HarmonyPostfix]
|
||||
public static void RefeshOptions(TravelBuffMenu __instance)
|
||||
{
|
||||
foreach(TravelBuffOptionButton button in __instance.options)
|
||||
{
|
||||
TravelBuffOptionButton_Patch.TranslateOptionButton(button);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using MelonLoader;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using static MelonLoader.MelonLogger;
|
||||
using static PvZ_Fusion_Translator.Patches.Managers.TravelMgr_Patch;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(TravelBuffOptionButton))]
|
||||
public static class TravelBuffOptionButton_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(TravelBuffOptionButton.Awake))]
|
||||
[HarmonyPostfix]
|
||||
public static void Awake(TravelBuffOptionButton __instance)
|
||||
{
|
||||
TranslateOptionButton(__instance);
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TravelBuffOptionButton.OnAnimOver))]
|
||||
[HarmonyPostfix]
|
||||
public static void OnAnimOver(TravelBuffOptionButton __instance)
|
||||
{
|
||||
TranslateOptionButton(__instance);
|
||||
}
|
||||
|
||||
public static void TranslateOptionButton(TravelBuffOptionButton button)
|
||||
{
|
||||
List<string> buffSet = translatedTravelBuffs[buffLinks[button.buffType]];
|
||||
|
||||
string buff = (button.show != null && button.introduce.text != "词条已选完") ? buffSet[button.buffIndex] : StringStore.TranslateText("词条已选完");
|
||||
|
||||
button.introduce.text = buff;
|
||||
}
|
||||
}
|
||||
|
||||
//List<string> buffSet = translatedTravelBuffs[buffLinks[__instance.buffType]];
|
||||
//string buff = (__instance.show != null) ? buffSet[__instance.buffIndex] : StringStore.TranslateText("无");
|
||||
//__instance.introduce.text = buff;
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(TravelBuff))]
|
||||
public static class TravelBuff_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(TravelBuff.OnMouseUpAsButton))]
|
||||
[HarmonyPostfix]
|
||||
private static void OnMouseUpAsButton()
|
||||
{
|
||||
if (TravelBuffMgr.Instance == null) return;
|
||||
TravelBuffMgr.Instance.text = AssetStore.StringStore.TranslateText(TravelBuffMgr.Instance.text);
|
||||
TravelBuffMgr.Instance.text2 = AssetStore.StringStore.TranslateText(TravelBuffMgr.Instance.text2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using static PvZ_Fusion_Translator.Patches.Managers.TravelMgr_Patch;
|
||||
using UnityEngine;
|
||||
using MelonLoader;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(TravelLookBuff))]
|
||||
public static class TravelLookBuff_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(TravelLookBuff.Clear))]
|
||||
[HarmonyPostfix]
|
||||
public static void Post_Clear(TravelLookBuff __instance)
|
||||
{
|
||||
__instance.introduce.text = StringStore.TranslateText("无");
|
||||
__instance.set = false;
|
||||
|
||||
foreach (TextMeshProUGUI text in __instance.transform.FindChild("Images").FindChild("Button").GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TravelLookBuff.OnMouseUpAsButton))]
|
||||
[HarmonyPostfix]
|
||||
public static void Post_OnMouseUpAsButton(TravelLookBuff __instance)
|
||||
{
|
||||
foreach (TextMeshProUGUI text in __instance.transform.FindChild("Images").FindChild("Button").GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TravelLookBuff.SetBuff))]
|
||||
[HarmonyPostfix]
|
||||
public static void Post_SetBuff(TravelLookBuff __instance)
|
||||
{
|
||||
List<string> buffSet = translatedTravelBuffs[buffLinks[__instance.buffType]];
|
||||
string buffText = (__instance.buffIndex < buffSet.Count) ? buffSet[__instance.buffIndex] : StringStore.TranslateText(__instance.introduce.text);
|
||||
__instance.introduce.text = buffText;
|
||||
|
||||
foreach (TextMeshProUGUI text in __instance.transform.FindChild("Images").FindChild("Button").GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(TravelLookMenu))]
|
||||
public static class TravelLookMenu_Patch
|
||||
{
|
||||
public static string savedAssetString = "";
|
||||
|
||||
[HarmonyPatch(nameof(TravelLookMenu.Start))]
|
||||
[HarmonyPostfix]
|
||||
private static void Postfix_Start(TravelLookMenu __instance)
|
||||
{
|
||||
foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
txt.text = StringStore.TranslateText(txt.text);
|
||||
txt.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
}
|
||||
|
||||
Transform quitButtonTransform = __instance.transform.Find("Quit");
|
||||
foreach (TextMeshProUGUI txt in quitButtonTransform.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
txt.text = StringStore.TranslateText("合上");
|
||||
txt.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
}
|
||||
|
||||
__instance.treasureText.text = StringStore.TranslateText(__instance.treasureText.text);
|
||||
savedAssetString = __instance.treasureText.text;
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TravelLookMenu.Update))]
|
||||
[HarmonyPostfix]
|
||||
private static void Update(TravelLookMenu __instance)
|
||||
{
|
||||
if (savedAssetString != __instance.treasureText.text)
|
||||
{
|
||||
__instance.treasureText.text = StringStore.TranslateText(__instance.treasureText.text);
|
||||
savedAssetString = __instance.treasureText.text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(TravelRefresh))]
|
||||
public static class TravelRefresh_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(TravelRefresh.Start))]
|
||||
[HarmonyPostfix]
|
||||
private static void Start(TravelRefresh __instance)
|
||||
{
|
||||
__instance.text = StringStore.TranslateText(__instance.text);
|
||||
__instance.text_shadow = StringStore.TranslateText(__instance.text_shadow);
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TravelRefresh.OnMouseUpAsButton))]
|
||||
[HarmonyPostfix]
|
||||
private static void OnMouseUpAsButton(TravelRefresh __instance)
|
||||
{
|
||||
__instance.text = StringStore.TranslateText(__instance.text);
|
||||
__instance.text_shadow = StringStore.TranslateText(__instance.text_shadow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using static PvZ_Fusion_Translator.Patches.Managers.TravelMgr_Patch;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(TravelStore))]
|
||||
public static class TravelStore_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(TravelStore.Update))]
|
||||
[HarmonyPostfix]
|
||||
private static void Update(TravelStore __instance)
|
||||
{
|
||||
foreach(TextMeshProUGUI text in __instance.introduces)
|
||||
{
|
||||
if(__instance.currentSelect != null)
|
||||
{
|
||||
var buffList = translatedTravelBuffs[buffLinks[(BuffType)__instance.currentSelect.theBuffType]];
|
||||
if(__instance.currentSelect.theBuffNumber < buffList.Count && __instance.currentSelect.theBuffNumber > -1)
|
||||
{
|
||||
text.text = buffList[__instance.currentSelect.theBuffNumber];
|
||||
}
|
||||
else
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var textMesh in __instance.points)
|
||||
{
|
||||
textMesh.text = StringStore.TranslateText(textMesh.text);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TravelStore.RefreshBuff))]
|
||||
[HarmonyPostfix]
|
||||
private static void RefreshBuff(TravelStore __instance)
|
||||
{
|
||||
foreach (TravelBuff buff in __instance.travelBuffs)
|
||||
{
|
||||
TextMeshProUGUI cost = buff.transform.GetChild(1).GetComponent<TextMeshProUGUI>();
|
||||
cost.text = StringStore.TranslateText(cost.text);
|
||||
cost.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
}
|
||||
|
||||
foreach (TextMeshProUGUI text in __instance.introduces)
|
||||
{
|
||||
if (__instance.currentSelect != null)
|
||||
{
|
||||
var buffList = translatedTravelBuffs[buffLinks[(BuffType)__instance.currentSelect.theBuffType]];
|
||||
if (__instance.currentSelect.theBuffNumber < buffList.Count && __instance.currentSelect.theBuffNumber > -1)
|
||||
{
|
||||
text.text = buffList[__instance.currentSelect.theBuffNumber];
|
||||
}
|
||||
else
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var textMesh in __instance.points)
|
||||
{
|
||||
textMesh.text = StringStore.TranslateText(textMesh.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,12 +8,12 @@ namespace PvZ_Fusion_Translator.Patches.Managers
|
|||
[HarmonyPatch(typeof(DifficultyMgr))]
|
||||
public static class DifficultyMgr_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(DifficultyMgr.Update))]
|
||||
[HarmonyPostfix]
|
||||
private static void DifficultyMgr_Update(DifficultyMgr __instance)
|
||||
{
|
||||
__instance.t = StringStore.TranslateText(__instance.t);
|
||||
__instance.t.autoSizeTextContainer = false;
|
||||
}
|
||||
//[HarmonyPatch(nameof(DifficultyMgr.Update))]
|
||||
//[HarmonyPostfix]
|
||||
//private static void DifficultyMgr_Update(DifficultyMgr __instance)
|
||||
//{
|
||||
// __instance.t = StringStore.TranslateText(__instance.t);
|
||||
// __instance.t.autoSizeTextContainer = false;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
//using PvZ_Fusion_Translator.Patches.Modes.Odyssey;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEngine;
|
||||
|
||||
|
|
@ -10,11 +11,11 @@ namespace PvZ_Fusion_Translator.Patches.Managers
|
|||
[HarmonyPatch(typeof(OppositeBuffManager))]
|
||||
public static class OppositeBuffManager_Patch
|
||||
{
|
||||
public static Dictionary<BuffType, string> buffLinks = TravelMgr_Patch.buffLinks;
|
||||
public static Dictionary<string, List<string>> translatedTravelBuffs = TravelMgr_Patch.translatedTravelBuffs;
|
||||
public static string badPattern = @"^但(.*)";
|
||||
public static string badFormat = StringStore.translationStringRegex.ContainsKey(badPattern) ? StringStore.translationStringRegex[badPattern] : "But, {0}";
|
||||
public static TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
//public static Dictionary<BuffType, string> buffLinks = TravelMgr_Patch.buffLinks;
|
||||
//public static Dictionary<string, List<string>> translatedTravelBuffs = TravelMgr_Patch.translatedTravelBuffs;
|
||||
//public static string badPattern = @"^但(.*)";
|
||||
//public static string badFormat = StringStore.translationStringRegex.ContainsKey(badPattern) ? StringStore.translationStringRegex[badPattern] : "But, {0}";
|
||||
//public static TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
|
||||
[HarmonyPatch(nameof(OppositeBuffManager.Awake))]
|
||||
[HarmonyPostfix]
|
||||
|
|
@ -28,21 +29,21 @@ namespace PvZ_Fusion_Translator.Patches.Managers
|
|||
|
||||
public static void TranslateOppositeText(Il2CppSystem.Collections.Generic.List<TextMeshProUGUI> textList, BuffType buffType, int buffIndex, bool isBad = false)
|
||||
{
|
||||
string buff = translatedTravelBuffs[buffLinks[buffType]][buffIndex];
|
||||
//string buff = translatedTravelBuffs[buffLinks[buffType]][buffIndex];
|
||||
|
||||
foreach(var text in textList)
|
||||
{
|
||||
if(isBad)
|
||||
{
|
||||
text.text = string.Format(badFormat, buff);
|
||||
}
|
||||
else
|
||||
{
|
||||
text.text = buff;
|
||||
}
|
||||
//foreach(var text in textList)
|
||||
//{
|
||||
// if(isBad)
|
||||
// {
|
||||
// text.text = string.Format(badFormat, buff);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// text.text = buff;
|
||||
// }
|
||||
|
||||
text.font = fontAsset;
|
||||
}
|
||||
// text.font = fontAsset;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.Managers
|
||||
{
|
||||
[HarmonyPatch(typeof(TravelBuffMgr))]
|
||||
public static class TravelBuffMgr_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(TravelBuffMgr.Awake))]
|
||||
[HarmonyPostfix]
|
||||
private static void Awake(TravelBuffMgr __instance)
|
||||
{
|
||||
__instance.text = AssetStore.StringStore.TranslateText(__instance.text);
|
||||
__instance.text2 = AssetStore.StringStore.TranslateText(__instance.text2);
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TravelBuffMgr.ShowText), new Type[] { typeof(int), typeof(int) })]
|
||||
[HarmonyPostfix]
|
||||
private static void ShowText(TravelBuffMgr __instance)
|
||||
{
|
||||
__instance.text = AssetStore.StringStore.TranslateText(__instance.text);
|
||||
__instance.text2 = AssetStore.StringStore.TranslateText(__instance.text2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
using Il2Cpp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.Managers
|
||||
{
|
||||
[HarmonyPatch(typeof(TravelMgr))]
|
||||
public static class TravelMgr_Patch
|
||||
{
|
||||
public static Dictionary<BuffType, string> buffLinks = new Dictionary<BuffType, string>()
|
||||
{
|
||||
{ BuffType.AdvancedBuff, "advancedUpgrades" },
|
||||
{ BuffType.UltimateBuff, "ultimateUpgrades" },
|
||||
{ BuffType.UnlockPlant, "strongUltimates" },
|
||||
{ BuffType.Debuff, "debuffs" },
|
||||
};
|
||||
|
||||
public static Dictionary<string, List<string>> dumpedTravelBuffs = new Dictionary<string, List<string>>()
|
||||
{
|
||||
{ "advancedUpgrades", [] },
|
||||
{ "ultimateUpgrades", [] },
|
||||
{ "strongUltimates", [] },
|
||||
{ "debuffs", [] }
|
||||
};
|
||||
|
||||
public static Dictionary<string, List<string>> translatedTravelBuffs = new Dictionary<string, List<string>>();
|
||||
|
||||
public static void DumpTravelBuffs(Il2CppSystem.Collections.Generic.Dictionary<int, string> source, Dictionary<string, List<string>> dest, string index)
|
||||
{
|
||||
foreach (var i in source)
|
||||
{
|
||||
if (!Utils.CheckForUntranslatedText(i.Value))
|
||||
{
|
||||
break;
|
||||
}
|
||||
dest[index].Add(i.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public static string MatchTravelBuff(string originalText)
|
||||
{
|
||||
string res = "";
|
||||
|
||||
foreach(var i in dumpedTravelBuffs)
|
||||
{
|
||||
if(i.Value.Contains(originalText))
|
||||
{
|
||||
res = translatedTravelBuffs[i.Key][i.Value.IndexOf(originalText)];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TravelMgr.Awake))]
|
||||
[HarmonyPrefix]
|
||||
private static void Pre_Awake(TravelMgr __instance)
|
||||
{
|
||||
// Dump buffs
|
||||
|
||||
dumpedTravelBuffs = new Dictionary<string, List<string>>() // reset dump
|
||||
{
|
||||
{ "advancedUpgrades", [] },
|
||||
{ "ultimateUpgrades", [] },
|
||||
{ "strongUltimates", [] },
|
||||
{ "debuffs", [] }
|
||||
};
|
||||
|
||||
DumpTravelBuffs(TravelMgr.advancedBuffs, dumpedTravelBuffs, "advancedUpgrades");
|
||||
DumpTravelBuffs(TravelMgr.ultimateBuffs, dumpedTravelBuffs, "ultimateUpgrades");
|
||||
DumpTravelBuffs(TravelMgr.unlocks, dumpedTravelBuffs, "strongUltimates");
|
||||
DumpTravelBuffs(TravelMgr.debuffs, dumpedTravelBuffs, "debuffs");
|
||||
|
||||
string dumpDir = FileLoader.GetAssetDir(FileLoader.AssetType.Dumps);
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
||||
WriteIndented = true
|
||||
};
|
||||
File.WriteAllText(Path.Combine(dumpDir, "travel_buffs.json"), JsonSerializer.Serialize(dumpedTravelBuffs, options));
|
||||
|
||||
string stringDir = FileLoader.GetAssetDir(FileLoader.AssetType.Strings, Utils.Language);
|
||||
string travelBuffDir = Path.Combine(stringDir, "travel_buffs.json");
|
||||
|
||||
if(!File.Exists(travelBuffDir))
|
||||
{
|
||||
File.WriteAllText(travelBuffDir, JsonSerializer.Serialize(dumpedTravelBuffs, options));
|
||||
}
|
||||
|
||||
string travelBuffs = File.ReadAllText(Path.Combine(stringDir, "travel_buffs.json"));
|
||||
|
||||
translatedTravelBuffs = JsonSerializer.Deserialize<Dictionary<string, List<string>>>(travelBuffs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ using System.Text.Json;
|
|||
using System.Text.RegularExpressions;
|
||||
using UnityEngine.TextCore.Text;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Abyss
|
||||
{
|
||||
[HarmonyPatch(typeof(AbyssBuffMenu))]
|
||||
public static class AbyssBuffMenu_Patch
|
||||
|
|
@ -98,7 +98,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
var regex = new Regex(pattern);
|
||||
var match = regex.Match(originalText);
|
||||
|
||||
return String.Format(x.Value.Replace("value", "0"), match.Groups[1].Value);
|
||||
return string.Format(x.Value.Replace("value", "0"), match.Groups[1].Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@ using Il2CppTMPro;
|
|||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects.MinorObjects
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Abyss
|
||||
{
|
||||
[HarmonyPatch(typeof(AbyssGoods))]
|
||||
public static class AbyssGoods_Patch
|
||||
|
|
@ -4,7 +4,7 @@ using Il2CppTMPro;
|
|||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects.ButtonObjects
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Abyss
|
||||
{
|
||||
[HarmonyPatch(typeof(AbyssLevelEnter))]
|
||||
public static class AbyssLevelEnter_Patch
|
||||
|
|
@ -9,7 +9,7 @@ using System.Text.RegularExpressions;
|
|||
using UnityEngine.UI;
|
||||
using MelonLoader.Utils;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Abyss
|
||||
{
|
||||
[HarmonyPatch(typeof(AbyssMenu))]
|
||||
public static class AbyssMenu_Patch
|
||||
|
|
@ -5,7 +5,7 @@ using PvZ_Fusion_Translator.AssetStore;
|
|||
using UnityEngine;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Abyss
|
||||
{
|
||||
[HarmonyPatch(typeof(AbyssSelectBuffWindow))]
|
||||
public static class AbyssSelectBuffWindow_Patch
|
||||
|
|
@ -45,7 +45,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
titleText.font = fontAsset;
|
||||
}
|
||||
|
||||
string translatedIntroduceText = (AbyssBuffMenu_Patch.abyssBuffData.ContainsKey(__instance.introduce.text)) ? AbyssBuffMenu_Patch.abyssBuffData[__instance.introduce.text] : AbyssBuffMenu_Patch.TranslateAbyssBuffRegex(__instance.introduce.text);
|
||||
string translatedIntroduceText = AbyssBuffMenu_Patch.abyssBuffData.ContainsKey(__instance.introduce.text) ? AbyssBuffMenu_Patch.abyssBuffData[__instance.introduce.text] : AbyssBuffMenu_Patch.TranslateAbyssBuffRegex(__instance.introduce.text);
|
||||
|
||||
if (translatedIntroduceText != null)
|
||||
{
|
||||
|
|
@ -3,7 +3,7 @@ using Il2Cpp;
|
|||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Abyss
|
||||
{
|
||||
[HarmonyPatch(typeof(AbyssStoreMenu))]
|
||||
public static class AbyssStoreMenu_Patch
|
||||
|
|
@ -15,26 +15,6 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
{
|
||||
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
|
||||
foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
if(txt.transform.parent.name.Contains("Close"))
|
||||
{
|
||||
txt.text = StringStore.TranslateText("合上");
|
||||
}
|
||||
else
|
||||
{
|
||||
txt.text = StringStore.TranslateText(txt.text);
|
||||
}
|
||||
txt.font = fontAsset;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(GardenBagMenu.SetTreasureCard))]
|
||||
[HarmonyPostfix]
|
||||
private static void SetTreasureCard(GardenBagMenu __instance)
|
||||
{
|
||||
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
|
||||
foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
if (txt.transform.parent.name.Contains("Close"))
|
||||
|
|
@ -48,5 +28,25 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
txt.font = fontAsset;
|
||||
}
|
||||
}
|
||||
|
||||
//[HarmonyPatch(nameof(GardenBagMenu.SetTreasureCard))]
|
||||
//[HarmonyPostfix]
|
||||
//private static void SetTreasureCard(GardenBagMenu __instance)
|
||||
//{
|
||||
// //TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
|
||||
// //foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
// //{
|
||||
// // if (txt.transform.parent.name.Contains("Close"))
|
||||
// // {
|
||||
// // txt.text = StringStore.TranslateText("合上");
|
||||
// // }
|
||||
// // else
|
||||
// // {
|
||||
// // txt.text = StringStore.TranslateText(txt.text);
|
||||
// // }
|
||||
// // txt.font = fontAsset;
|
||||
// //}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@ using Il2CppTMPro;
|
|||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Harvest
|
||||
{
|
||||
[HarmonyPatch(typeof(TreasureConfirmMenu))]
|
||||
public static class TreasureConfirmMenu_Patch
|
||||
|
|
@ -4,7 +4,7 @@ using Il2CppTMPro;
|
|||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Harvest
|
||||
{
|
||||
[HarmonyPatch(typeof(TreasureEquipmentMenu))]
|
||||
public static class TreasureEquipmentMenu_Patch
|
||||
|
|
@ -5,7 +5,7 @@ using PvZ_Fusion_Translator.AssetStore;
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Harvest
|
||||
{
|
||||
[HarmonyPatch(typeof(TreasureEvacuateMenu))]
|
||||
public static class TreasureEvacuateMenu_Patch
|
||||
|
|
@ -4,7 +4,7 @@ using Il2CppTMPro;
|
|||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Harvest
|
||||
{
|
||||
[HarmonyPatch(typeof(TreasureMainMenu))]
|
||||
public static class TreasureMainMenu_Patch
|
||||
|
|
@ -4,7 +4,7 @@ using Il2CppTMPro;
|
|||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.Managers
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Harvest
|
||||
{
|
||||
[HarmonyPatch(typeof(TreasureManager))]
|
||||
public static class TreasureManager_Patch
|
||||
|
|
@ -4,7 +4,7 @@ using Il2CppTMPro;
|
|||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Harvest
|
||||
{
|
||||
[HarmonyPatch(typeof(TreasureStoreMenu))]
|
||||
public static class TreasureStoreMenu_Patch
|
||||
|
|
@ -7,7 +7,7 @@ using System.Text.RegularExpressions;
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Harvest
|
||||
{
|
||||
[HarmonyPatch(typeof(TreasureUpgradeMenu))]
|
||||
public static class TreasureUpgradeMenu_Patch
|
||||
|
|
@ -4,7 +4,7 @@ using Il2CppTMPro;
|
|||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Harvest
|
||||
{
|
||||
[HarmonyPatch(typeof(TreasureWarehouseMenu))]
|
||||
public static class TreasureWarehouseMenu_Patch
|
||||
24
MelonLoader/Patches/Modes/Odyssey/TravelBuffMenu_Patch.cs
Normal file
24
MelonLoader/Patches/Modes/Odyssey/TravelBuffMenu_Patch.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
//using HarmonyLib;
|
||||
//using Il2Cpp;
|
||||
//using Il2CppTMPro;
|
||||
//using PvZ_Fusion_Translator.AssetStore;
|
||||
//using static PvZ_Fusion_Translator.Patches.Modes.Odyssey.TravelMgr_Patch;
|
||||
//using UnityEngine;
|
||||
//using MelonLoader;
|
||||
|
||||
//namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
|
||||
//{
|
||||
// [HarmonyPatch(typeof(TravelBuffMenu))]
|
||||
// public static class TravelBuffMenu_Patch
|
||||
// {
|
||||
// [HarmonyPatch(nameof(TravelBuffMenu.RefeshOptions))]
|
||||
// [HarmonyPostfix]
|
||||
// public static void RefeshOptions(TravelBuffMenu __instance)
|
||||
// {
|
||||
// foreach(TravelBuffOptionButton button in __instance.options)
|
||||
// {
|
||||
// TravelBuffOptionButton_Patch.TranslateOptionButton(button);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
27
MelonLoader/Patches/Modes/Odyssey/TravelBuffMgr_Patch.cs
Normal file
27
MelonLoader/Patches/Modes/Odyssey/TravelBuffMgr_Patch.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
//using HarmonyLib;
|
||||
//using Il2Cpp;
|
||||
//using System.Text.Encodings.Web;
|
||||
//using System.Text.Json;
|
||||
|
||||
//namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
|
||||
//{
|
||||
// [HarmonyPatch(typeof(TravelBuffMgr))]
|
||||
// public static class TravelBuffMgr_Patch
|
||||
// {
|
||||
// [HarmonyPatch(nameof(TravelBuffMgr.Awake))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void Awake(TravelBuffMgr __instance)
|
||||
// {
|
||||
// __instance.text = AssetStore.StringStore.TranslateText(__instance.text);
|
||||
// __instance.text2 = AssetStore.StringStore.TranslateText(__instance.text2);
|
||||
// }
|
||||
|
||||
// [HarmonyPatch(nameof(TravelBuffMgr.ShowText), new Type[] { typeof(int), typeof(int) })]
|
||||
// [HarmonyPostfix]
|
||||
// private static void ShowText(TravelBuffMgr __instance)
|
||||
// {
|
||||
// __instance.text = AssetStore.StringStore.TranslateText(__instance.text);
|
||||
// __instance.text2 = AssetStore.StringStore.TranslateText(__instance.text2);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
//using HarmonyLib;
|
||||
//using Il2Cpp;
|
||||
//using Il2CppTMPro;
|
||||
//using MelonLoader;
|
||||
//using PvZ_Fusion_Translator.AssetStore;
|
||||
//using static MelonLoader.MelonLogger;
|
||||
//using static PvZ_Fusion_Translator.Patches.Modes.Odyssey.TravelMgr_Patch;
|
||||
|
||||
//namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
|
||||
//{
|
||||
// [HarmonyPatch(typeof(TravelBuffOptionButton))]
|
||||
// public static class TravelBuffOptionButton_Patch
|
||||
// {
|
||||
// [HarmonyPatch(nameof(TravelBuffOptionButton.Awake))]
|
||||
// [HarmonyPostfix]
|
||||
// public static void Awake(TravelBuffOptionButton __instance)
|
||||
// {
|
||||
// TranslateOptionButton(__instance);
|
||||
// }
|
||||
|
||||
// [HarmonyPatch(nameof(TravelBuffOptionButton.OnAnimOver))]
|
||||
// [HarmonyPostfix]
|
||||
// public static void OnAnimOver(TravelBuffOptionButton __instance)
|
||||
// {
|
||||
// TranslateOptionButton(__instance);
|
||||
// }
|
||||
|
||||
// public static void TranslateOptionButton(TravelBuffOptionButton button)
|
||||
// {
|
||||
// List<string> buffSet = translatedTravelBuffs[buffLinks[button.buffType]];
|
||||
|
||||
// string buff = button.show != null && button.introduce.text != "词条已选完" ? buffSet[button.buffIndex] : StringStore.TranslateText("词条已选完");
|
||||
|
||||
// button.introduce.text = buff;
|
||||
// }
|
||||
// }
|
||||
|
||||
// //List<string> buffSet = translatedTravelBuffs[buffLinks[__instance.buffType]];
|
||||
// //string buff = (__instance.show != null) ? buffSet[__instance.buffIndex] : StringStore.TranslateText("无");
|
||||
// //__instance.introduce.text = buff;
|
||||
//}
|
||||
18
MelonLoader/Patches/Modes/Odyssey/TravelBuff_Patch.cs
Normal file
18
MelonLoader/Patches/Modes/Odyssey/TravelBuff_Patch.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
//using HarmonyLib;
|
||||
//using Il2Cpp;
|
||||
|
||||
//namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
|
||||
//{
|
||||
// [HarmonyPatch(typeof(TravelBuff))]
|
||||
// public static class TravelBuff_Patch
|
||||
// {
|
||||
// [HarmonyPatch(nameof(TravelBuff.OnMouseUpAsButton))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void OnMouseUpAsButton()
|
||||
// {
|
||||
// if (TravelBuffMgr.Instance == null) return;
|
||||
// TravelBuffMgr.Instance.text = AssetStore.StringStore.TranslateText(TravelBuffMgr.Instance.text);
|
||||
// TravelBuffMgr.Instance.text2 = AssetStore.StringStore.TranslateText(TravelBuffMgr.Instance.text2);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
51
MelonLoader/Patches/Modes/Odyssey/TravelLookBuff_Patch.cs
Normal file
51
MelonLoader/Patches/Modes/Odyssey/TravelLookBuff_Patch.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
//using HarmonyLib;
|
||||
//using Il2Cpp;
|
||||
//using Il2CppTMPro;
|
||||
//using PvZ_Fusion_Translator.AssetStore;
|
||||
//using static PvZ_Fusion_Translator.Patches.Modes.Odyssey.TravelMgr_Patch;
|
||||
//using UnityEngine;
|
||||
//using MelonLoader;
|
||||
|
||||
//namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
|
||||
//{
|
||||
// [HarmonyPatch(typeof(TravelLookBuff))]
|
||||
// public static class TravelLookBuff_Patch
|
||||
// {
|
||||
// [HarmonyPatch(nameof(TravelLookBuff.Clear))]
|
||||
// [HarmonyPostfix]
|
||||
// public static void Post_Clear(TravelLookBuff __instance)
|
||||
// {
|
||||
// __instance.introduce.text = StringStore.TranslateText("无");
|
||||
// __instance.set = false;
|
||||
|
||||
// foreach (TextMeshProUGUI text in __instance.transform.FindChild("Images").FindChild("Button").GetComponentsInChildren<TextMeshProUGUI>())
|
||||
// {
|
||||
// text.text = StringStore.TranslateText(text.text);
|
||||
// }
|
||||
// }
|
||||
|
||||
// [HarmonyPatch(nameof(TravelLookBuff.OnMouseUpAsButton))]
|
||||
// [HarmonyPostfix]
|
||||
// public static void Post_OnMouseUpAsButton(TravelLookBuff __instance)
|
||||
// {
|
||||
// foreach (TextMeshProUGUI text in __instance.transform.FindChild("Images").FindChild("Button").GetComponentsInChildren<TextMeshProUGUI>())
|
||||
// {
|
||||
// text.text = StringStore.TranslateText(text.text);
|
||||
// }
|
||||
// }
|
||||
|
||||
// [HarmonyPatch(nameof(TravelLookBuff.SetBuff))]
|
||||
// [HarmonyPostfix]
|
||||
// public static void Post_SetBuff(TravelLookBuff __instance)
|
||||
// {
|
||||
// List<string> buffSet = translatedTravelBuffs[buffLinks[__instance.buffType]];
|
||||
// string buffText = __instance.buffIndex < buffSet.Count ? buffSet[__instance.buffIndex] : StringStore.TranslateText(__instance.introduce.text);
|
||||
// __instance.introduce.text = buffText;
|
||||
|
||||
// foreach (TextMeshProUGUI text in __instance.transform.FindChild("Images").FindChild("Button").GetComponentsInChildren<TextMeshProUGUI>())
|
||||
// {
|
||||
// text.text = StringStore.TranslateText(text.text);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
46
MelonLoader/Patches/Modes/Odyssey/TravelLookMenu_Patch.cs
Normal file
46
MelonLoader/Patches/Modes/Odyssey/TravelLookMenu_Patch.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
//using HarmonyLib;
|
||||
//using Il2Cpp;
|
||||
//using Il2CppTMPro;
|
||||
//using PvZ_Fusion_Translator.AssetStore;
|
||||
//using UnityEngine;
|
||||
|
||||
//namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
|
||||
//{
|
||||
// [HarmonyPatch(typeof(TravelLookMenu))]
|
||||
// public static class TravelLookMenu_Patch
|
||||
// {
|
||||
// public static string savedAssetString = "";
|
||||
|
||||
// [HarmonyPatch(nameof(TravelLookMenu.Start))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void Postfix_Start(TravelLookMenu __instance)
|
||||
// {
|
||||
// foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
// {
|
||||
// txt.text = StringStore.TranslateText(txt.text);
|
||||
// txt.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
// }
|
||||
|
||||
// Transform quitButtonTransform = __instance.transform.Find("Quit");
|
||||
// foreach (TextMeshProUGUI txt in quitButtonTransform.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
// {
|
||||
// txt.text = StringStore.TranslateText("合上");
|
||||
// txt.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
// }
|
||||
|
||||
// __instance.treasureText.text = StringStore.TranslateText(__instance.treasureText.text);
|
||||
// savedAssetString = __instance.treasureText.text;
|
||||
// }
|
||||
|
||||
// [HarmonyPatch(nameof(TravelLookMenu.Update))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void Update(TravelLookMenu __instance)
|
||||
// {
|
||||
// if (savedAssetString != __instance.treasureText.text)
|
||||
// {
|
||||
// __instance.treasureText.text = StringStore.TranslateText(__instance.treasureText.text);
|
||||
// savedAssetString = __instance.treasureText.text;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
102
MelonLoader/Patches/Modes/Odyssey/TravelMgr_Patch.cs
Normal file
102
MelonLoader/Patches/Modes/Odyssey/TravelMgr_Patch.cs
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
//using Il2Cpp;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Text.Encodings.Web;
|
||||
//using System.Text.Json;
|
||||
//using System.Threading.Tasks;
|
||||
//using HarmonyLib;
|
||||
|
||||
//namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
|
||||
//{
|
||||
// [HarmonyPatch(typeof(TravelMgr))]
|
||||
// public static class TravelMgr_Patch
|
||||
// {
|
||||
// public static Dictionary<BuffType, string> buffLinks = new Dictionary<BuffType, string>()
|
||||
// {
|
||||
// { BuffType.AdvancedBuff, "advancedUpgrades" },
|
||||
// { BuffType.UltimateBuff, "ultimateUpgrades" },
|
||||
// { BuffType.UnlockPlant, "strongUltimates" },
|
||||
// { BuffType.Debuff, "debuffs" },
|
||||
// };
|
||||
|
||||
// public static Dictionary<string, List<string>> dumpedTravelBuffs = new Dictionary<string, List<string>>()
|
||||
// {
|
||||
// { "advancedUpgrades", [] },
|
||||
// { "ultimateUpgrades", [] },
|
||||
// { "strongUltimates", [] },
|
||||
// { "debuffs", [] }
|
||||
// };
|
||||
|
||||
// public static Dictionary<string, List<string>> translatedTravelBuffs = new Dictionary<string, List<string>>();
|
||||
|
||||
// public static void DumpTravelBuffs(Il2CppSystem.Collections.Generic.Dictionary<int, string> source, Dictionary<string, List<string>> dest, string index)
|
||||
// {
|
||||
// foreach (var i in source)
|
||||
// {
|
||||
// if (!Utils.CheckForUntranslatedText(i.Value))
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
// dest[index].Add(i.Value);
|
||||
// }
|
||||
// }
|
||||
|
||||
// public static string MatchTravelBuff(string originalText)
|
||||
// {
|
||||
// string res = "";
|
||||
|
||||
// foreach(var i in dumpedTravelBuffs)
|
||||
// {
|
||||
// if(i.Value.Contains(originalText))
|
||||
// {
|
||||
// res = translatedTravelBuffs[i.Key][i.Value.IndexOf(originalText)];
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// return res;
|
||||
// }
|
||||
|
||||
// [HarmonyPatch(nameof(TravelMgr.Awake))]
|
||||
// [HarmonyPrefix]
|
||||
// private static void Pre_Awake(TravelMgr __instance)
|
||||
// {
|
||||
// // Dump buffs
|
||||
|
||||
// dumpedTravelBuffs = new Dictionary<string, List<string>>() // reset dump
|
||||
// {
|
||||
// { "advancedUpgrades", [] },
|
||||
// { "ultimateUpgrades", [] },
|
||||
// { "strongUltimates", [] },
|
||||
// { "debuffs", [] }
|
||||
// };
|
||||
|
||||
// DumpTravelBuffs(TravelMgr.advancedBuffs, dumpedTravelBuffs, "advancedUpgrades");
|
||||
// DumpTravelBuffs(TravelMgr.ultimateBuffs, dumpedTravelBuffs, "ultimateUpgrades");
|
||||
// DumpTravelBuffs(TravelMgr.unlocks, dumpedTravelBuffs, "strongUltimates");
|
||||
// DumpTravelBuffs(TravelMgr.debuffs, dumpedTravelBuffs, "debuffs");
|
||||
|
||||
// string dumpDir = FileLoader.GetAssetDir(FileLoader.AssetType.Dumps);
|
||||
// var options = new JsonSerializerOptions
|
||||
// {
|
||||
// Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
||||
// WriteIndented = true
|
||||
// };
|
||||
// File.WriteAllText(Path.Combine(dumpDir, "travel_buffs.json"), JsonSerializer.Serialize(dumpedTravelBuffs, options));
|
||||
|
||||
// string stringDir = FileLoader.GetAssetDir(FileLoader.AssetType.Strings, Utils.Language);
|
||||
// string travelBuffDir = Path.Combine(stringDir, "travel_buffs.json");
|
||||
|
||||
// if(!File.Exists(travelBuffDir))
|
||||
// {
|
||||
// File.WriteAllText(travelBuffDir, JsonSerializer.Serialize(dumpedTravelBuffs, options));
|
||||
// }
|
||||
|
||||
// string travelBuffs = File.ReadAllText(Path.Combine(stringDir, "travel_buffs.json"));
|
||||
|
||||
// translatedTravelBuffs = JsonSerializer.Deserialize<Dictionary<string, List<string>>>(travelBuffs);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
28
MelonLoader/Patches/Modes/Odyssey/TravelRefresh_Patch.cs
Normal file
28
MelonLoader/Patches/Modes/Odyssey/TravelRefresh_Patch.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
//using HarmonyLib;
|
||||
//using Il2Cpp;
|
||||
//using Il2CppTMPro;
|
||||
//using PvZ_Fusion_Translator.AssetStore;
|
||||
//using UnityEngine;
|
||||
|
||||
//namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
|
||||
//{
|
||||
// [HarmonyPatch(typeof(TravelRefresh))]
|
||||
// public static class TravelRefresh_Patch
|
||||
// {
|
||||
// [HarmonyPatch(nameof(TravelRefresh.Start))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void Start(TravelRefresh __instance)
|
||||
// {
|
||||
// __instance.text = StringStore.TranslateText(__instance.text);
|
||||
// __instance.text_shadow = StringStore.TranslateText(__instance.text_shadow);
|
||||
// }
|
||||
|
||||
// [HarmonyPatch(nameof(TravelRefresh.OnMouseUpAsButton))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void OnMouseUpAsButton(TravelRefresh __instance)
|
||||
// {
|
||||
// __instance.text = StringStore.TranslateText(__instance.text);
|
||||
// __instance.text_shadow = StringStore.TranslateText(__instance.text_shadow);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
70
MelonLoader/Patches/Modes/Odyssey/TravelStore_Patch.cs
Normal file
70
MelonLoader/Patches/Modes/Odyssey/TravelStore_Patch.cs
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
//using HarmonyLib;
|
||||
//using Il2Cpp;
|
||||
//using Il2CppTMPro;
|
||||
//using PvZ_Fusion_Translator.AssetStore;
|
||||
//using static PvZ_Fusion_Translator.Patches.Modes.Odyssey.TravelMgr_Patch;
|
||||
//using UnityEngine;
|
||||
|
||||
//namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
|
||||
//{
|
||||
// [HarmonyPatch(typeof(TravelStore))]
|
||||
// public static class TravelStore_Patch
|
||||
// {
|
||||
// [HarmonyPatch(nameof(TravelStore.Update))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void Update(TravelStore __instance)
|
||||
// {
|
||||
// foreach(TextMeshProUGUI text in __instance.introduces)
|
||||
// {
|
||||
// if(__instance.currentSelect != null)
|
||||
// {
|
||||
// var buffList = translatedTravelBuffs[buffLinks[(BuffType)__instance.currentSelect.theBuffType]];
|
||||
// if(__instance.currentSelect.theBuffNumber < buffList.Count && __instance.currentSelect.theBuffNumber > -1)
|
||||
// {
|
||||
// text.text = buffList[__instance.currentSelect.theBuffNumber];
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// text.text = StringStore.TranslateText(text.text);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// foreach (var textMesh in __instance.points)
|
||||
// {
|
||||
// textMesh.text = StringStore.TranslateText(textMesh.text);
|
||||
// }
|
||||
// }
|
||||
|
||||
// [HarmonyPatch(nameof(TravelStore.RefreshBuff))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void RefreshBuff(TravelStore __instance)
|
||||
// {
|
||||
// foreach (TravelBuff buff in __instance.travelBuffs)
|
||||
// {
|
||||
// TextMeshProUGUI cost = buff.transform.GetChild(1).GetComponent<TextMeshProUGUI>();
|
||||
// cost.text = StringStore.TranslateText(cost.text);
|
||||
// cost.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
// }
|
||||
|
||||
// foreach (TextMeshProUGUI text in __instance.introduces)
|
||||
// {
|
||||
// if (__instance.currentSelect != null)
|
||||
// {
|
||||
// var buffList = translatedTravelBuffs[buffLinks[(BuffType)__instance.currentSelect.theBuffType]];
|
||||
// if (__instance.currentSelect.theBuffNumber < buffList.Count && __instance.currentSelect.theBuffNumber > -1)
|
||||
// {
|
||||
// text.text = buffList[__instance.currentSelect.theBuffNumber];
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// text.text = StringStore.TranslateText(text.text);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// foreach (var textMesh in __instance.points)
|
||||
// {
|
||||
// textMesh.text = StringStore.TranslateText(textMesh.text);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
@ -4,7 +4,7 @@ using Il2CppTMPro;
|
|||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Starbound
|
||||
{
|
||||
[HarmonyPatch(typeof(AdvantureEvolutionMenu))]
|
||||
public static class AdvantureEvolutionMenu_Patch
|
||||
|
|
@ -3,7 +3,7 @@ using Il2Cpp;
|
|||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Starbound
|
||||
{
|
||||
[HarmonyPatch(typeof(AdvantureHelpMenu))]
|
||||
public static class AdvantureHelpMenu_Patch
|
||||
|
|
@ -3,7 +3,7 @@ using Il2Cpp;
|
|||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Starbound
|
||||
{
|
||||
[HarmonyPatch(typeof(AdvantureMenu2))]
|
||||
public static class AdvantureMenu2_Patch
|
||||
|
|
@ -3,7 +3,7 @@ using Il2Cpp;
|
|||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Starbound
|
||||
{
|
||||
[HarmonyPatch(typeof(AdvantureMenu))]
|
||||
public static class AdvantureMenu_Patch
|
||||
|
|
@ -3,7 +3,7 @@ using Il2Cpp;
|
|||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Starbound
|
||||
{
|
||||
[HarmonyPatch(typeof(AdvantureMissionMenu))]
|
||||
public static class AdvantureMissionMenu_Patch
|
||||
|
|
@ -3,7 +3,7 @@ using Il2Cpp;
|
|||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Starbound
|
||||
{
|
||||
[HarmonyPatch(typeof(AdvantureStarMenu))]
|
||||
public static class AdvantureStarMenu_Patch
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
<LangVersion>latest</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Configurations>Debug;DebugEnglish;ReleaseMulti;ReleaseEnglish;DebugTesting;ReleaseOther;DebugObfuscate;ReleaseObfuscate</Configurations>
|
||||
<GamePath>C:\Users\rainb\Desktop\PC_PVZ-Fusion_3.3.1</GamePath>
|
||||
<GamePath>C:\Users\rainb\Desktop\PC_PVZ-Fusion_3.4.1</GamePath>
|
||||
<Platforms>AnyCPU;ARM64;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
@ -475,12 +475,12 @@
|
|||
<Compile Include="Patches\GameObjects\AbyssDevelopMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\AbyssMenu2_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\AbyssMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TravelBuffMenu_Patch.cs" />
|
||||
<Compile Include="Patches\Modes\Odyssey\TravelBuffMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TowerUpgradeMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TowerOption_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TravelLookBuff_Patch.cs" />
|
||||
<Compile Include="Patches\Modes\Odyssey\TravelLookBuff_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\ShootingMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TravelLookMenu_Patch.cs" />
|
||||
<Compile Include="Patches\Modes\Odyssey\TravelLookMenu_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\AbyssBuffData_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\AbyssInfo_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\ChessManager_Patch.cs" />
|
||||
|
|
@ -488,11 +488,11 @@
|
|||
<Compile Include="Patches\Managers\Garden_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\DrawCardManager_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\CanvasUpUI_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\TravelMgr_Patch.cs" />
|
||||
<Compile Include="Patches\Modes\Odyssey\TravelMgr_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\TreasureManager_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\TowerManager_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\SaveMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TravelBuffOptionButton_Patch.cs" />
|
||||
<Compile Include="Patches\Modes\Odyssey\TravelBuffOptionButton_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" />
|
||||
|
|
@ -518,10 +518,10 @@
|
|||
<Compile Include="Patches\BaseTextObjects\TextMeshPro_Patch.cs" />
|
||||
<Compile Include="Patches\BaseTextObjects\TextMeshProUGUI_Patch.cs" />
|
||||
<Compile Include="Patches\BaseTextObjects\TMP_InputField_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\TravelBuffMgr_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TravelBuff_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TravelRefresh_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TravelStore_Patch.cs" />
|
||||
<Compile Include="Patches\Modes\Odyssey\TravelBuffMgr_Patch.cs" />
|
||||
<Compile Include="Patches\Modes\Odyssey\TravelBuff_Patch.cs" />
|
||||
<Compile Include="Patches\Modes\Odyssey\TravelRefresh_Patch.cs" />
|
||||
<Compile Include="Patches\Modes\Odyssey\TravelStore_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\UIDifficulty_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\UIZombieNum_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\MinorObjects\Plant_Patch.cs" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue