odyssey/investment bugfixes
This commit is contained in:
parent
4f532e7b49
commit
2901758559
10 changed files with 126 additions and 40 deletions
|
|
@ -240,7 +240,7 @@ namespace PvZ_Fusion_Translator.AssetStore
|
|||
public static string TranslateColorSegments(string input)
|
||||
{
|
||||
string result = "";
|
||||
string pattern = @"<color=[^>]+>[\s\S]*?<\/color>|(?:<(?!color=)|[^<])+";
|
||||
string pattern = @"<color=[^>]+>[\s\S]*?(?:<\/color>|$)|(?:<(?!color=)|[^<])+";
|
||||
string smallPattern = @"(<color=[^>]+>)(.*?)(</color>)";
|
||||
MatchCollection matches = Regex.Matches(input, pattern);
|
||||
|
||||
|
|
@ -254,8 +254,8 @@ namespace PvZ_Fusion_Translator.AssetStore
|
|||
else
|
||||
{
|
||||
result += DoTranslateText(match.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
33
MelonLoader/Patches/Modes/Odyssey/SynergyDisplay_Patch.cs
Normal file
33
MelonLoader/Patches/Modes/Odyssey/SynergyDisplay_Patch.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
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(SynergyDisplay))]
|
||||
public static class SynergyDisplay_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(SynergyDisplay.Start))]
|
||||
[HarmonyPostfix]
|
||||
public static void Start(SynergyDisplay __instance)
|
||||
{
|
||||
__instance.text1.text = TranslateInvestDisplay(__instance.text1.text);
|
||||
__instance.text_shadow.text = Utils.RemoveColorTags(__instance.text1.text);
|
||||
}
|
||||
|
||||
public static string TranslateInvestDisplay(string originalText)
|
||||
{
|
||||
string[] parts = originalText.Split("\n\n");
|
||||
List<string> translatedParts = new List<string>();
|
||||
foreach(string part in parts)
|
||||
{
|
||||
translatedParts.Add(StringStore.TranslateColorText(part));
|
||||
}
|
||||
return String.Join("\n\n", translatedParts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -20,5 +20,16 @@ namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
|
|||
TravelBuffOptionButton_Patch.TranslateOptionButton(button);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TravelBuffMenu.Awake))]
|
||||
[HarmonyPostfix]
|
||||
public static void Awake(TravelBuffMenu __instance)
|
||||
{
|
||||
Transform refreshTransform = __instance.transform.Find("Refresh");
|
||||
foreach (TextMeshProUGUI text in refreshTransform.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -21,5 +21,12 @@ namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
|
|||
|
||||
shadowText.text = Utils.RemoveColorTags(regularText.text);
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TravelInvestMenu.RefreshBuff))]
|
||||
[HarmonyPostfix]
|
||||
private static void RefreshBuff(TravelInvestMenu __instance, ref TravelBuffOptionButton option)
|
||||
{
|
||||
TravelBuffOptionButton_Patch.TranslateOptionButton(option);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using System.Text.Encodings.Web;
|
|||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Unity.Collections;
|
||||
using UnityEngine.Rendering;
|
||||
using static PvZ_Fusion_Translator.FileLoader;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
|
||||
|
|
@ -94,13 +95,13 @@ namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
|
|||
{
|
||||
string res = "";
|
||||
|
||||
foreach (var i in translatedTravelBuffs)
|
||||
foreach (var i in dumpedTravelBuffs)
|
||||
{
|
||||
foreach (var j in translatedTravelBuffs[i.Key])
|
||||
foreach (var j in dumpedTravelBuffs[i.Key])
|
||||
{
|
||||
if (j.Value == originalText)
|
||||
if (j.Value == originalText || j.Value == RemoveBuffName(originalText))
|
||||
{
|
||||
res = j.Value;
|
||||
res = translatedTravelBuffs[i.Key][j.Key];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -110,5 +111,16 @@ namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
|
|||
|
||||
return res;
|
||||
}
|
||||
|
||||
public static string RemoveBuffName(string buffText)
|
||||
{
|
||||
string res = buffText;
|
||||
int firstColon = res.IndexOf(":");
|
||||
if(firstColon > 0)
|
||||
{
|
||||
res = res.Substring(firstColon + 1);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,28 @@
|
|||
//using HarmonyLib;
|
||||
//using Il2Cpp;
|
||||
//using Il2CppTMPro;
|
||||
//using PvZ_Fusion_Translator.AssetStore;
|
||||
//using UnityEngine;
|
||||
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);
|
||||
// }
|
||||
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);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
[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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,13 @@ namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
|
|||
[HarmonyPatch(typeof(TravelStore))]
|
||||
public static class TravelStore_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(TravelStore.Start))]
|
||||
[HarmonyPostfix]
|
||||
private static void Start(TravelStore __instance)
|
||||
{
|
||||
TranslateStoreText(__instance);
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TravelStore.Update))]
|
||||
[HarmonyPostfix]
|
||||
private static void Update(TravelStore __instance)
|
||||
|
|
@ -24,6 +31,21 @@ namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
|
|||
TranslateStoreText(__instance);
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TravelStore.SelectBuff))]
|
||||
[HarmonyPostfix]
|
||||
private static void SelectBuff(TravelStore __instance, ref TravelStoreWindow window)
|
||||
{
|
||||
TranslateStoreText(__instance);
|
||||
|
||||
foreach (var text in window.buttonText)
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
}
|
||||
|
||||
__instance.investText.text = TranslateInvestText(__instance.investText.text);
|
||||
__instance.investTextshadow.text = TranslateInvestText(__instance.investTextshadow.text);
|
||||
}
|
||||
|
||||
public static void TranslateStoreText(TravelStore __instance)
|
||||
{
|
||||
__instance.investText.text = TranslateInvestText(__instance.investText.text);
|
||||
|
|
@ -51,7 +73,13 @@ namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
|
|||
List<string> translatedInvestStats = new List<string>();
|
||||
foreach(string investStat in investStats)
|
||||
{
|
||||
string translatedInvestStat = StringStore.TranslateText(investStat);
|
||||
string[] lines = investStat.Split("\n");
|
||||
List<string> translatedLines = new List<string>();
|
||||
foreach(string line in lines)
|
||||
{
|
||||
translatedLines.Add(StringStore.TranslateColorText(line));
|
||||
}
|
||||
string translatedInvestStat = String.Join("\n", translatedLines);
|
||||
translatedInvestStats.Add(translatedInvestStat);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
|
|||
}
|
||||
else
|
||||
{
|
||||
FileLoader.DumpUntranslatedStrings(match.Value);
|
||||
translatedDescription += TranslateSegment(match.Value) + "\n";
|
||||
}
|
||||
}
|
||||
|
|
@ -75,8 +74,6 @@ namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
|
|||
string[] lines = part.Split('\n');
|
||||
if(lines.Length > 1)
|
||||
{
|
||||
FileLoader.DumpUntranslatedStrings(lines[0]);
|
||||
FileLoader.DumpUntranslatedStrings(lines[1]);
|
||||
temp = StringStore.TranslateText(lines[0]) + "\n" + StringStore.TranslateText(lines[1]);
|
||||
}
|
||||
res += temp + "\n";
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ namespace PvZ_Fusion_Translator.Patches.Modes.Starbound
|
|||
{
|
||||
foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
FileLoader.DumpUntranslatedStrings(text.text);
|
||||
text.text = StringStore.TranslateColorText(text.text);
|
||||
}
|
||||
}
|
||||
|
|
@ -61,7 +60,6 @@ namespace PvZ_Fusion_Translator.Patches.Modes.Starbound
|
|||
{
|
||||
foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
FileLoader.DumpUntranslatedStrings(text.text);
|
||||
text.text = StringStore.TranslateColorText(text.text);
|
||||
}
|
||||
}
|
||||
|
|
@ -72,7 +70,6 @@ namespace PvZ_Fusion_Translator.Patches.Modes.Starbound
|
|||
{
|
||||
foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
FileLoader.DumpUntranslatedStrings(text.text);
|
||||
text.text = StringStore.TranslateColorText(text.text);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -402,6 +402,7 @@
|
|||
<Compile Include="AssetStore\AudioStore.cs" />
|
||||
<Compile Include="Patches\Modes\Abyss\AbyssBuffMenu_Patch.cs" />
|
||||
<Compile Include="Patches\Modes\Odyssey\TravelInvestMenu_Patch.cs" />
|
||||
<Compile Include="Patches\Modes\Odyssey\SynergyDisplay_Patch.cs" />
|
||||
<Compile Include="Patches\Modes\Odyssey\TravelStoreWindow_Patch.cs" />
|
||||
<Compile Include="Patches\Modes\Odyssey\TravelSynergyMenu_Patch.cs" />
|
||||
<Compile Include="Patches\Modes\Starbound\AdvantureEvolutionMenu_Patch.cs" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue