From 835f75a38ba87d83eafe2db79b1abe43a606f4ca Mon Sep 17 00:00:00 2001
From: SillyStar-Github <90102598+SillyStar-Github@users.noreply.github.com>
Date: Sat, 17 Jan 2026 22:05:39 -0500
Subject: [PATCH 01/10] 3.3.0 start
---
.gitignore | 119 ++++++++++++++++++
.../BaseTextObjects/InGameText_Patch.cs | 41 +++---
.../GameObjects/AlmanacPlantWindow_Patch.cs | 1 +
.../GameObjects/AlmanacZombieWindow_Patch.cs | 1 +
...PvZ Fusion Translator [MelonLoader].csproj | 2 +-
PvZ Fusion Translator.sln | 100 +++++++--------
6 files changed, 188 insertions(+), 76 deletions(-)
diff --git a/.gitignore b/.gitignore
index 8c7d99d..e067033 100644
--- a/.gitignore
+++ b/.gitignore
@@ -133,3 +133,122 @@ MelonLoader/bin/x64/Debug/net6.0/WebSocketDotNet.dll
/BepInEx/bin/Debug/net6.0
.HOWTO-sync-MelonLoader-from-origin-main.txt
/MelonLoader/bin/ReleaseMulti/net6.0
+MelonLoader/bin/Debug/net6.0/WebSocketDotNet.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.XRModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.WindModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.VRModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.VideoModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.VFXModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.VehiclesModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.UnityWebRequestWWWModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.UnityWebRequestTextureModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.UnityWebRequestModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.UnityWebRequestAudioModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.UnityWebRequestAssetBundleModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.UnityTestProtocolModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.UnityCurlModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.UnityConnectModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.UnityAnalyticsModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.UnityAnalyticsCommonModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.UmbraModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.UIModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.UIElementsModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.UI.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.TLSModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.TilemapModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.TextRenderingModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.TextCoreTextEngineModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.TextCoreFontEngineModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.TerrainPhysicsModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.TerrainModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.SubsystemsModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.SubstanceModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.StreamingModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.SpriteShapeModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.SpriteMaskModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.SharedInternalsModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.ScreenCaptureModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.PropertiesModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.ProfilerModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.PhysicsModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.Physics2DModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.PerformanceReportingModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.ParticleSystemModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.LocalizationModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.JSONSerializeModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.InputModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.InputLegacyModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.IMGUIModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.ImageConversionModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.HotReloadModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.GridModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.GIModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.GameCenterModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.DSPGraphModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.DirectorModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.CrashReportingModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.CoreModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.ContentLoadModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.ClothModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.AudioModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.AssetBundleModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.ARModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.AnimationModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.AndroidJNIModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.AIModule.dll
+MelonLoader/bin/Debug/net6.0/UnityEngine.AccessibilityModule.dll
+MelonLoader/bin/Debug/net6.0/Unity.VisualScripting.Core.dll
+MelonLoader/bin/Debug/net6.0/Unity.TextMeshPro.dll
+MelonLoader/bin/Debug/net6.0/Unity.RenderPipelines.Universal.Runtime.dll
+MelonLoader/bin/Debug/net6.0/Unity.RenderPipelines.Core.Runtime.dll
+MelonLoader/bin/Debug/net6.0/Unity.RenderPipeline.Universal.ShaderLibrary.dll
+MelonLoader/bin/Debug/net6.0/Unity.Mathematics.dll
+MelonLoader/bin/Debug/net6.0/Unity.InternalAPIEngineBridge.001.dll
+MelonLoader/bin/Debug/net6.0/Unity.Collections.LowLevel.ILSupport.dll
+MelonLoader/bin/Debug/net6.0/Unity.Collections.dll
+MelonLoader/bin/Debug/net6.0/Unity.Burst.Unsafe.dll
+MelonLoader/bin/Debug/net6.0/Unity.Burst.dll
+MelonLoader/bin/Debug/net6.0/Unity.2D.SpriteShape.Runtime.dll
+MelonLoader/bin/Debug/net6.0/Unity.2D.Common.Runtime.dll
+MelonLoader/bin/Debug/net6.0/Unity.2D.Animation.Runtime.dll
+MelonLoader/bin/Debug/net6.0/Tomlet.dll
+MelonLoader/bin/Debug/net6.0/PvZ_Fusion_Translator.pdb
+MelonLoader/bin/Debug/net6.0/PvZ_Fusion_Translator.dll
+MelonLoader/bin/Debug/net6.0/PvZ_Fusion_Translator.deps.json
+MelonLoader/bin/Debug/net6.0/MonoMod.Utils.dll
+MelonLoader/bin/Debug/net6.0/MonoMod.RuntimeDetour.dll
+MelonLoader/bin/Debug/net6.0/MonoMod.ILHelpers.dll
+MelonLoader/bin/Debug/net6.0/MonoMod.Backports.dll
+MelonLoader/bin/Debug/net6.0/Mono.Cecil.Rocks.dll
+MelonLoader/bin/Debug/net6.0/Mono.Cecil.Pdb.dll
+MelonLoader/bin/Debug/net6.0/Mono.Cecil.Mdb.dll
+MelonLoader/bin/Debug/net6.0/Mono.Cecil.dll
+MelonLoader/bin/Debug/net6.0/Microsoft.Extensions.Logging.Abstractions.dll
+MelonLoader/bin/Debug/net6.0/Microsoft.Diagnostics.Runtime.dll
+MelonLoader/bin/Debug/net6.0/Microsoft.Diagnostics.NETCore.Client.dll
+MelonLoader/bin/Debug/net6.0/MelonLoader.xml
+MelonLoader/bin/Debug/net6.0/MelonLoader.pdb
+MelonLoader/bin/Debug/net6.0/MelonLoader.dll
+MelonLoader/bin/Debug/net6.0/Il2CppSystem.Xml.dll
+MelonLoader/bin/Debug/net6.0/Il2CppSystem.dll
+MelonLoader/bin/Debug/net6.0/Il2CppSystem.Core.dll
+MelonLoader/bin/Debug/net6.0/Il2CppSystem.Configuration.dll
+MelonLoader/bin/Debug/net6.0/Il2Cppmscorlib.dll
+MelonLoader/bin/Debug/net6.0/Il2CppMono.Security.dll
+MelonLoader/bin/Debug/net6.0/Il2CppInterop.Runtime.dll
+MelonLoader/bin/Debug/net6.0/Il2CppInterop.HarmonySupport.dll
+MelonLoader/bin/Debug/net6.0/Il2CppInterop.Generator.dll
+MelonLoader/bin/Debug/net6.0/Il2CppInterop.Common.dll
+MelonLoader/bin/Debug/net6.0/Il2Cpp__Generated.dll
+MelonLoader/bin/Debug/net6.0/bHapticsLib.dll
+MelonLoader/bin/Debug/net6.0/AudioImportLib.dll
+MelonLoader/bin/Debug/net6.0/AssetsTools.NET.dll
+MelonLoader/bin/Debug/net6.0/AssetRipper.Primitives.dll
+MelonLoader/bin/Debug/net6.0/Assembly-CSharp.dll
+MelonLoader/bin/Debug/net6.0/AsmResolver.PE.File.dll
+MelonLoader/bin/Debug/net6.0/AsmResolver.PE.dll
+MelonLoader/bin/Debug/net6.0/AsmResolver.DotNet.dll
+MelonLoader/bin/Debug/net6.0/AsmResolver.dll
+MelonLoader/bin/Debug/net6.0/0Harmony.dll
diff --git a/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs b/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
index 2cd2294..d45e8ee 100644
--- a/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
+++ b/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
@@ -3,41 +3,32 @@ using Il2Cpp;
using Il2CppTMPro;
using PvZ_Fusion_Translator.AssetStore;
using PvZ_Fusion_Translator.Patches.Managers;
+using UnityEngine.TextCore.Text;
namespace PvZ_Fusion_Translator.Patches.BaseTextObjects
{
[HarmonyPatch(typeof(InGameText))]
public static class InGameText_Patch
{
- [HarmonyPatch(nameof(InGameText.ShowText), new Type[] { typeof(string), typeof(float), typeof(bool) })]
- [HarmonyPrefix]
- private static void ShowText(InGameText __instance, ref string text) => text = StringStore.TranslateText(text, true);
+ [HarmonyPatch(nameof(InGameText.ShowText))]
+ public static void ShowText(InGameText __instance)
+ {
+ TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
- [HarmonyPatch(nameof(InGameText.ShowText), new Type[] { typeof(string), typeof(float), typeof(bool) })]
- [HarmonyPostfix]
- private static void ShowText(InGameText __instance)
- {
+ foreach (TextMeshProUGUI txt in __instance.textMeshes)
+ {
+ string travelMatch = TravelMgr_Patch.MatchTravelBuff(txt.text);
- #if MULTI_LANGUAGE
- TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
- #else
- TMP_FontAsset fontAsset = FontStore.LoadTMPFont();
- #endif
-
- foreach (TextMeshProUGUI txt in __instance.textMeshes)
- {
- string travelMatch = TravelMgr_Patch.MatchTravelBuff(txt.text);
-
- if(travelMatch != "")
- {
- txt.text = travelMatch;
- }
- else
- {
+ if (travelMatch != "")
+ {
+ txt.text = travelMatch;
+ }
+ else
+ {
txt.text = StringStore.TranslateText(txt.text, true);
}
txt.font = fontAsset;
- }
- }
+ }
+ }
}
}
\ No newline at end of file
diff --git a/MelonLoader/Patches/GameObjects/AlmanacPlantWindow_Patch.cs b/MelonLoader/Patches/GameObjects/AlmanacPlantWindow_Patch.cs
index ff1cdd6..30e24fe 100644
--- a/MelonLoader/Patches/GameObjects/AlmanacPlantWindow_Patch.cs
+++ b/MelonLoader/Patches/GameObjects/AlmanacPlantWindow_Patch.cs
@@ -52,6 +52,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
char[] toTrim = Environment.NewLine.ToCharArray();
__instance.showedPlantIntroduce.text = Utils.RemoveSizeTags(plantInfo.info) + "\n\n" + Utils.RemoveSizeTags(plantInfo.introduce) + "\n\n" + Utils.RemoveSizeTags(plantInfo.cost).TrimStart(toTrim) + "\n\n";
__instance.showedPlantIntroduce.font = fontAsset;
+ __instance.showedPlantIntroduce.fontSizeMax = 21;
__instance.showedPlantIntroduce.margin = new Vector4(6, 2, 12, 0);
__instance.showedPlantIntroduce.enableWordWrapping = true;
diff --git a/MelonLoader/Patches/GameObjects/AlmanacZombieWindow_Patch.cs b/MelonLoader/Patches/GameObjects/AlmanacZombieWindow_Patch.cs
index 707f270..57c475a 100644
--- a/MelonLoader/Patches/GameObjects/AlmanacZombieWindow_Patch.cs
+++ b/MelonLoader/Patches/GameObjects/AlmanacZombieWindow_Patch.cs
@@ -51,6 +51,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
__instance.showedZombieIntroduce.text = Utils.RemoveSizeTags(zombieInfo.info) + "\n\n" + Utils.RemoveSizeTags(zombieInfo.introduce) + "\n\n";
__instance.showedZombieIntroduce.font = fontAsset;
+ __instance.showedZombieIntroduce.fontSizeMax = 21;
__instance.showedZombieIntroduce.margin = new Vector4(3, 2, 12, 0);
__instance.showedZombieIntroduce.enableWordWrapping = true;
diff --git a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
index 9d1f60d..0526c80 100644
--- a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
+++ b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
@@ -13,7 +13,7 @@
latest
enable
Debug;DebugEnglish;ReleaseMulti;ReleaseEnglish;DebugTesting;ReleaseOther;DebugObfuscate;ReleaseObfuscate
- C:\Users\rainb\Desktop\PC_PVZ-Fusion_3.2.1
+ C:\Users\rainb\Desktop\PC_PVZ-Fusion_3.3.0_Part1
AnyCPU;ARM64;x64
diff --git a/PvZ Fusion Translator.sln b/PvZ Fusion Translator.sln
index 7403b07..b7a6813 100644
--- a/PvZ Fusion Translator.sln
+++ b/PvZ Fusion Translator.sln
@@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.10.35122.118
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PvZ Fusion Translator [MelonLoader]", "MelonLoader\PvZ Fusion Translator [MelonLoader].csproj", "{90AA30F8-EFE7-6E1A-3859-0EE79252222A}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
@@ -12,6 +10,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PvZ Fusion Translator [BepInEx]", "BepInEx\PvZ Fusion Translator [BepInEx].csproj", "{395E60A0-A884-61F2-EF18-BC94BB7D9C69}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PvZ Fusion Translator [MelonLoader]", "MelonLoader\PvZ Fusion Translator [MelonLoader].csproj", "{A058E167-7411-D3CA-0C9F-40F030C12860}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -40,54 +40,6 @@ Global
ReleaseOther|x64 = ReleaseOther|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.Debug|Any CPU.ActiveCfg = Debug|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.Debug|Any CPU.Build.0 = Debug|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.Debug|ARM64.ActiveCfg = Debug|ARM64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.Debug|ARM64.Build.0 = Debug|ARM64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.Debug|x64.ActiveCfg = Debug|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.Debug|x64.Build.0 = Debug|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.DebugEnglish|Any CPU.ActiveCfg = DebugEnglish|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.DebugEnglish|Any CPU.Build.0 = DebugEnglish|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.DebugEnglish|ARM64.ActiveCfg = DebugEnglish|ARM64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.DebugEnglish|ARM64.Build.0 = DebugEnglish|ARM64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.DebugEnglish|x64.ActiveCfg = DebugEnglish|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.DebugEnglish|x64.Build.0 = DebugEnglish|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.DebugObfuscate|Any CPU.ActiveCfg = Debug|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.DebugObfuscate|Any CPU.Build.0 = Debug|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.DebugObfuscate|ARM64.ActiveCfg = DebugObfuscate|ARM64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.DebugObfuscate|ARM64.Build.0 = DebugObfuscate|ARM64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.DebugObfuscate|x64.ActiveCfg = DebugObfuscate|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.DebugObfuscate|x64.Build.0 = DebugObfuscate|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.DebugTesting|Any CPU.ActiveCfg = DebugTesting|Any CPU
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.DebugTesting|Any CPU.Build.0 = DebugTesting|Any CPU
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.DebugTesting|ARM64.ActiveCfg = DebugTesting|ARM64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.DebugTesting|ARM64.Build.0 = DebugTesting|ARM64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.DebugTesting|x64.ActiveCfg = DebugTesting|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.DebugTesting|x64.Build.0 = DebugTesting|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseEnglish|Any CPU.ActiveCfg = ReleaseEnglish|Any CPU
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseEnglish|Any CPU.Build.0 = ReleaseEnglish|Any CPU
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseEnglish|ARM64.ActiveCfg = ReleaseEnglish|ARM64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseEnglish|ARM64.Build.0 = ReleaseEnglish|ARM64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseEnglish|x64.ActiveCfg = ReleaseEnglish|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseEnglish|x64.Build.0 = ReleaseEnglish|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseMulti|Any CPU.ActiveCfg = ReleaseMulti|Any CPU
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseMulti|Any CPU.Build.0 = ReleaseMulti|Any CPU
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseMulti|ARM64.ActiveCfg = ReleaseMulti|ARM64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseMulti|ARM64.Build.0 = ReleaseMulti|ARM64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseMulti|x64.ActiveCfg = ReleaseMulti|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseMulti|x64.Build.0 = ReleaseMulti|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseObfuscate|Any CPU.ActiveCfg = ReleaseObfuscate|Any CPU
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseObfuscate|Any CPU.Build.0 = ReleaseObfuscate|Any CPU
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseObfuscate|ARM64.ActiveCfg = ReleaseObfuscate|ARM64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseObfuscate|ARM64.Build.0 = ReleaseObfuscate|ARM64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseObfuscate|x64.ActiveCfg = ReleaseObfuscate|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseObfuscate|x64.Build.0 = ReleaseObfuscate|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseOther|Any CPU.ActiveCfg = ReleaseOther|Any CPU
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseOther|Any CPU.Build.0 = ReleaseOther|Any CPU
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseOther|ARM64.ActiveCfg = ReleaseOther|ARM64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseOther|ARM64.Build.0 = ReleaseOther|ARM64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseOther|x64.ActiveCfg = ReleaseOther|x64
- {90AA30F8-EFE7-6E1A-3859-0EE79252222A}.ReleaseOther|x64.Build.0 = ReleaseOther|x64
{395E60A0-A884-61F2-EF18-BC94BB7D9C69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{395E60A0-A884-61F2-EF18-BC94BB7D9C69}.Debug|Any CPU.Build.0 = Debug|Any CPU
{395E60A0-A884-61F2-EF18-BC94BB7D9C69}.Debug|ARM64.ActiveCfg = Debug|Any CPU
@@ -136,6 +88,54 @@ Global
{395E60A0-A884-61F2-EF18-BC94BB7D9C69}.ReleaseOther|ARM64.Build.0 = ReleaseOther|Any CPU
{395E60A0-A884-61F2-EF18-BC94BB7D9C69}.ReleaseOther|x64.ActiveCfg = ReleaseOther|x64
{395E60A0-A884-61F2-EF18-BC94BB7D9C69}.ReleaseOther|x64.Build.0 = ReleaseOther|x64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.Debug|ARM64.ActiveCfg = Debug|ARM64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.Debug|ARM64.Build.0 = Debug|ARM64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.Debug|x64.ActiveCfg = Debug|x64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.Debug|x64.Build.0 = Debug|x64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.DebugEnglish|Any CPU.ActiveCfg = DebugEnglish|Any CPU
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.DebugEnglish|Any CPU.Build.0 = DebugEnglish|Any CPU
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.DebugEnglish|ARM64.ActiveCfg = DebugEnglish|ARM64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.DebugEnglish|ARM64.Build.0 = DebugEnglish|ARM64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.DebugEnglish|x64.ActiveCfg = DebugEnglish|x64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.DebugEnglish|x64.Build.0 = DebugEnglish|x64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.DebugObfuscate|Any CPU.ActiveCfg = DebugObfuscate|Any CPU
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.DebugObfuscate|Any CPU.Build.0 = DebugObfuscate|Any CPU
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.DebugObfuscate|ARM64.ActiveCfg = DebugObfuscate|ARM64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.DebugObfuscate|ARM64.Build.0 = DebugObfuscate|ARM64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.DebugObfuscate|x64.ActiveCfg = DebugObfuscate|x64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.DebugObfuscate|x64.Build.0 = DebugObfuscate|x64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.DebugTesting|Any CPU.ActiveCfg = DebugTesting|Any CPU
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.DebugTesting|Any CPU.Build.0 = DebugTesting|Any CPU
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.DebugTesting|ARM64.ActiveCfg = DebugTesting|ARM64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.DebugTesting|ARM64.Build.0 = DebugTesting|ARM64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.DebugTesting|x64.ActiveCfg = DebugTesting|x64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.DebugTesting|x64.Build.0 = DebugTesting|x64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseEnglish|Any CPU.ActiveCfg = ReleaseEnglish|Any CPU
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseEnglish|Any CPU.Build.0 = ReleaseEnglish|Any CPU
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseEnglish|ARM64.ActiveCfg = ReleaseEnglish|ARM64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseEnglish|ARM64.Build.0 = ReleaseEnglish|ARM64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseEnglish|x64.ActiveCfg = ReleaseEnglish|x64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseEnglish|x64.Build.0 = ReleaseEnglish|x64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseMulti|Any CPU.ActiveCfg = ReleaseMulti|Any CPU
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseMulti|Any CPU.Build.0 = ReleaseMulti|Any CPU
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseMulti|ARM64.ActiveCfg = ReleaseMulti|ARM64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseMulti|ARM64.Build.0 = ReleaseMulti|ARM64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseMulti|x64.ActiveCfg = ReleaseMulti|x64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseMulti|x64.Build.0 = ReleaseMulti|x64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseObfuscate|Any CPU.ActiveCfg = ReleaseObfuscate|Any CPU
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseObfuscate|Any CPU.Build.0 = ReleaseObfuscate|Any CPU
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseObfuscate|ARM64.ActiveCfg = ReleaseObfuscate|ARM64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseObfuscate|ARM64.Build.0 = ReleaseObfuscate|ARM64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseObfuscate|x64.ActiveCfg = ReleaseObfuscate|x64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseObfuscate|x64.Build.0 = ReleaseObfuscate|x64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseOther|Any CPU.ActiveCfg = ReleaseOther|Any CPU
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseOther|Any CPU.Build.0 = ReleaseOther|Any CPU
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseOther|ARM64.ActiveCfg = ReleaseOther|ARM64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseOther|ARM64.Build.0 = ReleaseOther|ARM64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseOther|x64.ActiveCfg = ReleaseOther|x64
+ {A058E167-7411-D3CA-0C9F-40F030C12860}.ReleaseOther|x64.Build.0 = ReleaseOther|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
From e2c595a6699596b4d0e14515fd563a849c1a6703 Mon Sep 17 00:00:00 2001
From: SillyStar-Github <90102598+SillyStar-Github@users.noreply.github.com>
Date: Sun, 18 Jan 2026 01:52:27 -0500
Subject: [PATCH 02/10] starbound part 1
---
.../BaseTextObjects/InGameText_Patch.cs | 1 +
.../AdvantureEvolutionMenu_Patch.cs | 13 ++++
.../GameObjects/AdvantureHelpMenu_Patch.cs | 21 +++++++
.../GameObjects/AdvantureMenu2_Patch.cs | 28 +++++++++
.../GameObjects/AdvantureMenu_Patch.cs | 52 ++++++++++++++++
.../GameObjects/AdvantureMissionMenu_Patch.cs | 31 ++++++++++
.../GameObjects/AdvantureStarMenu_Patch.cs | 61 +++++++++++++++++++
...PvZ Fusion Translator [MelonLoader].csproj | 6 ++
8 files changed, 213 insertions(+)
create mode 100644 MelonLoader/Patches/GameObjects/AdvantureEvolutionMenu_Patch.cs
create mode 100644 MelonLoader/Patches/GameObjects/AdvantureHelpMenu_Patch.cs
create mode 100644 MelonLoader/Patches/GameObjects/AdvantureMenu2_Patch.cs
create mode 100644 MelonLoader/Patches/GameObjects/AdvantureMenu_Patch.cs
create mode 100644 MelonLoader/Patches/GameObjects/AdvantureMissionMenu_Patch.cs
create mode 100644 MelonLoader/Patches/GameObjects/AdvantureStarMenu_Patch.cs
diff --git a/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs b/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
index d45e8ee..e89d4ad 100644
--- a/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
+++ b/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
@@ -11,6 +11,7 @@ namespace PvZ_Fusion_Translator.Patches.BaseTextObjects
public static class InGameText_Patch
{
[HarmonyPatch(nameof(InGameText.ShowText))]
+ [HarmonyPostfix]
public static void ShowText(InGameText __instance)
{
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
diff --git a/MelonLoader/Patches/GameObjects/AdvantureEvolutionMenu_Patch.cs b/MelonLoader/Patches/GameObjects/AdvantureEvolutionMenu_Patch.cs
new file mode 100644
index 0000000..e07e77c
--- /dev/null
+++ b/MelonLoader/Patches/GameObjects/AdvantureEvolutionMenu_Patch.cs
@@ -0,0 +1,13 @@
+using HarmonyLib;
+using Il2Cpp;
+using Il2CppTMPro;
+using PvZ_Fusion_Translator.AssetStore;
+
+namespace PvZ_Fusion_Translator.Patches.GameObjects
+{
+ [HarmonyPatch(typeof(AdvantureEvolutionMenu))]
+ public static class AdvantureEvolutionMenu_Patch
+ {
+
+ }
+}
diff --git a/MelonLoader/Patches/GameObjects/AdvantureHelpMenu_Patch.cs b/MelonLoader/Patches/GameObjects/AdvantureHelpMenu_Patch.cs
new file mode 100644
index 0000000..80a540d
--- /dev/null
+++ b/MelonLoader/Patches/GameObjects/AdvantureHelpMenu_Patch.cs
@@ -0,0 +1,21 @@
+using HarmonyLib;
+using Il2Cpp;
+using Il2CppTMPro;
+using PvZ_Fusion_Translator.AssetStore;
+
+namespace PvZ_Fusion_Translator.Patches.GameObjects
+{
+ [HarmonyPatch(typeof(AdvantureHelpMenu))]
+ public static class AdvantureHelpMenu_Patch
+ {
+ [HarmonyPatch(nameof(AdvantureHelpMenu.InitText))]
+ [HarmonyPostfix]
+ private static void InitText(AdvantureHelpMenu __instance)
+ {
+ foreach(TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
+ }
+ }
+}
diff --git a/MelonLoader/Patches/GameObjects/AdvantureMenu2_Patch.cs b/MelonLoader/Patches/GameObjects/AdvantureMenu2_Patch.cs
new file mode 100644
index 0000000..2c46df7
--- /dev/null
+++ b/MelonLoader/Patches/GameObjects/AdvantureMenu2_Patch.cs
@@ -0,0 +1,28 @@
+using HarmonyLib;
+using Il2Cpp;
+using Il2CppTMPro;
+using PvZ_Fusion_Translator.AssetStore;
+
+namespace PvZ_Fusion_Translator.Patches.GameObjects
+{
+ [HarmonyPatch(typeof(AdvantureMenu2))]
+ public static class AdvantureMenu2_Patch
+ {
+ [HarmonyPatch(nameof(AdvantureMenu2.Awake))]
+ [HarmonyPostfix]
+ private static void Awake(AdvantureMenu2 __instance)
+ {
+ foreach(TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
+ }
+
+ [HarmonyPatch(nameof(AdvantureMenu2.AdjustDifficulty))]
+ [HarmonyPostfix]
+ private static void AdjustDifficulty(AdvantureMenu2 __instance)
+ {
+ __instance.difficulty.text = StringStore.TranslateText(__instance.difficulty.text);
+ }
+ }
+}
diff --git a/MelonLoader/Patches/GameObjects/AdvantureMenu_Patch.cs b/MelonLoader/Patches/GameObjects/AdvantureMenu_Patch.cs
new file mode 100644
index 0000000..62ff70e
--- /dev/null
+++ b/MelonLoader/Patches/GameObjects/AdvantureMenu_Patch.cs
@@ -0,0 +1,52 @@
+using HarmonyLib;
+using Il2Cpp;
+using Il2CppTMPro;
+using PvZ_Fusion_Translator.AssetStore;
+
+namespace PvZ_Fusion_Translator.Patches.GameObjects
+{
+ [HarmonyPatch(typeof(AdvantureMenu))]
+ public static class AdvantureMenu_Patch
+ {
+ [HarmonyPatch(nameof(AdvantureMenu.Start))]
+ [HarmonyPostfix]
+ private static void Start(AdvantureMenu __instance)
+ {
+ foreach (TextMeshProUGUI titleText in __instance.GetComponentsInChildren())
+ {
+ titleText.text = StringStore.TranslateText(titleText.text);
+ }
+ __instance.difficulty.text = StringStore.TranslateText(__instance.difficulty.text);
+ __instance.chapterDifficulty.text = StringStore.TranslateText(__instance.chapterDifficulty.text, pattern: "章节难度:([^\\s]+)");
+ __instance.starCount.text = StringStore.TranslateText(__instance.starCount.text);
+ }
+
+ [HarmonyPatch(nameof(AdvantureMenu.ChangeDifficulty))]
+ [HarmonyPostfix]
+ private static void ChangeDifficulty(AdvantureMenu __instance)
+ {
+ __instance.difficulty.text = StringStore.TranslateText(__instance.difficulty.text);
+ }
+
+ [HarmonyPatch(nameof(AdvantureMenu.GetChapterDifficulty))]
+ [HarmonyPostfix]
+ private static void GetChapterDifficulty(AdvantureMenu __instance)
+ {
+ __instance.chapterDifficulty.text = StringStore.TranslateText(__instance.chapterDifficulty.text, pattern: "章节难度:([^\\s]+)");
+ }
+
+ [HarmonyPatch(nameof(AdvantureMenu.UpdateChapterDifficulty))]
+ [HarmonyPostfix]
+ private static void UpdateChapterDifficulty(AdvantureMenu __instance)
+ {
+ __instance.chapterDifficulty.text = StringStore.TranslateText(__instance.chapterDifficulty.text, pattern: "章节难度:([^\\s]+)");
+ }
+
+ [HarmonyPatch(nameof(AdvantureMenu.UpdateStarCount))]
+ [HarmonyPostfix]
+ private static void UpdateStarCount(AdvantureMenu __instance)
+ {
+ __instance.starCount.text = StringStore.TranslateText(__instance.starCount.text);
+ }
+ }
+}
diff --git a/MelonLoader/Patches/GameObjects/AdvantureMissionMenu_Patch.cs b/MelonLoader/Patches/GameObjects/AdvantureMissionMenu_Patch.cs
new file mode 100644
index 0000000..1f5268e
--- /dev/null
+++ b/MelonLoader/Patches/GameObjects/AdvantureMissionMenu_Patch.cs
@@ -0,0 +1,31 @@
+using HarmonyLib;
+using Il2Cpp;
+using Il2CppTMPro;
+using PvZ_Fusion_Translator.AssetStore;
+
+namespace PvZ_Fusion_Translator.Patches.GameObjects
+{
+ [HarmonyPatch(typeof(AdvantureMissionMenu))]
+ public static class AdvantureMissionMenu_Patch
+ {
+ [HarmonyPatch(nameof(AdvantureMissionMenu.InitText))]
+ [HarmonyPostfix]
+ private static void InitText(AdvantureMissionMenu __instance)
+ {
+ foreach(TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
+ }
+
+ [HarmonyPatch(nameof(AdvantureMissionMenu.SwitchAward))]
+ [HarmonyPostfix]
+ private static void SwitchAward(AdvantureMissionMenu __instance)
+ {
+ foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
+ }
+ }
+}
diff --git a/MelonLoader/Patches/GameObjects/AdvantureStarMenu_Patch.cs b/MelonLoader/Patches/GameObjects/AdvantureStarMenu_Patch.cs
new file mode 100644
index 0000000..9af61ce
--- /dev/null
+++ b/MelonLoader/Patches/GameObjects/AdvantureStarMenu_Patch.cs
@@ -0,0 +1,61 @@
+using HarmonyLib;
+using Il2Cpp;
+using Il2CppTMPro;
+using PvZ_Fusion_Translator.AssetStore;
+
+namespace PvZ_Fusion_Translator.Patches.GameObjects
+{
+ [HarmonyPatch(typeof(AdvantureStarMenu))]
+ public static class AdvantureStarMenu_Patch
+ {
+ [HarmonyPatch(nameof(AdvantureStarMenu.Awake))]
+ [HarmonyPostfix]
+ private static void Awake(AdvantureStarMenu __instance)
+ {
+ foreach(TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
+ }
+
+ [HarmonyPatch(nameof(AdvantureStarMenu.GetNodes))]
+ [HarmonyPostfix]
+ private static void GetNodes(AdvantureStarMenu __instance)
+ {
+ foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
+ }
+
+ [HarmonyPatch(nameof(AdvantureStarMenu.UpdateStarText))]
+ [HarmonyPostfix]
+ private static void UpdateStarText(AdvantureStarMenu __instance)
+ {
+ foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
+ }
+
+ [HarmonyPatch(nameof(AdvantureStarMenu.InitTalents))]
+ [HarmonyPostfix]
+ private static void InitTalents(AdvantureStarMenu __instance)
+ {
+ foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
+ }
+
+ [HarmonyPatch(nameof(AdvantureStarMenu.ResetAward))]
+ [HarmonyPostfix]
+ private static void ResetAward(AdvantureStarMenu __instance)
+ {
+ foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
+ }
+ }
+}
diff --git a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
index 0526c80..e2eb414 100644
--- a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
+++ b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
@@ -401,6 +401,12 @@
+
+
+
+
+
+
From a89ba825ee55469e2f5e6a3fce00bad3176c0e74 Mon Sep 17 00:00:00 2001
From: SillyStar-Github <90102598+SillyStar-Github@users.noreply.github.com>
Date: Mon, 19 Jan 2026 03:59:22 -0500
Subject: [PATCH 03/10] a few updates
---
MelonLoader/AssetStore/StringStore.cs | 57 ++++++++++++++++++-
.../BaseTextObjects/InGameText_Patch.cs | 6 ++
.../GameObjects/AdvantureMenu_Patch.cs | 29 +++++++---
.../GameObjects/AdvantureMissionMenu_Patch.cs | 33 +++++++++--
.../GameObjects/MinorObjects/Zombie_Patch.cs | 18 +++++-
MelonLoader/Utils.cs | 13 ++++-
6 files changed, 137 insertions(+), 19 deletions(-)
diff --git a/MelonLoader/AssetStore/StringStore.cs b/MelonLoader/AssetStore/StringStore.cs
index 24ec52b..9ea3ff5 100644
--- a/MelonLoader/AssetStore/StringStore.cs
+++ b/MelonLoader/AssetStore/StringStore.cs
@@ -124,6 +124,61 @@ namespace PvZ_Fusion_Translator.AssetStore
return checkText;
}
+ public static string TranslateColorText(string originalText, bool isLog = false)
+ {
+ string first = ReplaceInsideColorTags(originalText);
+ string text = ReplaceOutsideColorTags(first);
+ string checkText;
+ #if DEBUG
+ Regex regex = new("\\p{IsCJKUnifiedIdeographs}+");
+ Match match = regex.Match(text);
+
+ if (match.Success)
+ {
+ // Log.LogDebug("Untranslated String: " + match.Value);
+ FileLoader.DumpUntranslatedStrings(text);
+ }
+ #endif
+ checkText = text;
+
+ return checkText;
+ }
+
+ public static string ReplaceOutsideColorTags(string input)
+ {
+ string pattern = @"(]*>.*?)";
+ var parts = Regex.Split(input, pattern);
+
+ for (int i = 0; i < parts.Length; i++)
+ {
+ if (i % 2 == 0)
+ {
+ parts[i] = DoTranslateText(parts[i], false);
+ if(Utils.CheckForUntranslatedText(parts[i]))
+ {
+ FileLoader.DumpUntranslatedStrings(parts[i]);
+ }
+ }
+ }
+
+ return string.Join("", parts);
+ }
+
+ public static string ReplaceInsideColorTags(string input)
+ {
+ string text = Regex.Replace(input, @"(]+>)(.*?)()", match =>
+ {
+ string translatedText = DoTranslateText(match.Groups[2].Value, false);
+ if (Utils.CheckForUntranslatedText(translatedText))
+ {
+ FileLoader.DumpUntranslatedStrings(translatedText);
+ }
+ return match.Groups[1].Value + DoTranslateText(match.Groups[2].Value, false) + match.Groups[3].Value;
+ });
+
+ return text;
+ }
+
public static string TranslateText(string originalText, string pattern, bool isLog = false)
{
if (TestRegex(originalText, pattern) && translationStringRegex.ContainsKey(pattern))
@@ -214,7 +269,7 @@ namespace PvZ_Fusion_Translator.AssetStore
return originalText;
}
- private static bool TestRegex(string originalText, string pattern)
+ public static bool TestRegex(string originalText, string pattern)
{
return Regex.IsMatch(originalText, pattern);
}
diff --git a/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs b/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
index e89d4ad..035dc17 100644
--- a/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
+++ b/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
@@ -3,6 +3,7 @@ using Il2Cpp;
using Il2CppTMPro;
using PvZ_Fusion_Translator.AssetStore;
using PvZ_Fusion_Translator.Patches.Managers;
+using System.Text.RegularExpressions;
using UnityEngine.TextCore.Text;
namespace PvZ_Fusion_Translator.Patches.BaseTextObjects
@@ -30,6 +31,11 @@ namespace PvZ_Fusion_Translator.Patches.BaseTextObjects
}
txt.font = fontAsset;
}
+
+ if(__instance.TryGetComponent(out TextMeshProUGUI text))
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
}
}
}
\ No newline at end of file
diff --git a/MelonLoader/Patches/GameObjects/AdvantureMenu_Patch.cs b/MelonLoader/Patches/GameObjects/AdvantureMenu_Patch.cs
index 62ff70e..0da395b 100644
--- a/MelonLoader/Patches/GameObjects/AdvantureMenu_Patch.cs
+++ b/MelonLoader/Patches/GameObjects/AdvantureMenu_Patch.cs
@@ -12,41 +12,52 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
[HarmonyPostfix]
private static void Start(AdvantureMenu __instance)
{
- foreach (TextMeshProUGUI titleText in __instance.GetComponentsInChildren())
+ __instance.difficulty.text = Utils.RemoveSizeTags(StringStore.TranslateText(__instance.difficulty.text));
+ foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
{
- titleText.text = StringStore.TranslateText(titleText.text);
+ text.text = StringStore.TranslateText(text.text);
}
- __instance.difficulty.text = StringStore.TranslateText(__instance.difficulty.text);
- __instance.chapterDifficulty.text = StringStore.TranslateText(__instance.chapterDifficulty.text, pattern: "章节难度:([^\\s]+)");
- __instance.starCount.text = StringStore.TranslateText(__instance.starCount.text);
}
[HarmonyPatch(nameof(AdvantureMenu.ChangeDifficulty))]
[HarmonyPostfix]
private static void ChangeDifficulty(AdvantureMenu __instance)
{
- __instance.difficulty.text = StringStore.TranslateText(__instance.difficulty.text);
+ __instance.difficulty.text = Utils.RemoveSizeTags(StringStore.TranslateText(__instance.difficulty.text));
+ foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
}
[HarmonyPatch(nameof(AdvantureMenu.GetChapterDifficulty))]
[HarmonyPostfix]
private static void GetChapterDifficulty(AdvantureMenu __instance)
{
- __instance.chapterDifficulty.text = StringStore.TranslateText(__instance.chapterDifficulty.text, pattern: "章节难度:([^\\s]+)");
+ foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
}
[HarmonyPatch(nameof(AdvantureMenu.UpdateChapterDifficulty))]
[HarmonyPostfix]
private static void UpdateChapterDifficulty(AdvantureMenu __instance)
{
- __instance.chapterDifficulty.text = StringStore.TranslateText(__instance.chapterDifficulty.text, pattern: "章节难度:([^\\s]+)");
+ foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
}
[HarmonyPatch(nameof(AdvantureMenu.UpdateStarCount))]
[HarmonyPostfix]
private static void UpdateStarCount(AdvantureMenu __instance)
{
- __instance.starCount.text = StringStore.TranslateText(__instance.starCount.text);
+ foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
}
}
}
diff --git a/MelonLoader/Patches/GameObjects/AdvantureMissionMenu_Patch.cs b/MelonLoader/Patches/GameObjects/AdvantureMissionMenu_Patch.cs
index 1f5268e..bb23854 100644
--- a/MelonLoader/Patches/GameObjects/AdvantureMissionMenu_Patch.cs
+++ b/MelonLoader/Patches/GameObjects/AdvantureMissionMenu_Patch.cs
@@ -8,24 +8,49 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
[HarmonyPatch(typeof(AdvantureMissionMenu))]
public static class AdvantureMissionMenu_Patch
{
+ [HarmonyPatch(nameof(AdvantureMissionMenu.Awake))]
+ [HarmonyPostfix]
+ private static void Awake(AdvantureMissionMenu __instance)
+ {
+ foreach (TextMeshProUGUI text in __instance.contant.GetComponentsInChildren())
+ {
+ text.text = StringStore.TranslateColorText(text.text);
+ }
+
+ //foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ //{
+ // text.text = StringStore.TranslateText(text.text);
+ //}
+ }
+
[HarmonyPatch(nameof(AdvantureMissionMenu.InitText))]
[HarmonyPostfix]
private static void InitText(AdvantureMissionMenu __instance)
{
- foreach(TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ foreach (TextMeshProUGUI text in __instance.contant.GetComponentsInChildren())
{
- text.text = StringStore.TranslateText(text.text);
+ text.text = StringStore.TranslateColorText(text.text);
}
+
+ //foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ //{
+ // text.text = StringStore.TranslateText(text.text);
+ //}
}
[HarmonyPatch(nameof(AdvantureMissionMenu.SwitchAward))]
[HarmonyPostfix]
private static void SwitchAward(AdvantureMissionMenu __instance)
{
- foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ foreach(TextMeshProUGUI text in __instance.contant.GetComponentsInChildren())
{
- text.text = StringStore.TranslateText(text.text);
+ text.text = StringStore.TranslateColorText(text.text);
}
+
+ //foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ //{
+ // text.text = StringStore.TranslateText(text.text);
+ //}
}
}
}
diff --git a/MelonLoader/Patches/GameObjects/MinorObjects/Zombie_Patch.cs b/MelonLoader/Patches/GameObjects/MinorObjects/Zombie_Patch.cs
index bcdd189..3966670 100644
--- a/MelonLoader/Patches/GameObjects/MinorObjects/Zombie_Patch.cs
+++ b/MelonLoader/Patches/GameObjects/MinorObjects/Zombie_Patch.cs
@@ -17,7 +17,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects.MinorObjects
{ "^HP:(\\d+)/(\\d+)\n一类:(\\d+)/(\\d+)\n二类:(\\d+)/(\\d+)$", "HP: {0}/{1}\nType 1 armor: {2}/{3}\nType 2 armor: {4}/{5}" },
{ "^HP:(\\d+)/(\\d+)\n一类:(\\d+)/(\\d+)$", "HP: {0}/{1}\nType 1 armor: {2}/{3}" },
{ "^HP:(\\d+)/(\\d+)\n二类:(\\d+)/(\\d+)$", "HP: {0}/{1}\nType 2 armor: {2}/{3}" },
- { "^HP:(\\d+)/(\\d+)$", "HP: {0}/{1}" },
+ { "^HP:(\\d+)/(\\d+)$", "HP: {0}/{1}" }
};
public static void LoadHPStrings()
@@ -56,7 +56,21 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects.MinorObjects
if (textTMP)
{
string origText = textTMP.text;
- string translatedText = TranslateHPText(origText, __instance);
+ string translatedText = origText;
+ string pattern = "([^\\s]+)阶\n([^\\s]+)";
+ if (StringStore.TestRegex(translatedText, pattern))
+ {
+ var regex = new Regex(pattern);
+ var match = regex.Match(translatedText);
+ string regularText = match.Groups[2].Value;
+ string halfText = TranslateHPText(regularText, __instance);
+ string fStr = StringStore.translationStringRegex[pattern];
+ translatedText = string.Format(fStr, [match.Groups[1].Value, halfText]);
+ }
+ else
+ {
+ translatedText = TranslateHPText(origText, __instance);
+ }
textTMP.text = translatedText == origText ? origText : translatedText;
textTMP.autoSizeTextContainer = false;
if (translatedText != origText)
diff --git a/MelonLoader/Utils.cs b/MelonLoader/Utils.cs
index 6bb2e79..01b675e 100644
--- a/MelonLoader/Utils.cs
+++ b/MelonLoader/Utils.cs
@@ -346,9 +346,16 @@ namespace PvZ_Fusion_Translator
public static bool CheckForUntranslatedText(string text)
{
Regex regex = new("\\p{IsCJKUnifiedIdeographs}+");
- Match match = regex.Match(text);
-
- return match.Success;
+ try
+ {
+ Match match = regex.Match(text);
+ return match.Success;
+ }
+ catch(Exception e)
+ {
+ Log.LogError(e);
+ }
+ return false;
}
#if MULTI_LANGUAGE
From b5a1c031af0b84e9111134663cd93dca4af13dfc Mon Sep 17 00:00:00 2001
From: SillyStar-Github <90102598+SillyStar-Github@users.noreply.github.com>
Date: Wed, 21 Jan 2026 16:57:36 -0500
Subject: [PATCH 04/10] some of the final code fixes, 3.3.1
---
MelonLoader/AssetStore/StringStore.cs | 120 +++++++++---------
.../BaseTextObjects/InGameText_Patch.cs | 33 ++++-
.../AdvantureEvolutionMenu_Patch.cs | 69 +++++++++-
.../GameObjects/AdvantureMenu_Patch.cs | 36 +++---
.../GameObjects/MinorObjects/Zombie_Patch.cs | 15 +--
.../GameObjects/NoticePauseMenu_Patch.cs | 17 ++-
.../Patches/Managers/CanvasUpUI_Patch.cs | 4 +-
...PvZ Fusion Translator [MelonLoader].csproj | 2 +-
8 files changed, 204 insertions(+), 92 deletions(-)
diff --git a/MelonLoader/AssetStore/StringStore.cs b/MelonLoader/AssetStore/StringStore.cs
index 9ea3ff5..b37d343 100644
--- a/MelonLoader/AssetStore/StringStore.cs
+++ b/MelonLoader/AssetStore/StringStore.cs
@@ -124,61 +124,6 @@ namespace PvZ_Fusion_Translator.AssetStore
return checkText;
}
- public static string TranslateColorText(string originalText, bool isLog = false)
- {
- string first = ReplaceInsideColorTags(originalText);
- string text = ReplaceOutsideColorTags(first);
- string checkText;
- #if DEBUG
- Regex regex = new("\\p{IsCJKUnifiedIdeographs}+");
- Match match = regex.Match(text);
-
- if (match.Success)
- {
- // Log.LogDebug("Untranslated String: " + match.Value);
- FileLoader.DumpUntranslatedStrings(text);
- }
- #endif
- checkText = text;
-
- return checkText;
- }
-
- public static string ReplaceOutsideColorTags(string input)
- {
- string pattern = @"(]*>.*?)";
- var parts = Regex.Split(input, pattern);
-
- for (int i = 0; i < parts.Length; i++)
- {
- if (i % 2 == 0)
- {
- parts[i] = DoTranslateText(parts[i], false);
- if(Utils.CheckForUntranslatedText(parts[i]))
- {
- FileLoader.DumpUntranslatedStrings(parts[i]);
- }
- }
- }
-
- return string.Join("", parts);
- }
-
- public static string ReplaceInsideColorTags(string input)
- {
- string text = Regex.Replace(input, @"(]+>)(.*?)()", match =>
- {
- string translatedText = DoTranslateText(match.Groups[2].Value, false);
- if (Utils.CheckForUntranslatedText(translatedText))
- {
- FileLoader.DumpUntranslatedStrings(translatedText);
- }
- return match.Groups[1].Value + DoTranslateText(match.Groups[2].Value, false) + match.Groups[3].Value;
- });
-
- return text;
- }
-
public static string TranslateText(string originalText, string pattern, bool isLog = false)
{
if (TestRegex(originalText, pattern) && translationStringRegex.ContainsKey(pattern))
@@ -266,12 +211,73 @@ namespace PvZ_Fusion_Translator.AssetStore
if (isLog)
Log.LogDebug($"Text '{originalText}' not translated");
+ if(Utils.CheckForUntranslatedText(originalText))
+ {
+ FileLoader.DumpUntranslatedStrings(originalText);
+ }
return originalText;
}
- public static bool TestRegex(string originalText, string pattern)
+ public static string TranslateColorText(string originalText, bool isLog = false)
+ {
+ string text = TranslateColorSegments(originalText);
+ string checkText;
+#if DEBUG
+ Regex regex = new("\\p{IsCJKUnifiedIdeographs}+");
+ Match match = regex.Match(text);
+
+ if (match.Success)
+ {
+ // Log.LogDebug("Untranslated String: " + match.Value);
+ FileLoader.DumpUntranslatedStrings(text);
+ }
+#endif
+ checkText = text;
+
+ return checkText;
+ }
+
+ public static string TranslateColorSegments(string input)
{
- return Regex.IsMatch(originalText, pattern);
+ string result = "";
+ string pattern = @"]+>[\s\S]*?<\/color>|(?:<(?!color=)|[^<])+";
+ string smallPattern = @"(]+>)(.*?)()";
+ MatchCollection matches = Regex.Matches(input, pattern);
+
+ for (int i = 0; i < matches.Count; i++)
+ {
+ Match match = matches[i];
+ if (Regex.Match(match.Value, smallPattern, RegexOptions.Singleline).Success)
+ {
+ result += TranslateColorSegment(match.Value);
+ }
+ else
+ {
+ result += DoTranslateText(match.Value);
+ }
+ }
+
+ return result;
+ }
+
+ public static string TranslateColorSegment(string input)
+ {
+ string result = input;
+ string pattern = @"(]+>)(.*?)()";
+ Match match = Regex.Match(input, pattern, RegexOptions.Singleline);
+ string translatedText = DoTranslateText(match.Groups[2].Value);
+ if(Utils.CheckForUntranslatedText(translatedText))
+ {
+ FileLoader.DumpUntranslatedStrings(translatedText);
+ }
+ result = match.Groups[1].Value + translatedText + match.Groups[3].Value;
+
+ return result;
+ }
+ public static bool TestRegex(string originalText, string pattern, bool singleLine = false)
+ {
+ RegexOptions options = (singleLine) ? RegexOptions.None : RegexOptions.Singleline;
+ return Regex.IsMatch(originalText, pattern, options);
}
private static TextAlignmentOptions TextAnchorToTMPAlignment(TextAnchor anchor)
diff --git a/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs b/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
index 035dc17..46e55f0 100644
--- a/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
+++ b/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
@@ -4,7 +4,8 @@ using Il2CppTMPro;
using PvZ_Fusion_Translator.AssetStore;
using PvZ_Fusion_Translator.Patches.Managers;
using System.Text.RegularExpressions;
-using UnityEngine.TextCore.Text;
+using System.Xml.Linq;
+using UnityEngine;
namespace PvZ_Fusion_Translator.Patches.BaseTextObjects
{
@@ -17,17 +18,45 @@ namespace PvZ_Fusion_Translator.Patches.BaseTextObjects
{
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
- foreach (TextMeshProUGUI txt in __instance.textMeshes)
+ foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren())
{
string travelMatch = TravelMgr_Patch.MatchTravelBuff(txt.text);
+ string originalText = "";
+
+ if (txt.gameObject.name.Contains("shadow"))
+ {
+ continue;
+ }
if (travelMatch != "")
{
txt.text = travelMatch;
}
+ else if(Regex.Match(txt.text, @"(]*>.*?)", RegexOptions.Singleline).Success)
+ {
+ txt.text = StringStore.TranslateColorText(txt.text, true);
+ if (txt.gameObject.name.Contains("main"))
+ {
+ originalText = txt.text;
+ Transform shadowText = txt.transform.parent.Find("Text_shadow");
+ if (shadowText != null)
+ {
+ shadowText.GetComponent().text = Utils.RemoveColorTags(originalText);
+ }
+ }
+ }
else
{
txt.text = StringStore.TranslateText(txt.text, true);
+ if (txt.gameObject.name.Contains("main"))
+ {
+ originalText = txt.text;
+ Transform shadowText = txt.transform.parent.Find("Text_shadow");
+ if (shadowText != null)
+ {
+ shadowText.GetComponent().text = Utils.RemoveColorTags(originalText);
+ }
+ }
}
txt.font = fontAsset;
}
diff --git a/MelonLoader/Patches/GameObjects/AdvantureEvolutionMenu_Patch.cs b/MelonLoader/Patches/GameObjects/AdvantureEvolutionMenu_Patch.cs
index e07e77c..30399e7 100644
--- a/MelonLoader/Patches/GameObjects/AdvantureEvolutionMenu_Patch.cs
+++ b/MelonLoader/Patches/GameObjects/AdvantureEvolutionMenu_Patch.cs
@@ -2,12 +2,79 @@
using Il2Cpp;
using Il2CppTMPro;
using PvZ_Fusion_Translator.AssetStore;
+using UnityEngine;
namespace PvZ_Fusion_Translator.Patches.GameObjects
{
[HarmonyPatch(typeof(AdvantureEvolutionMenu))]
public static class AdvantureEvolutionMenu_Patch
{
-
+ [HarmonyPatch(nameof(AdvantureMenu.Awake))]
+ [HarmonyPostfix]
+ public static void Awake(AdvantureEvolutionMenu __instance)
+ {
+ foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ {
+ text.text = StringStore.TranslateColorText(text.text);
+ }
+
+ Transform baseWindow = __instance.transform.Find("BaseWindow");
+ Transform advancedWindow = __instance.transform.Find("AdvancedWindow");
+
+ if(baseWindow != null)
+ {
+ foreach(TextMeshProUGUI text in baseWindow.GetComponentsInChildren())
+ {
+ if(text.gameObject.name.Contains("Name"))
+ {
+ text.text = Utils.GetPlantNameFromAlmanac(__instance.thePlantType);
+ }
+ }
+ }
+
+ if (advancedWindow != null)
+ {
+ foreach (TextMeshProUGUI text in advancedWindow.GetComponentsInChildren())
+ {
+ if (text.gameObject.name.Contains("Name"))
+ {
+ text.text = Utils.GetPlantNameFromAlmanac(__instance.thePlantType);
+ }
+ }
+ }
+ }
+
+ [HarmonyPatch(nameof(AdvantureEvolutionMenu.UpdateText))]
+ [HarmonyPostfix]
+ public static void UpdateText(AdvantureEvolutionMenu __instance)
+ {
+ foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ {
+ FileLoader.DumpUntranslatedStrings(text.text);
+ text.text = StringStore.TranslateColorText(text.text);
+ }
+ }
+
+ [HarmonyPatch(nameof(AdvantureEvolutionMenu.RollEvolution))]
+ [HarmonyPostfix]
+ public static void RollEvolution(AdvantureEvolutionMenu __instance)
+ {
+ foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ {
+ FileLoader.DumpUntranslatedStrings(text.text);
+ text.text = StringStore.TranslateColorText(text.text);
+ }
+ }
+
+ [HarmonyPatch(nameof(AdvantureEvolutionMenu.RollEvolutionGood))]
+ [HarmonyPostfix]
+ public static void RollEvolutionGood(AdvantureEvolutionMenu __instance)
+ {
+ foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
+ {
+ FileLoader.DumpUntranslatedStrings(text.text);
+ text.text = StringStore.TranslateColorText(text.text);
+ }
+ }
}
}
diff --git a/MelonLoader/Patches/GameObjects/AdvantureMenu_Patch.cs b/MelonLoader/Patches/GameObjects/AdvantureMenu_Patch.cs
index 0da395b..e956db4 100644
--- a/MelonLoader/Patches/GameObjects/AdvantureMenu_Patch.cs
+++ b/MelonLoader/Patches/GameObjects/AdvantureMenu_Patch.cs
@@ -12,48 +12,48 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
[HarmonyPostfix]
private static void Start(AdvantureMenu __instance)
{
- __instance.difficulty.text = Utils.RemoveSizeTags(StringStore.TranslateText(__instance.difficulty.text));
- foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
- {
- text.text = StringStore.TranslateText(text.text);
- }
+ TranslateAdvantureMenu(__instance);
}
[HarmonyPatch(nameof(AdvantureMenu.ChangeDifficulty))]
[HarmonyPostfix]
private static void ChangeDifficulty(AdvantureMenu __instance)
{
- __instance.difficulty.text = Utils.RemoveSizeTags(StringStore.TranslateText(__instance.difficulty.text));
- foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
- {
- text.text = StringStore.TranslateText(text.text);
- }
+ TranslateAdvantureMenu(__instance);
}
[HarmonyPatch(nameof(AdvantureMenu.GetChapterDifficulty))]
[HarmonyPostfix]
private static void GetChapterDifficulty(AdvantureMenu __instance)
{
- foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
- {
- text.text = StringStore.TranslateText(text.text);
- }
+ TranslateAdvantureMenu(__instance);
}
[HarmonyPatch(nameof(AdvantureMenu.UpdateChapterDifficulty))]
[HarmonyPostfix]
private static void UpdateChapterDifficulty(AdvantureMenu __instance)
{
- foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
- {
- text.text = StringStore.TranslateText(text.text);
- }
+ TranslateAdvantureMenu(__instance);
}
[HarmonyPatch(nameof(AdvantureMenu.UpdateStarCount))]
[HarmonyPostfix]
private static void UpdateStarCount(AdvantureMenu __instance)
{
+ TranslateAdvantureMenu(__instance);
+ }
+
+ public static void TranslateAdvantureMenu(AdvantureMenu __instance)
+ {
+ __instance.difficulty.text = Utils.RemoveSizeTags(StringStore.TranslateText(__instance.difficulty.text));
+ __instance.chapterDifficulty.text = StringStore.TranslateText(__instance.chapterDifficulty.text);
+ __instance.starCount.text = StringStore.TranslateText(__instance.starCount.text);
+
+ foreach (TextMeshProUGUI text in __instance.title)
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
+
foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
{
text.text = StringStore.TranslateText(text.text);
diff --git a/MelonLoader/Patches/GameObjects/MinorObjects/Zombie_Patch.cs b/MelonLoader/Patches/GameObjects/MinorObjects/Zombie_Patch.cs
index 3966670..a243e6a 100644
--- a/MelonLoader/Patches/GameObjects/MinorObjects/Zombie_Patch.cs
+++ b/MelonLoader/Patches/GameObjects/MinorObjects/Zombie_Patch.cs
@@ -57,15 +57,14 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects.MinorObjects
{
string origText = textTMP.text;
string translatedText = origText;
- string pattern = "([^\\s]+)阶\n([^\\s]+)";
+ string pattern = "(\\d+)阶\n([\\s\\S]+)";
if (StringStore.TestRegex(translatedText, pattern))
{
- var regex = new Regex(pattern);
- var match = regex.Match(translatedText);
- string regularText = match.Groups[2].Value;
- string halfText = TranslateHPText(regularText, __instance);
+ var match = Regex.Match(translatedText, pattern, RegexOptions.Singleline);
+ string tier = match.Groups[1].Value;
+ string healthText = TranslateHPText(match.Groups[2].Value, __instance);
string fStr = StringStore.translationStringRegex[pattern];
- translatedText = string.Format(fStr, [match.Groups[1].Value, halfText]);
+ translatedText = string.Format(fStr, [tier, healthText]);
}
else
{
@@ -105,8 +104,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects.MinorObjects
for(int i = 0; i < HPStrings.Count; i++)
{
var hp = HPStrings.ElementAt(i);
- Regex regex = new Regex(hp.Key);
- if(regex.IsMatch(originalText))
+ if(Regex.Match(originalText, hp.Key, RegexOptions.Singleline).Success)
{
fIndex = i;
found = true;
@@ -160,6 +158,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects.MinorObjects
{
string fStr = HPStrings.ElementAt(fIndex).Value;
string DPS = originalText.Split("\n")[1].Replace("DPS:", "");
+ DPS = StringStore.TranslateText(DPS);
switch (fIndex)
{
diff --git a/MelonLoader/Patches/GameObjects/NoticePauseMenu_Patch.cs b/MelonLoader/Patches/GameObjects/NoticePauseMenu_Patch.cs
index cdfd61e..b434320 100644
--- a/MelonLoader/Patches/GameObjects/NoticePauseMenu_Patch.cs
+++ b/MelonLoader/Patches/GameObjects/NoticePauseMenu_Patch.cs
@@ -39,12 +39,23 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
string changelogText = File.ReadAllText(changelogDir);
GameObject contentObject = __instance.transform.FindChild("Scroll View/Viewport/Content").gameObject;
-
- TextMeshProUGUI contentText = contentObject.GetComponent();
+
+ TextMeshProUGUI contentText = contentObject.GetComponent();
contentText.text = changelogText;
+ contentText.margin = new Vector4(6, 2, 12, 0);
+
+ contentText.enableWordWrapping = true;
+ contentText.overflowMode = TextOverflowModes.ScrollRect;
+
+ Canvas.ForceUpdateCanvases();
+ contentText.ForceMeshUpdate();
+
+ //float textHeight = contentText.preferredHeight;
+ //RectTransform contentRect = contentObject.GetComponent();
+ //contentRect.sizeDelta = new Vector2(contentRect.sizeDelta.x, textHeight);
ContentSizeFitter sizeFitter = contentObject.AddComponent();
sizeFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
}
- }
+ }
}
\ No newline at end of file
diff --git a/MelonLoader/Patches/Managers/CanvasUpUI_Patch.cs b/MelonLoader/Patches/Managers/CanvasUpUI_Patch.cs
index 6f840c5..6efb242 100644
--- a/MelonLoader/Patches/Managers/CanvasUpUI_Patch.cs
+++ b/MelonLoader/Patches/Managers/CanvasUpUI_Patch.cs
@@ -12,13 +12,13 @@ namespace PvZ_Fusion_Translator.Patches.Managers
{
[HarmonyPatch(nameof(CanvasUpUI.Start))]
[HarmonyPostfix]
- public static void Start(IZBottomMenu __instance)
+ public static void Start(CanvasUpUI __instance)
{
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
foreach(TextMeshProUGUI text in __instance.GetComponentsInChildren())
{
- string originalKey = StringStore.translationString.FirstOrDefault(x => x.Value.Replace("\n", " ") == text.text).Key;
+ string originalKey = StringStore.translationString.FirstOrDefault(x => (x.Value == text.text || x.Value.Replace("\n", "") == text.text)).Key;
text.text = (StringStore.translationString.ContainsKey(originalKey + "_MG")) ? StringStore.TranslateText(originalKey + "_MG") : StringStore.TranslateText(text.text);
if(text.gameObject.name.Contains("LevelName"))
{
diff --git a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
index e2eb414..4d83fe5 100644
--- a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
+++ b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
@@ -13,7 +13,7 @@
latest
enable
Debug;DebugEnglish;ReleaseMulti;ReleaseEnglish;DebugTesting;ReleaseOther;DebugObfuscate;ReleaseObfuscate
- C:\Users\rainb\Desktop\PC_PVZ-Fusion_3.3.0_Part1
+ C:\Users\rainb\Desktop\PC_PVZ-Fusion_3.3.1
AnyCPU;ARM64;x64
From 20d088239a88e98f59414de01887f6f50e9ee706 Mon Sep 17 00:00:00 2001
From: SillyStar-Github <90102598+SillyStar-Github@users.noreply.github.com>
Date: Sat, 24 Jan 2026 19:07:34 -0500
Subject: [PATCH 05/10] zombie spawn info + shadow popup fix
---
.../Patches/BaseTextObjects/InGameText_Patch.cs | 11 ++++++++++-
.../GameObjects/AlmanacZombieWindow_Patch.cs | 16 +++++++++++++---
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs b/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
index 46e55f0..3e396ef 100644
--- a/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
+++ b/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
@@ -21,7 +21,7 @@ namespace PvZ_Fusion_Translator.Patches.BaseTextObjects
foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren())
{
string travelMatch = TravelMgr_Patch.MatchTravelBuff(txt.text);
- string originalText = "";
+ string originalText = txt.text;
if (txt.gameObject.name.Contains("shadow"))
{
@@ -31,6 +31,15 @@ namespace PvZ_Fusion_Translator.Patches.BaseTextObjects
if (travelMatch != "")
{
txt.text = travelMatch;
+ if (txt.gameObject.name.Contains("main"))
+ {
+ originalText = txt.text;
+ Transform shadowText = txt.transform.parent.Find("Text_shadow");
+ if (shadowText != null)
+ {
+ shadowText.GetComponent().text = Utils.RemoveColorTags(originalText);
+ }
+ }
}
else if(Regex.Match(txt.text, @"(]*>.*?)", RegexOptions.Singleline).Success)
{
diff --git a/MelonLoader/Patches/GameObjects/AlmanacZombieWindow_Patch.cs b/MelonLoader/Patches/GameObjects/AlmanacZombieWindow_Patch.cs
index 57c475a..3f8179e 100644
--- a/MelonLoader/Patches/GameObjects/AlmanacZombieWindow_Patch.cs
+++ b/MelonLoader/Patches/GameObjects/AlmanacZombieWindow_Patch.cs
@@ -35,9 +35,10 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
TMP_FontAsset fontAsset = (hasAlmanacFont) ? FontStore.LoadTMPFontAlmanac(Utils.Language.ToString()) : FontStore.LoadTMPFont(Utils.Language.ToString());
- ZombieAlmanacData zombieData = JsonUtility.FromJson(json);
+ ZombieAlmanacData zombieAlmanacData = JsonUtility.FromJson(json);
+ var zombieDataDic = ZombieDataManager.zombieDataDic;
- foreach (ZombieInfo zombieInfo in zombieData.zombies)
+ foreach (ZombieInfo zombieInfo in zombieAlmanacData.zombies)
{
if (zombieInfo.theZombieType == __instance.currentZombieType)
{
@@ -49,7 +50,16 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
text.fontSizeMax = 21;
}
- __instance.showedZombieIntroduce.text = Utils.RemoveSizeTags(zombieInfo.info) + "\n\n" + Utils.RemoveSizeTags(zombieInfo.introduce) + "\n\n";
+ ZombieDataManager.ZombieData zombieData = zombieDataDic[__instance.currentZombieType];
+
+ string spawnInfo = "";
+ string spawnInfoFormat = StringStore.translationStringRegex["出怪等级: (\\d+)\n出怪权重: (\\d+)"];
+ if(spawnInfoFormat != null)
+ {
+ spawnInfo = string.Format(spawnInfoFormat, [zombieData.summonLevel, zombieData.summonWeight]) + "\n\n";
+ }
+
+ __instance.showedZombieIntroduce.text = Utils.RemoveSizeTags(zombieInfo.info) + "\n\n" + spawnInfo + Utils.RemoveSizeTags(zombieInfo.introduce) + "\n\n";
__instance.showedZombieIntroduce.font = fontAsset;
__instance.showedZombieIntroduce.fontSizeMax = 21;
__instance.showedZombieIntroduce.margin = new Vector4(3, 2, 12, 0);
From 5532ecc0d8337362b262e5bd35efdd062cbf7ef9 Mon Sep 17 00:00:00 2001
From: SillyStar-Github <90102598+SillyStar-Github@users.noreply.github.com>
Date: Sun, 25 Jan 2026 02:08:26 -0500
Subject: [PATCH 06/10] starbound difficulty text code
---
MelonLoader/Patches/GameObjects/AdvantureMenu_Patch.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/MelonLoader/Patches/GameObjects/AdvantureMenu_Patch.cs b/MelonLoader/Patches/GameObjects/AdvantureMenu_Patch.cs
index e956db4..de0459d 100644
--- a/MelonLoader/Patches/GameObjects/AdvantureMenu_Patch.cs
+++ b/MelonLoader/Patches/GameObjects/AdvantureMenu_Patch.cs
@@ -45,7 +45,8 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
public static void TranslateAdvantureMenu(AdvantureMenu __instance)
{
- __instance.difficulty.text = Utils.RemoveSizeTags(StringStore.TranslateText(__instance.difficulty.text));
+ bool hasSBString = StringStore.translationString.ContainsKey(__instance.difficulty.text + "_SB");
+ __instance.difficulty.text = Utils.RemoveSizeTags(hasSBString ? StringStore.TranslateText(__instance.difficulty.text + "_SB") : StringStore.TranslateText(__instance.difficulty.text));
__instance.chapterDifficulty.text = StringStore.TranslateText(__instance.chapterDifficulty.text);
__instance.starCount.text = StringStore.TranslateText(__instance.starCount.text);
From abe2d8eadc95a19215770a015f20881fb3a4f18f Mon Sep 17 00:00:00 2001
From: SillyStar-Github <90102598+SillyStar-Github@users.noreply.github.com>
Date: Tue, 10 Feb 2026 21:03:17 -0500
Subject: [PATCH 07/10] quick changes, removing old odyssey code temporarily,
reordering certain files
---
MelonLoader/AssetStore/StringStore.cs | 2 +-
.../BaseTextObjects/InGameText_Patch.cs | 4 +-
.../MinorObjects/UIProgress2_Patch.cs | 2 +-
.../GameObjects/MinorObjects/Zombie_Patch.cs | 1 +
.../GameObjects/TravelBuffMenu_Patch.cs | 24 -----
.../TravelBuffOptionButton_Patch.cs | 41 -------
.../Patches/GameObjects/TravelBuff_Patch.cs | 18 ----
.../GameObjects/TravelLookBuff_Patch.cs | 51 ---------
.../GameObjects/TravelLookMenu_Patch.cs | 46 --------
.../GameObjects/TravelRefresh_Patch.cs | 28 -----
.../Patches/GameObjects/TravelStore_Patch.cs | 70 ------------
.../Patches/Managers/DifficultyMgr_Patch.cs | 14 +--
.../Managers/OppositeBuffManager_Patch.cs | 37 +++----
.../Patches/Managers/TravelBuffMgr_Patch.cs | 27 -----
.../Patches/Managers/TravelMgr_Patch.cs | 102 ------------------
.../Abyss}/AbyssBagMenu_Patch.cs | 0
.../Abyss}/AbyssBuffButton_Patch.cs | 0
.../Abyss}/AbyssBuffData_Patch.cs | 0
.../Abyss}/AbyssBuffMenu_Patch.cs | 4 +-
.../Abyss}/AbyssCheckInBag_Patch.cs | 0
.../Abyss}/AbyssCheckSellMenu_Patch.cs | 0
.../Abyss}/AbyssDevelopMenu_Patch.cs | 0
.../Abyss}/AbyssGoods_Patch.cs | 2 +-
.../Abyss}/AbyssInfo_Patch.cs | 0
.../Abyss}/AbyssLevelEnter_Patch.cs | 2 +-
.../Abyss}/AbyssMenu2_Patch.cs | 0
.../Abyss}/AbyssMenu_Patch.cs | 2 +-
.../Abyss}/AbyssSelectBuffWindow_Patch.cs | 4 +-
.../Abyss}/AbyssSettlementMenu_Patch.cs | 0
.../Abyss}/AbyssStoreMenu_Patch.cs | 2 +-
.../Harvest}/GardenBagMenu_Patch.cs | 40 +++----
.../Harvest}/GardenCard_Patch.cs | 0
.../Harvest}/TreasureConfirmMenu_Patch.cs | 2 +-
.../Harvest}/TreasureEquipmentMenu_Patch.cs | 2 +-
.../Harvest}/TreasureEvacuateMenu_Patch.cs | 2 +-
.../Harvest}/TreasureMainMenu_Patch.cs | 2 +-
.../Harvest}/TreasureManager_Patch.cs | 2 +-
.../Harvest}/TreasureStoreMenu_Patch.cs | 2 +-
.../Harvest}/TreasureUpgradeMenu_Patch.cs | 2 +-
.../Harvest}/TreasureWarehouseMenu_Patch.cs | 2 +-
.../Modes/Odyssey/TravelBuffMenu_Patch.cs | 24 +++++
.../Modes/Odyssey/TravelBuffMgr_Patch.cs | 27 +++++
.../Odyssey/TravelBuffOptionButton_Patch.cs | 41 +++++++
.../Patches/Modes/Odyssey/TravelBuff_Patch.cs | 18 ++++
.../Modes/Odyssey/TravelLookBuff_Patch.cs | 51 +++++++++
.../Modes/Odyssey/TravelLookMenu_Patch.cs | 46 ++++++++
.../Patches/Modes/Odyssey/TravelMgr_Patch.cs | 102 ++++++++++++++++++
.../Modes/Odyssey/TravelRefresh_Patch.cs | 28 +++++
.../Modes/Odyssey/TravelStore_Patch.cs | 70 ++++++++++++
.../AdvantureEvolutionMenu_Patch.cs | 2 +-
.../Starbound}/AdvantureHelpMenu_Patch.cs | 2 +-
.../Starbound}/AdvantureMenu2_Patch.cs | 2 +-
.../Starbound}/AdvantureMenu_Patch.cs | 2 +-
.../Starbound}/AdvantureMissionMenu_Patch.cs | 2 +-
.../Starbound}/AdvantureStarMenu_Patch.cs | 2 +-
...PvZ Fusion Translator [MelonLoader].csproj | 20 ++--
56 files changed, 490 insertions(+), 488 deletions(-)
delete mode 100644 MelonLoader/Patches/GameObjects/TravelBuffMenu_Patch.cs
delete mode 100644 MelonLoader/Patches/GameObjects/TravelBuffOptionButton_Patch.cs
delete mode 100644 MelonLoader/Patches/GameObjects/TravelBuff_Patch.cs
delete mode 100644 MelonLoader/Patches/GameObjects/TravelLookBuff_Patch.cs
delete mode 100644 MelonLoader/Patches/GameObjects/TravelLookMenu_Patch.cs
delete mode 100644 MelonLoader/Patches/GameObjects/TravelRefresh_Patch.cs
delete mode 100644 MelonLoader/Patches/GameObjects/TravelStore_Patch.cs
delete mode 100644 MelonLoader/Patches/Managers/TravelBuffMgr_Patch.cs
delete mode 100644 MelonLoader/Patches/Managers/TravelMgr_Patch.cs
rename MelonLoader/Patches/{GameObjects => Modes/Abyss}/AbyssBagMenu_Patch.cs (100%)
rename MelonLoader/Patches/{GameObjects/ButtonObjects => Modes/Abyss}/AbyssBuffButton_Patch.cs (100%)
rename MelonLoader/Patches/{Managers => Modes/Abyss}/AbyssBuffData_Patch.cs (100%)
rename MelonLoader/Patches/{GameObjects => Modes/Abyss}/AbyssBuffMenu_Patch.cs (96%)
rename MelonLoader/Patches/{GameObjects => Modes/Abyss}/AbyssCheckInBag_Patch.cs (100%)
rename MelonLoader/Patches/{GameObjects/ButtonObjects => Modes/Abyss}/AbyssCheckSellMenu_Patch.cs (100%)
rename MelonLoader/Patches/{GameObjects => Modes/Abyss}/AbyssDevelopMenu_Patch.cs (100%)
rename MelonLoader/Patches/{GameObjects/MinorObjects => Modes/Abyss}/AbyssGoods_Patch.cs (92%)
rename MelonLoader/Patches/{Managers => Modes/Abyss}/AbyssInfo_Patch.cs (100%)
rename MelonLoader/Patches/{GameObjects/ButtonObjects => Modes/Abyss}/AbyssLevelEnter_Patch.cs (87%)
rename MelonLoader/Patches/{GameObjects => Modes/Abyss}/AbyssMenu2_Patch.cs (100%)
rename MelonLoader/Patches/{GameObjects => Modes/Abyss}/AbyssMenu_Patch.cs (97%)
rename MelonLoader/Patches/{GameObjects => Modes/Abyss}/AbyssSelectBuffWindow_Patch.cs (85%)
rename MelonLoader/Patches/{GameObjects => Modes/Abyss}/AbyssSettlementMenu_Patch.cs (100%)
rename MelonLoader/Patches/{GameObjects => Modes/Abyss}/AbyssStoreMenu_Patch.cs (92%)
rename MelonLoader/Patches/{GameObjects => Modes/Harvest}/GardenBagMenu_Patch.cs (55%)
rename MelonLoader/Patches/{GameObjects => Modes/Harvest}/GardenCard_Patch.cs (100%)
rename MelonLoader/Patches/{GameObjects => Modes/Harvest}/TreasureConfirmMenu_Patch.cs (93%)
rename MelonLoader/Patches/{GameObjects => Modes/Harvest}/TreasureEquipmentMenu_Patch.cs (95%)
rename MelonLoader/Patches/{GameObjects => Modes/Harvest}/TreasureEvacuateMenu_Patch.cs (94%)
rename MelonLoader/Patches/{GameObjects => Modes/Harvest}/TreasureMainMenu_Patch.cs (92%)
rename MelonLoader/Patches/{Managers => Modes/Harvest}/TreasureManager_Patch.cs (94%)
rename MelonLoader/Patches/{GameObjects => Modes/Harvest}/TreasureStoreMenu_Patch.cs (92%)
rename MelonLoader/Patches/{GameObjects => Modes/Harvest}/TreasureUpgradeMenu_Patch.cs (97%)
rename MelonLoader/Patches/{GameObjects => Modes/Harvest}/TreasureWarehouseMenu_Patch.cs (97%)
create mode 100644 MelonLoader/Patches/Modes/Odyssey/TravelBuffMenu_Patch.cs
create mode 100644 MelonLoader/Patches/Modes/Odyssey/TravelBuffMgr_Patch.cs
create mode 100644 MelonLoader/Patches/Modes/Odyssey/TravelBuffOptionButton_Patch.cs
create mode 100644 MelonLoader/Patches/Modes/Odyssey/TravelBuff_Patch.cs
create mode 100644 MelonLoader/Patches/Modes/Odyssey/TravelLookBuff_Patch.cs
create mode 100644 MelonLoader/Patches/Modes/Odyssey/TravelLookMenu_Patch.cs
create mode 100644 MelonLoader/Patches/Modes/Odyssey/TravelMgr_Patch.cs
create mode 100644 MelonLoader/Patches/Modes/Odyssey/TravelRefresh_Patch.cs
create mode 100644 MelonLoader/Patches/Modes/Odyssey/TravelStore_Patch.cs
rename MelonLoader/Patches/{GameObjects => Modes/Starbound}/AdvantureEvolutionMenu_Patch.cs (98%)
rename MelonLoader/Patches/{GameObjects => Modes/Starbound}/AdvantureHelpMenu_Patch.cs (91%)
rename MelonLoader/Patches/{GameObjects => Modes/Starbound}/AdvantureMenu2_Patch.cs (93%)
rename MelonLoader/Patches/{GameObjects => Modes/Starbound}/AdvantureMenu_Patch.cs (97%)
rename MelonLoader/Patches/{GameObjects => Modes/Starbound}/AdvantureMissionMenu_Patch.cs (97%)
rename MelonLoader/Patches/{GameObjects => Modes/Starbound}/AdvantureStarMenu_Patch.cs (97%)
diff --git a/MelonLoader/AssetStore/StringStore.cs b/MelonLoader/AssetStore/StringStore.cs
index b37d343..78b3727 100644
--- a/MelonLoader/AssetStore/StringStore.cs
+++ b/MelonLoader/AssetStore/StringStore.cs
@@ -278,7 +278,7 @@ namespace PvZ_Fusion_Translator.AssetStore
{
RegexOptions options = (singleLine) ? RegexOptions.None : RegexOptions.Singleline;
return Regex.IsMatch(originalText, pattern, options);
- }
+ }
private static TextAlignmentOptions TextAnchorToTMPAlignment(TextAnchor anchor)
{
diff --git a/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs b/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
index 3e396ef..175eb58 100644
--- a/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
+++ b/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
@@ -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())
{
- string travelMatch = TravelMgr_Patch.MatchTravelBuff(txt.text);
+ string travelMatch = "";
string originalText = txt.text;
if (txt.gameObject.name.Contains("shadow"))
diff --git a/MelonLoader/Patches/GameObjects/MinorObjects/UIProgress2_Patch.cs b/MelonLoader/Patches/GameObjects/MinorObjects/UIProgress2_Patch.cs
index 4e66a7d..2ab8b59 100644
--- a/MelonLoader/Patches/GameObjects/MinorObjects/UIProgress2_Patch.cs
+++ b/MelonLoader/Patches/GameObjects/MinorObjects/UIProgress2_Patch.cs
@@ -12,6 +12,6 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
private static void Update(UIProgress2 __instance)
{
__instance.t.text = StringStore.TranslateText(__instance.t.text);
- }
+ }
}
}
\ No newline at end of file
diff --git a/MelonLoader/Patches/GameObjects/MinorObjects/Zombie_Patch.cs b/MelonLoader/Patches/GameObjects/MinorObjects/Zombie_Patch.cs
index a243e6a..ea643de 100644
--- a/MelonLoader/Patches/GameObjects/MinorObjects/Zombie_Patch.cs
+++ b/MelonLoader/Patches/GameObjects/MinorObjects/Zombie_Patch.cs
@@ -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))
{
diff --git a/MelonLoader/Patches/GameObjects/TravelBuffMenu_Patch.cs b/MelonLoader/Patches/GameObjects/TravelBuffMenu_Patch.cs
deleted file mode 100644
index 095c160..0000000
--- a/MelonLoader/Patches/GameObjects/TravelBuffMenu_Patch.cs
+++ /dev/null
@@ -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);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/MelonLoader/Patches/GameObjects/TravelBuffOptionButton_Patch.cs b/MelonLoader/Patches/GameObjects/TravelBuffOptionButton_Patch.cs
deleted file mode 100644
index 461de17..0000000
--- a/MelonLoader/Patches/GameObjects/TravelBuffOptionButton_Patch.cs
+++ /dev/null
@@ -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 buffSet = translatedTravelBuffs[buffLinks[button.buffType]];
-
- string buff = (button.show != null && button.introduce.text != "词条已选完") ? buffSet[button.buffIndex] : StringStore.TranslateText("词条已选完");
-
- button.introduce.text = buff;
- }
- }
-
- //List buffSet = translatedTravelBuffs[buffLinks[__instance.buffType]];
- //string buff = (__instance.show != null) ? buffSet[__instance.buffIndex] : StringStore.TranslateText("无");
- //__instance.introduce.text = buff;
-}
diff --git a/MelonLoader/Patches/GameObjects/TravelBuff_Patch.cs b/MelonLoader/Patches/GameObjects/TravelBuff_Patch.cs
deleted file mode 100644
index a21001f..0000000
--- a/MelonLoader/Patches/GameObjects/TravelBuff_Patch.cs
+++ /dev/null
@@ -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);
- }
- }
-}
\ No newline at end of file
diff --git a/MelonLoader/Patches/GameObjects/TravelLookBuff_Patch.cs b/MelonLoader/Patches/GameObjects/TravelLookBuff_Patch.cs
deleted file mode 100644
index 1004d00..0000000
--- a/MelonLoader/Patches/GameObjects/TravelLookBuff_Patch.cs
+++ /dev/null
@@ -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())
- {
- 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())
- {
- text.text = StringStore.TranslateText(text.text);
- }
- }
-
- [HarmonyPatch(nameof(TravelLookBuff.SetBuff))]
- [HarmonyPostfix]
- public static void Post_SetBuff(TravelLookBuff __instance)
- {
- List 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())
- {
- text.text = StringStore.TranslateText(text.text);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/MelonLoader/Patches/GameObjects/TravelLookMenu_Patch.cs b/MelonLoader/Patches/GameObjects/TravelLookMenu_Patch.cs
deleted file mode 100644
index b775a7a..0000000
--- a/MelonLoader/Patches/GameObjects/TravelLookMenu_Patch.cs
+++ /dev/null
@@ -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())
- {
- 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())
- {
- 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;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/MelonLoader/Patches/GameObjects/TravelRefresh_Patch.cs b/MelonLoader/Patches/GameObjects/TravelRefresh_Patch.cs
deleted file mode 100644
index 6206e7a..0000000
--- a/MelonLoader/Patches/GameObjects/TravelRefresh_Patch.cs
+++ /dev/null
@@ -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);
- }
- }
-}
diff --git a/MelonLoader/Patches/GameObjects/TravelStore_Patch.cs b/MelonLoader/Patches/GameObjects/TravelStore_Patch.cs
deleted file mode 100644
index 82b8c24..0000000
--- a/MelonLoader/Patches/GameObjects/TravelStore_Patch.cs
+++ /dev/null
@@ -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();
- 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);
- }
- }
- }
-}
diff --git a/MelonLoader/Patches/Managers/DifficultyMgr_Patch.cs b/MelonLoader/Patches/Managers/DifficultyMgr_Patch.cs
index 3d05ff1..4b294d8 100644
--- a/MelonLoader/Patches/Managers/DifficultyMgr_Patch.cs
+++ b/MelonLoader/Patches/Managers/DifficultyMgr_Patch.cs
@@ -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;
+ //}
}
}
diff --git a/MelonLoader/Patches/Managers/OppositeBuffManager_Patch.cs b/MelonLoader/Patches/Managers/OppositeBuffManager_Patch.cs
index 11a18af..4913c91 100644
--- a/MelonLoader/Patches/Managers/OppositeBuffManager_Patch.cs
+++ b/MelonLoader/Patches/Managers/OppositeBuffManager_Patch.cs
@@ -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 buffLinks = TravelMgr_Patch.buffLinks;
- public static Dictionary> 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 buffLinks = TravelMgr_Patch.buffLinks;
+ //public static Dictionary> 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 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;
+ //}
}
}
}
diff --git a/MelonLoader/Patches/Managers/TravelBuffMgr_Patch.cs b/MelonLoader/Patches/Managers/TravelBuffMgr_Patch.cs
deleted file mode 100644
index 86879e1..0000000
--- a/MelonLoader/Patches/Managers/TravelBuffMgr_Patch.cs
+++ /dev/null
@@ -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);
- }
- }
-}
diff --git a/MelonLoader/Patches/Managers/TravelMgr_Patch.cs b/MelonLoader/Patches/Managers/TravelMgr_Patch.cs
deleted file mode 100644
index 3c8c863..0000000
--- a/MelonLoader/Patches/Managers/TravelMgr_Patch.cs
+++ /dev/null
@@ -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 buffLinks = new Dictionary()
- {
- { BuffType.AdvancedBuff, "advancedUpgrades" },
- { BuffType.UltimateBuff, "ultimateUpgrades" },
- { BuffType.UnlockPlant, "strongUltimates" },
- { BuffType.Debuff, "debuffs" },
- };
-
- public static Dictionary> dumpedTravelBuffs = new Dictionary>()
- {
- { "advancedUpgrades", [] },
- { "ultimateUpgrades", [] },
- { "strongUltimates", [] },
- { "debuffs", [] }
- };
-
- public static Dictionary> translatedTravelBuffs = new Dictionary>();
-
- public static void DumpTravelBuffs(Il2CppSystem.Collections.Generic.Dictionary source, Dictionary> 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>() // 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>>(travelBuffs);
- }
- }
-}
diff --git a/MelonLoader/Patches/GameObjects/AbyssBagMenu_Patch.cs b/MelonLoader/Patches/Modes/Abyss/AbyssBagMenu_Patch.cs
similarity index 100%
rename from MelonLoader/Patches/GameObjects/AbyssBagMenu_Patch.cs
rename to MelonLoader/Patches/Modes/Abyss/AbyssBagMenu_Patch.cs
diff --git a/MelonLoader/Patches/GameObjects/ButtonObjects/AbyssBuffButton_Patch.cs b/MelonLoader/Patches/Modes/Abyss/AbyssBuffButton_Patch.cs
similarity index 100%
rename from MelonLoader/Patches/GameObjects/ButtonObjects/AbyssBuffButton_Patch.cs
rename to MelonLoader/Patches/Modes/Abyss/AbyssBuffButton_Patch.cs
diff --git a/MelonLoader/Patches/Managers/AbyssBuffData_Patch.cs b/MelonLoader/Patches/Modes/Abyss/AbyssBuffData_Patch.cs
similarity index 100%
rename from MelonLoader/Patches/Managers/AbyssBuffData_Patch.cs
rename to MelonLoader/Patches/Modes/Abyss/AbyssBuffData_Patch.cs
diff --git a/MelonLoader/Patches/GameObjects/AbyssBuffMenu_Patch.cs b/MelonLoader/Patches/Modes/Abyss/AbyssBuffMenu_Patch.cs
similarity index 96%
rename from MelonLoader/Patches/GameObjects/AbyssBuffMenu_Patch.cs
rename to MelonLoader/Patches/Modes/Abyss/AbyssBuffMenu_Patch.cs
index c9e53e7..a416bea 100644
--- a/MelonLoader/Patches/GameObjects/AbyssBuffMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Abyss/AbyssBuffMenu_Patch.cs
@@ -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);
}
}
}
diff --git a/MelonLoader/Patches/GameObjects/AbyssCheckInBag_Patch.cs b/MelonLoader/Patches/Modes/Abyss/AbyssCheckInBag_Patch.cs
similarity index 100%
rename from MelonLoader/Patches/GameObjects/AbyssCheckInBag_Patch.cs
rename to MelonLoader/Patches/Modes/Abyss/AbyssCheckInBag_Patch.cs
diff --git a/MelonLoader/Patches/GameObjects/ButtonObjects/AbyssCheckSellMenu_Patch.cs b/MelonLoader/Patches/Modes/Abyss/AbyssCheckSellMenu_Patch.cs
similarity index 100%
rename from MelonLoader/Patches/GameObjects/ButtonObjects/AbyssCheckSellMenu_Patch.cs
rename to MelonLoader/Patches/Modes/Abyss/AbyssCheckSellMenu_Patch.cs
diff --git a/MelonLoader/Patches/GameObjects/AbyssDevelopMenu_Patch.cs b/MelonLoader/Patches/Modes/Abyss/AbyssDevelopMenu_Patch.cs
similarity index 100%
rename from MelonLoader/Patches/GameObjects/AbyssDevelopMenu_Patch.cs
rename to MelonLoader/Patches/Modes/Abyss/AbyssDevelopMenu_Patch.cs
diff --git a/MelonLoader/Patches/GameObjects/MinorObjects/AbyssGoods_Patch.cs b/MelonLoader/Patches/Modes/Abyss/AbyssGoods_Patch.cs
similarity index 92%
rename from MelonLoader/Patches/GameObjects/MinorObjects/AbyssGoods_Patch.cs
rename to MelonLoader/Patches/Modes/Abyss/AbyssGoods_Patch.cs
index 5735459..a20ee73 100644
--- a/MelonLoader/Patches/GameObjects/MinorObjects/AbyssGoods_Patch.cs
+++ b/MelonLoader/Patches/Modes/Abyss/AbyssGoods_Patch.cs
@@ -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
diff --git a/MelonLoader/Patches/Managers/AbyssInfo_Patch.cs b/MelonLoader/Patches/Modes/Abyss/AbyssInfo_Patch.cs
similarity index 100%
rename from MelonLoader/Patches/Managers/AbyssInfo_Patch.cs
rename to MelonLoader/Patches/Modes/Abyss/AbyssInfo_Patch.cs
diff --git a/MelonLoader/Patches/GameObjects/ButtonObjects/AbyssLevelEnter_Patch.cs b/MelonLoader/Patches/Modes/Abyss/AbyssLevelEnter_Patch.cs
similarity index 87%
rename from MelonLoader/Patches/GameObjects/ButtonObjects/AbyssLevelEnter_Patch.cs
rename to MelonLoader/Patches/Modes/Abyss/AbyssLevelEnter_Patch.cs
index b754b8e..4dc73a3 100644
--- a/MelonLoader/Patches/GameObjects/ButtonObjects/AbyssLevelEnter_Patch.cs
+++ b/MelonLoader/Patches/Modes/Abyss/AbyssLevelEnter_Patch.cs
@@ -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
diff --git a/MelonLoader/Patches/GameObjects/AbyssMenu2_Patch.cs b/MelonLoader/Patches/Modes/Abyss/AbyssMenu2_Patch.cs
similarity index 100%
rename from MelonLoader/Patches/GameObjects/AbyssMenu2_Patch.cs
rename to MelonLoader/Patches/Modes/Abyss/AbyssMenu2_Patch.cs
diff --git a/MelonLoader/Patches/GameObjects/AbyssMenu_Patch.cs b/MelonLoader/Patches/Modes/Abyss/AbyssMenu_Patch.cs
similarity index 97%
rename from MelonLoader/Patches/GameObjects/AbyssMenu_Patch.cs
rename to MelonLoader/Patches/Modes/Abyss/AbyssMenu_Patch.cs
index abef5ee..b6ebf8f 100644
--- a/MelonLoader/Patches/GameObjects/AbyssMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Abyss/AbyssMenu_Patch.cs
@@ -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
diff --git a/MelonLoader/Patches/GameObjects/AbyssSelectBuffWindow_Patch.cs b/MelonLoader/Patches/Modes/Abyss/AbyssSelectBuffWindow_Patch.cs
similarity index 85%
rename from MelonLoader/Patches/GameObjects/AbyssSelectBuffWindow_Patch.cs
rename to MelonLoader/Patches/Modes/Abyss/AbyssSelectBuffWindow_Patch.cs
index 8af7930..e4ac857 100644
--- a/MelonLoader/Patches/GameObjects/AbyssSelectBuffWindow_Patch.cs
+++ b/MelonLoader/Patches/Modes/Abyss/AbyssSelectBuffWindow_Patch.cs
@@ -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)
{
diff --git a/MelonLoader/Patches/GameObjects/AbyssSettlementMenu_Patch.cs b/MelonLoader/Patches/Modes/Abyss/AbyssSettlementMenu_Patch.cs
similarity index 100%
rename from MelonLoader/Patches/GameObjects/AbyssSettlementMenu_Patch.cs
rename to MelonLoader/Patches/Modes/Abyss/AbyssSettlementMenu_Patch.cs
diff --git a/MelonLoader/Patches/GameObjects/AbyssStoreMenu_Patch.cs b/MelonLoader/Patches/Modes/Abyss/AbyssStoreMenu_Patch.cs
similarity index 92%
rename from MelonLoader/Patches/GameObjects/AbyssStoreMenu_Patch.cs
rename to MelonLoader/Patches/Modes/Abyss/AbyssStoreMenu_Patch.cs
index ccbc895..971e7d5 100644
--- a/MelonLoader/Patches/GameObjects/AbyssStoreMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Abyss/AbyssStoreMenu_Patch.cs
@@ -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
diff --git a/MelonLoader/Patches/GameObjects/GardenBagMenu_Patch.cs b/MelonLoader/Patches/Modes/Harvest/GardenBagMenu_Patch.cs
similarity index 55%
rename from MelonLoader/Patches/GameObjects/GardenBagMenu_Patch.cs
rename to MelonLoader/Patches/Modes/Harvest/GardenBagMenu_Patch.cs
index 093cacd..6a377e6 100644
--- a/MelonLoader/Patches/GameObjects/GardenBagMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Harvest/GardenBagMenu_Patch.cs
@@ -15,26 +15,6 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
{
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
- foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren())
- {
- 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())
{
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())
+ // //{
+ // // if (txt.transform.parent.name.Contains("Close"))
+ // // {
+ // // txt.text = StringStore.TranslateText("合上");
+ // // }
+ // // else
+ // // {
+ // // txt.text = StringStore.TranslateText(txt.text);
+ // // }
+ // // txt.font = fontAsset;
+ // //}
+ //}
}
}
\ No newline at end of file
diff --git a/MelonLoader/Patches/GameObjects/GardenCard_Patch.cs b/MelonLoader/Patches/Modes/Harvest/GardenCard_Patch.cs
similarity index 100%
rename from MelonLoader/Patches/GameObjects/GardenCard_Patch.cs
rename to MelonLoader/Patches/Modes/Harvest/GardenCard_Patch.cs
diff --git a/MelonLoader/Patches/GameObjects/TreasureConfirmMenu_Patch.cs b/MelonLoader/Patches/Modes/Harvest/TreasureConfirmMenu_Patch.cs
similarity index 93%
rename from MelonLoader/Patches/GameObjects/TreasureConfirmMenu_Patch.cs
rename to MelonLoader/Patches/Modes/Harvest/TreasureConfirmMenu_Patch.cs
index 9cbf1a0..2f5c947 100644
--- a/MelonLoader/Patches/GameObjects/TreasureConfirmMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Harvest/TreasureConfirmMenu_Patch.cs
@@ -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
diff --git a/MelonLoader/Patches/GameObjects/TreasureEquipmentMenu_Patch.cs b/MelonLoader/Patches/Modes/Harvest/TreasureEquipmentMenu_Patch.cs
similarity index 95%
rename from MelonLoader/Patches/GameObjects/TreasureEquipmentMenu_Patch.cs
rename to MelonLoader/Patches/Modes/Harvest/TreasureEquipmentMenu_Patch.cs
index f80e26d..1033f57 100644
--- a/MelonLoader/Patches/GameObjects/TreasureEquipmentMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Harvest/TreasureEquipmentMenu_Patch.cs
@@ -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
diff --git a/MelonLoader/Patches/GameObjects/TreasureEvacuateMenu_Patch.cs b/MelonLoader/Patches/Modes/Harvest/TreasureEvacuateMenu_Patch.cs
similarity index 94%
rename from MelonLoader/Patches/GameObjects/TreasureEvacuateMenu_Patch.cs
rename to MelonLoader/Patches/Modes/Harvest/TreasureEvacuateMenu_Patch.cs
index f32c011..e133b8f 100644
--- a/MelonLoader/Patches/GameObjects/TreasureEvacuateMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Harvest/TreasureEvacuateMenu_Patch.cs
@@ -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
diff --git a/MelonLoader/Patches/GameObjects/TreasureMainMenu_Patch.cs b/MelonLoader/Patches/Modes/Harvest/TreasureMainMenu_Patch.cs
similarity index 92%
rename from MelonLoader/Patches/GameObjects/TreasureMainMenu_Patch.cs
rename to MelonLoader/Patches/Modes/Harvest/TreasureMainMenu_Patch.cs
index ea0478e..df5b950 100644
--- a/MelonLoader/Patches/GameObjects/TreasureMainMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Harvest/TreasureMainMenu_Patch.cs
@@ -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
diff --git a/MelonLoader/Patches/Managers/TreasureManager_Patch.cs b/MelonLoader/Patches/Modes/Harvest/TreasureManager_Patch.cs
similarity index 94%
rename from MelonLoader/Patches/Managers/TreasureManager_Patch.cs
rename to MelonLoader/Patches/Modes/Harvest/TreasureManager_Patch.cs
index 9b20132..9e9f92f 100644
--- a/MelonLoader/Patches/Managers/TreasureManager_Patch.cs
+++ b/MelonLoader/Patches/Modes/Harvest/TreasureManager_Patch.cs
@@ -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
diff --git a/MelonLoader/Patches/GameObjects/TreasureStoreMenu_Patch.cs b/MelonLoader/Patches/Modes/Harvest/TreasureStoreMenu_Patch.cs
similarity index 92%
rename from MelonLoader/Patches/GameObjects/TreasureStoreMenu_Patch.cs
rename to MelonLoader/Patches/Modes/Harvest/TreasureStoreMenu_Patch.cs
index 1b771c6..05c3d8c 100644
--- a/MelonLoader/Patches/GameObjects/TreasureStoreMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Harvest/TreasureStoreMenu_Patch.cs
@@ -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
diff --git a/MelonLoader/Patches/GameObjects/TreasureUpgradeMenu_Patch.cs b/MelonLoader/Patches/Modes/Harvest/TreasureUpgradeMenu_Patch.cs
similarity index 97%
rename from MelonLoader/Patches/GameObjects/TreasureUpgradeMenu_Patch.cs
rename to MelonLoader/Patches/Modes/Harvest/TreasureUpgradeMenu_Patch.cs
index a7d43bb..fc8c177 100644
--- a/MelonLoader/Patches/GameObjects/TreasureUpgradeMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Harvest/TreasureUpgradeMenu_Patch.cs
@@ -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
diff --git a/MelonLoader/Patches/GameObjects/TreasureWarehouseMenu_Patch.cs b/MelonLoader/Patches/Modes/Harvest/TreasureWarehouseMenu_Patch.cs
similarity index 97%
rename from MelonLoader/Patches/GameObjects/TreasureWarehouseMenu_Patch.cs
rename to MelonLoader/Patches/Modes/Harvest/TreasureWarehouseMenu_Patch.cs
index fb7d1a9..edddd80 100644
--- a/MelonLoader/Patches/GameObjects/TreasureWarehouseMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Harvest/TreasureWarehouseMenu_Patch.cs
@@ -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
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelBuffMenu_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelBuffMenu_Patch.cs
new file mode 100644
index 0000000..c0d6da3
--- /dev/null
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelBuffMenu_Patch.cs
@@ -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);
+// }
+// }
+// }
+//}
\ No newline at end of file
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelBuffMgr_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelBuffMgr_Patch.cs
new file mode 100644
index 0000000..7d583df
--- /dev/null
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelBuffMgr_Patch.cs
@@ -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);
+// }
+// }
+//}
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelBuffOptionButton_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelBuffOptionButton_Patch.cs
new file mode 100644
index 0000000..a98e95b
--- /dev/null
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelBuffOptionButton_Patch.cs
@@ -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 buffSet = translatedTravelBuffs[buffLinks[button.buffType]];
+
+// string buff = button.show != null && button.introduce.text != "词条已选完" ? buffSet[button.buffIndex] : StringStore.TranslateText("词条已选完");
+
+// button.introduce.text = buff;
+// }
+// }
+
+// //List buffSet = translatedTravelBuffs[buffLinks[__instance.buffType]];
+// //string buff = (__instance.show != null) ? buffSet[__instance.buffIndex] : StringStore.TranslateText("无");
+// //__instance.introduce.text = buff;
+//}
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelBuff_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelBuff_Patch.cs
new file mode 100644
index 0000000..fbed59a
--- /dev/null
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelBuff_Patch.cs
@@ -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);
+// }
+// }
+//}
\ No newline at end of file
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelLookBuff_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelLookBuff_Patch.cs
new file mode 100644
index 0000000..a7ac39f
--- /dev/null
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelLookBuff_Patch.cs
@@ -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())
+// {
+// 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())
+// {
+// text.text = StringStore.TranslateText(text.text);
+// }
+// }
+
+// [HarmonyPatch(nameof(TravelLookBuff.SetBuff))]
+// [HarmonyPostfix]
+// public static void Post_SetBuff(TravelLookBuff __instance)
+// {
+// List 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())
+// {
+// text.text = StringStore.TranslateText(text.text);
+// }
+// }
+// }
+//}
\ No newline at end of file
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelLookMenu_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelLookMenu_Patch.cs
new file mode 100644
index 0000000..b00281a
--- /dev/null
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelLookMenu_Patch.cs
@@ -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())
+// {
+// 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())
+// {
+// 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;
+// }
+// }
+// }
+//}
\ No newline at end of file
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelMgr_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelMgr_Patch.cs
new file mode 100644
index 0000000..7a53177
--- /dev/null
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelMgr_Patch.cs
@@ -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 buffLinks = new Dictionary()
+// {
+// { BuffType.AdvancedBuff, "advancedUpgrades" },
+// { BuffType.UltimateBuff, "ultimateUpgrades" },
+// { BuffType.UnlockPlant, "strongUltimates" },
+// { BuffType.Debuff, "debuffs" },
+// };
+
+// public static Dictionary> dumpedTravelBuffs = new Dictionary>()
+// {
+// { "advancedUpgrades", [] },
+// { "ultimateUpgrades", [] },
+// { "strongUltimates", [] },
+// { "debuffs", [] }
+// };
+
+// public static Dictionary> translatedTravelBuffs = new Dictionary>();
+
+// public static void DumpTravelBuffs(Il2CppSystem.Collections.Generic.Dictionary source, Dictionary> 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>() // 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>>(travelBuffs);
+// }
+// }
+//}
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelRefresh_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelRefresh_Patch.cs
new file mode 100644
index 0000000..e7263c2
--- /dev/null
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelRefresh_Patch.cs
@@ -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);
+// }
+// }
+//}
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelStore_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelStore_Patch.cs
new file mode 100644
index 0000000..9de6677
--- /dev/null
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelStore_Patch.cs
@@ -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();
+// 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);
+// }
+// }
+// }
+//}
diff --git a/MelonLoader/Patches/GameObjects/AdvantureEvolutionMenu_Patch.cs b/MelonLoader/Patches/Modes/Starbound/AdvantureEvolutionMenu_Patch.cs
similarity index 98%
rename from MelonLoader/Patches/GameObjects/AdvantureEvolutionMenu_Patch.cs
rename to MelonLoader/Patches/Modes/Starbound/AdvantureEvolutionMenu_Patch.cs
index 30399e7..e2176fc 100644
--- a/MelonLoader/Patches/GameObjects/AdvantureEvolutionMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Starbound/AdvantureEvolutionMenu_Patch.cs
@@ -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
diff --git a/MelonLoader/Patches/GameObjects/AdvantureHelpMenu_Patch.cs b/MelonLoader/Patches/Modes/Starbound/AdvantureHelpMenu_Patch.cs
similarity index 91%
rename from MelonLoader/Patches/GameObjects/AdvantureHelpMenu_Patch.cs
rename to MelonLoader/Patches/Modes/Starbound/AdvantureHelpMenu_Patch.cs
index 80a540d..4f9751f 100644
--- a/MelonLoader/Patches/GameObjects/AdvantureHelpMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Starbound/AdvantureHelpMenu_Patch.cs
@@ -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
diff --git a/MelonLoader/Patches/GameObjects/AdvantureMenu2_Patch.cs b/MelonLoader/Patches/Modes/Starbound/AdvantureMenu2_Patch.cs
similarity index 93%
rename from MelonLoader/Patches/GameObjects/AdvantureMenu2_Patch.cs
rename to MelonLoader/Patches/Modes/Starbound/AdvantureMenu2_Patch.cs
index 2c46df7..46814ba 100644
--- a/MelonLoader/Patches/GameObjects/AdvantureMenu2_Patch.cs
+++ b/MelonLoader/Patches/Modes/Starbound/AdvantureMenu2_Patch.cs
@@ -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
diff --git a/MelonLoader/Patches/GameObjects/AdvantureMenu_Patch.cs b/MelonLoader/Patches/Modes/Starbound/AdvantureMenu_Patch.cs
similarity index 97%
rename from MelonLoader/Patches/GameObjects/AdvantureMenu_Patch.cs
rename to MelonLoader/Patches/Modes/Starbound/AdvantureMenu_Patch.cs
index de0459d..91c593b 100644
--- a/MelonLoader/Patches/GameObjects/AdvantureMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Starbound/AdvantureMenu_Patch.cs
@@ -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
diff --git a/MelonLoader/Patches/GameObjects/AdvantureMissionMenu_Patch.cs b/MelonLoader/Patches/Modes/Starbound/AdvantureMissionMenu_Patch.cs
similarity index 97%
rename from MelonLoader/Patches/GameObjects/AdvantureMissionMenu_Patch.cs
rename to MelonLoader/Patches/Modes/Starbound/AdvantureMissionMenu_Patch.cs
index bb23854..2aac117 100644
--- a/MelonLoader/Patches/GameObjects/AdvantureMissionMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Starbound/AdvantureMissionMenu_Patch.cs
@@ -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
diff --git a/MelonLoader/Patches/GameObjects/AdvantureStarMenu_Patch.cs b/MelonLoader/Patches/Modes/Starbound/AdvantureStarMenu_Patch.cs
similarity index 97%
rename from MelonLoader/Patches/GameObjects/AdvantureStarMenu_Patch.cs
rename to MelonLoader/Patches/Modes/Starbound/AdvantureStarMenu_Patch.cs
index 9af61ce..2b8c4b1 100644
--- a/MelonLoader/Patches/GameObjects/AdvantureStarMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Starbound/AdvantureStarMenu_Patch.cs
@@ -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
diff --git a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
index 4d83fe5..c463798 100644
--- a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
+++ b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
@@ -13,7 +13,7 @@
latest
enable
Debug;DebugEnglish;ReleaseMulti;ReleaseEnglish;DebugTesting;ReleaseOther;DebugObfuscate;ReleaseObfuscate
- C:\Users\rainb\Desktop\PC_PVZ-Fusion_3.3.1
+ C:\Users\rainb\Desktop\PC_PVZ-Fusion_3.4.1
AnyCPU;ARM64;x64
@@ -475,12 +475,12 @@
-
+
-
+
-
+
@@ -488,11 +488,11 @@
-
+
-
+
@@ -518,10 +518,10 @@
-
-
-
-
+
+
+
+
From be09cbf7e5a71e7379971027b992e4554ce0c9a8 Mon Sep 17 00:00:00 2001
From: SillyStar-Github <90102598+SillyStar-Github@users.noreply.github.com>
Date: Tue, 10 Feb 2026 21:17:45 -0500
Subject: [PATCH 08/10] small
---
.../Modes/Harvest/GardenBagMenu_Patch.cs | 2 +-
.../Patches/Modes/Harvest/GardenCard_Patch.cs | 2 +-
...PvZ Fusion Translator [MelonLoader].csproj | 62 +++++++++----------
3 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/MelonLoader/Patches/Modes/Harvest/GardenBagMenu_Patch.cs b/MelonLoader/Patches/Modes/Harvest/GardenBagMenu_Patch.cs
index 6a377e6..3f009bd 100644
--- a/MelonLoader/Patches/Modes/Harvest/GardenBagMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Harvest/GardenBagMenu_Patch.cs
@@ -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(GardenBagMenu))]
public static class GardenBagMenu_Patch
diff --git a/MelonLoader/Patches/Modes/Harvest/GardenCard_Patch.cs b/MelonLoader/Patches/Modes/Harvest/GardenCard_Patch.cs
index cb4e23d..d1baac8 100644
--- a/MelonLoader/Patches/Modes/Harvest/GardenCard_Patch.cs
+++ b/MelonLoader/Patches/Modes/Harvest/GardenCard_Patch.cs
@@ -2,7 +2,7 @@
using Il2Cpp;
using PvZ_Fusion_Translator.AssetStore;
-namespace PvZ_Fusion_Translator.Patches.GameObjects
+namespace PvZ_Fusion_Translator.Patches.Modes.Harvest
{
[HarmonyPatch(typeof(GardenCard))]
public static class GardenCard_Patch
diff --git a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
index c463798..3ccbe6a 100644
--- a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
+++ b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
@@ -400,13 +400,13 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -423,73 +423,73 @@
-
+
-
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
+
+
-
+
From 4f532e7b4929221ba52d4353aa4a43b1d4559ce4 Mon Sep 17 00:00:00 2001
From: SillyStar-Github <90102598+SillyStar-Github@users.noreply.github.com>
Date: Thu, 12 Feb 2026 03:16:32 -0500
Subject: [PATCH 09/10] a BUNCH of odyssey/investment translation
---
MelonLoader/Core.cs | 11 +-
MelonLoader/FileLoader.cs | 73 ++++++-
.../BaseTextObjects/InGameText_Patch.cs | 6 +-
.../Patches/Managers/DifficultyMgr_Patch.cs | 14 +-
.../Managers/OppositeBuffManager_Patch.cs | 38 ++--
.../Modes/Odyssey/TravelBuffMenu_Patch.cs | 46 ++---
.../Odyssey/TravelBuffOptionButton_Patch.cs | 70 +++----
.../Modes/Odyssey/TravelInvestMenu_Patch.cs | 25 +++
.../Modes/Odyssey/TravelLookBuff_Patch.cs | 92 ++++-----
.../Modes/Odyssey/TravelLookMenu_Patch.cs | 82 ++++----
.../Patches/Modes/Odyssey/TravelMgr_Patch.cs | 186 ++++++++++--------
.../Modes/Odyssey/TravelStoreWindow_Patch.cs | 97 +++++++++
.../Modes/Odyssey/TravelStore_Patch.cs | 127 ++++++------
.../Modes/Odyssey/TravelSynergyMenu_Patch.cs | 110 +++++++++++
...PvZ Fusion Translator [MelonLoader].csproj | 3 +
15 files changed, 647 insertions(+), 333 deletions(-)
create mode 100644 MelonLoader/Patches/Modes/Odyssey/TravelInvestMenu_Patch.cs
create mode 100644 MelonLoader/Patches/Modes/Odyssey/TravelStoreWindow_Patch.cs
create mode 100644 MelonLoader/Patches/Modes/Odyssey/TravelSynergyMenu_Patch.cs
diff --git a/MelonLoader/Core.cs b/MelonLoader/Core.cs
index c9eb3b3..05812ca 100644
--- a/MelonLoader/Core.cs
+++ b/MelonLoader/Core.cs
@@ -1,10 +1,14 @@
-using Il2CppTMPro;
+using Il2Cpp;
+using Il2CppTMPro;
using MelonLoader;
using MelonLoader.Utils;
using PvZ_Fusion_Translator.AssetStore;
using PvZ_Fusion_Translator.Patches.Managers;
+using PvZ_Fusion_Translator.Patches.Modes.Odyssey;
+using System.Runtime.CompilerServices;
+using System.Text.Json;
using UnityEngine;
-using Il2Cpp;
+using static PvZ_Fusion_Translator.FileLoader;
[assembly: MelonInfo(typeof(PvZ_Fusion_Translator.Core), "PvZ Fusion Translator", "231.0.0", "dynaslash / arifrios1st / lancerx0 / JustNull / Dakosha / Mamoru-kun / cassidy / Teyliu", null)]
[assembly: MelonGame("LanPiaoPiao", "PlantsVsZombiesRH")]
@@ -42,7 +46,8 @@ namespace PvZ_Fusion_Translator
{
dtStart = DateTime.Now;
replaceTextureRoutine = MelonCoroutines.Start(TextureStore.ReplaceTexturesCoroutine());
- }
+ TravelMgr_Patch.DumpTravelBuffs();
+ }
public override void OnDeinitializeMelon()
{
diff --git a/MelonLoader/FileLoader.cs b/MelonLoader/FileLoader.cs
index c51f3d7..f4ca6b2 100644
--- a/MelonLoader/FileLoader.cs
+++ b/MelonLoader/FileLoader.cs
@@ -2,11 +2,11 @@
using MelonLoader;
using PvZ_Fusion_Translator.AssetStore;
using PvZ_Fusion_Translator.Patches.GameObjects.MinorObjects;
+using PvZ_Fusion_Translator.Patches.Modes.Odyssey;
using PvZ_Fusion_Translator.Patches.OtherManagers;
using System.Text.Encodings.Web;
using System.Text.Json;
using UnityEngine;
-using UnityEngine.Rendering;
namespace PvZ_Fusion_Translator
{
@@ -81,7 +81,11 @@ namespace PvZ_Fusion_Translator
}
Zombie_Patch.LoadHPStrings();
}
- }
+ else if(fileName.EndsWith("travel_buffs"))
+ {
+ TravelMgr_Patch.translatedTravelBuffs = JsonSerializer.Deserialize>>(jsonString);
+ }
+ }
SaveStrings();
DumpJson();
}
@@ -318,6 +322,68 @@ namespace PvZ_Fusion_Translator
File.WriteAllText(Path.Combine(dumpDir, "ZombieStrings.json"), ZombieStrings);
File.WriteAllText(Path.Combine(dumpDir, "AbyssBuffData.json"), AbyssBuffData);
+ // dump iz tips
+ var izLevelData = Resources.LoadAll("izleveldata");
+ Dictionary izLevelDataDump = new Dictionary();
+
+ string izTranslatedPath = Path.Combine(GetAssetDir(AssetType.Strings, Utils.Language), "tips_iz.json");
+ if (!File.Exists(izTranslatedPath))
+ {
+ File.WriteAllText(izTranslatedPath, JsonSerializer.Serialize(izLevelDataDump));
+ }
+ var izTranslatedTips = JsonSerializer.Deserialize>(File.ReadAllText(izTranslatedPath));
+
+ foreach (var level in izLevelData)
+ {
+ string data = level.text;
+ LevelData levelData = JsonUtility.FromJson(data);
+ if(levelData.tips != null)
+ {
+ izLevelDataDump.Add(level.name, levelData.tips);
+ if(izTranslatedTips.ContainsKey(level.name) && !StringStore.translationString.ContainsKey(levelData.tips))
+ {
+ StringStore.translationString.Add(levelData.tips, izTranslatedTips[level.name]);
+ }
+ }
+ }
+
+ File.WriteAllText(Path.Combine(dumpDir, "tips_iz.json"), JsonSerializer.Serialize(izLevelDataDump, new JsonSerializerOptions
+ {
+ WriteIndented = true,
+ Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
+ }));
+
+ // dump fusion showcase tips
+ var fusionShowcaseData = Resources.LoadAll("leveldata/explore");
+ Dictionary fusionShowcaseDataDump = new Dictionary();
+
+ string fsTranslatedPath = Path.Combine(GetAssetDir(AssetType.Strings, Utils.Language), "tips_fs.json");
+ if(!File.Exists(fsTranslatedPath))
+ {
+ File.WriteAllText(fsTranslatedPath, JsonSerializer.Serialize(fusionShowcaseDataDump));
+ }
+ var fsTranslatedTips = JsonSerializer.Deserialize>(File.ReadAllText(fsTranslatedPath));
+
+ foreach (var level in fusionShowcaseData)
+ {
+ string data = level.text;
+ LevelData levelData = JsonUtility.FromJson(data);
+ if (levelData.tips != null)
+ {
+ fusionShowcaseDataDump.Add(level.name, levelData.tips);
+ if (fsTranslatedTips.ContainsKey(level.name) && !StringStore.translationString.ContainsKey(levelData.tips))
+ {
+ StringStore.translationString.Add(levelData.tips, fsTranslatedTips[level.name]);
+ }
+ }
+ }
+
+ File.WriteAllText(Path.Combine(dumpDir, "tips_fs.json"), JsonSerializer.Serialize(fusionShowcaseDataDump, new JsonSerializerOptions
+ {
+ WriteIndented = true,
+ Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
+ }));
+
Dictionary achievementsList = new Dictionary();
foreach (Il2CppSystem.Collections.Generic.KeyValuePair> entry in AchievementClip.achievementsText)
{
@@ -328,7 +394,7 @@ namespace PvZ_Fusion_Translator
WriteIndented = true,
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
}));
- }
+ }
#if DEBUG
public static void DumpUntranslatedStrings(string text)
@@ -361,6 +427,7 @@ namespace PvZ_Fusion_Translator
}
}
#endif
+
#if MULTI_LANGUAGE
internal static void LoadLanguage()
diff --git a/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs b/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
index 175eb58..6fa5ac4 100644
--- a/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
+++ b/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs
@@ -2,6 +2,8 @@
using Il2Cpp;
using Il2CppTMPro;
using PvZ_Fusion_Translator.AssetStore;
+using PvZ_Fusion_Translator.Patches.Modes.Odyssey;
+
//using PvZ_Fusion_Translator.Patches.Modes.Odyssey;
using System.Text.RegularExpressions;
using System.Xml.Linq;
@@ -20,8 +22,8 @@ namespace PvZ_Fusion_Translator.Patches.BaseTextObjects
foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren())
{
- string travelMatch = "";
string originalText = txt.text;
+ string travelMatch = TravelMgr_Patch.MatchTravelBuff(originalText);
if (txt.gameObject.name.Contains("shadow"))
{
@@ -41,7 +43,7 @@ namespace PvZ_Fusion_Translator.Patches.BaseTextObjects
}
}
}
- else if(Regex.Match(txt.text, @"(]*>.*?)", RegexOptions.Singleline).Success)
+ else if((Regex.Match(txt.text, @"(]*>.*?)", RegexOptions.Singleline).Success) && !StringStore.translationString.ContainsKey(txt.text))
{
txt.text = StringStore.TranslateColorText(txt.text, true);
if (txt.gameObject.name.Contains("main"))
diff --git a/MelonLoader/Patches/Managers/DifficultyMgr_Patch.cs b/MelonLoader/Patches/Managers/DifficultyMgr_Patch.cs
index 4b294d8..3d05ff1 100644
--- a/MelonLoader/Patches/Managers/DifficultyMgr_Patch.cs
+++ b/MelonLoader/Patches/Managers/DifficultyMgr_Patch.cs
@@ -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;
+ }
}
}
diff --git a/MelonLoader/Patches/Managers/OppositeBuffManager_Patch.cs b/MelonLoader/Patches/Managers/OppositeBuffManager_Patch.cs
index 4913c91..fbf82c7 100644
--- a/MelonLoader/Patches/Managers/OppositeBuffManager_Patch.cs
+++ b/MelonLoader/Patches/Managers/OppositeBuffManager_Patch.cs
@@ -2,7 +2,7 @@
using Il2Cpp;
using Il2CppTMPro;
using PvZ_Fusion_Translator.AssetStore;
-//using PvZ_Fusion_Translator.Patches.Modes.Odyssey;
+using PvZ_Fusion_Translator.Patches.Modes.Odyssey;
using System.Text.RegularExpressions;
using UnityEngine;
@@ -11,11 +11,11 @@ namespace PvZ_Fusion_Translator.Patches.Managers
[HarmonyPatch(typeof(OppositeBuffManager))]
public static class OppositeBuffManager_Patch
{
- //public static Dictionary buffLinks = TravelMgr_Patch.buffLinks;
- //public static Dictionary> 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 buffLinks = TravelMgr_Patch.buffLinks;
+ public static Dictionary> 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]
@@ -29,21 +29,21 @@ namespace PvZ_Fusion_Translator.Patches.Managers
public static void TranslateOppositeText(Il2CppSystem.Collections.Generic.List 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;
+ }
}
}
}
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelBuffMenu_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelBuffMenu_Patch.cs
index c0d6da3..95bf66a 100644
--- a/MelonLoader/Patches/Modes/Odyssey/TravelBuffMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelBuffMenu_Patch.cs
@@ -1,24 +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;
+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);
-// }
-// }
-// }
-//}
\ No newline at end of file
+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);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelBuffOptionButton_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelBuffOptionButton_Patch.cs
index a98e95b..a0ef13c 100644
--- a/MelonLoader/Patches/Modes/Odyssey/TravelBuffOptionButton_Patch.cs
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelBuffOptionButton_Patch.cs
@@ -1,41 +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;
+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);
-// }
+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);
-// }
+ [HarmonyPatch(nameof(TravelBuffOptionButton.OnAnimOver))]
+ [HarmonyPostfix]
+ public static void OnAnimOver(TravelBuffOptionButton __instance)
+ {
+ TranslateOptionButton(__instance);
+ }
-// public static void TranslateOptionButton(TravelBuffOptionButton button)
-// {
-// List buffSet = translatedTravelBuffs[buffLinks[button.buffType]];
+ public static void TranslateOptionButton(TravelBuffOptionButton button)
+ {
+ SortedDictionary buffSet = translatedTravelBuffs[buffLinks[button.buffType]];
-// string buff = button.show != null && button.introduce.text != "词条已选完" ? buffSet[button.buffIndex] : StringStore.TranslateText("词条已选完");
+ string buff = button.show != null && button.introduce.text != "词条已选完" ? buffSet[button.buffIndex] : StringStore.TranslateText("词条已选完");
-// button.introduce.text = buff;
-// }
-// }
+ button.introduce.text = buff;
+ }
+ }
-// //List buffSet = translatedTravelBuffs[buffLinks[__instance.buffType]];
-// //string buff = (__instance.show != null) ? buffSet[__instance.buffIndex] : StringStore.TranslateText("无");
-// //__instance.introduce.text = buff;
-//}
+ //List buffSet = translatedTravelBuffs[buffLinks[__instance.buffType]];
+ //string buff = (__instance.show != null) ? buffSet[__instance.buffIndex] : StringStore.TranslateText("无");
+ //__instance.introduce.text = buff;
+}
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelInvestMenu_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelInvestMenu_Patch.cs
new file mode 100644
index 0000000..bb02cf8
--- /dev/null
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelInvestMenu_Patch.cs
@@ -0,0 +1,25 @@
+using HarmonyLib;
+using Il2Cpp;
+using Il2CppTMPro;
+using PvZ_Fusion_Translator.AssetStore;
+using UnityEngine;
+
+namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
+{
+ [HarmonyPatch(typeof(TravelInvestMenu))]
+ public static class TravelInvestMenu_Patch
+ {
+ [HarmonyPatch(nameof(TravelInvestMenu.Start))]
+ [HarmonyPostfix]
+ private static void Start(TravelInvestMenu __instance)
+ {
+ Transform titleText = __instance.transform.Find("Title");
+ TextMeshProUGUI shadowText = titleText.GetComponent();
+
+ TextMeshProUGUI regularText = titleText.transform.Find("Title2").GetComponent();
+ regularText.text = StringStore.TranslateText(regularText.text);
+
+ shadowText.text = Utils.RemoveColorTags(regularText.text);
+ }
+ }
+}
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelLookBuff_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelLookBuff_Patch.cs
index a7ac39f..ecf918a 100644
--- a/MelonLoader/Patches/Modes/Odyssey/TravelLookBuff_Patch.cs
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelLookBuff_Patch.cs
@@ -1,51 +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;
+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;
+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())
-// {
-// text.text = StringStore.TranslateText(text.text);
-// }
-// }
+ foreach (TextMeshProUGUI text in __instance.transform.FindChild("Images").FindChild("Button").GetComponentsInChildren())
+ {
+ 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())
-// {
-// 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())
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
+ }
-// [HarmonyPatch(nameof(TravelLookBuff.SetBuff))]
-// [HarmonyPostfix]
-// public static void Post_SetBuff(TravelLookBuff __instance)
-// {
-// List buffSet = translatedTravelBuffs[buffLinks[__instance.buffType]];
-// string buffText = __instance.buffIndex < buffSet.Count ? buffSet[__instance.buffIndex] : StringStore.TranslateText(__instance.introduce.text);
-// __instance.introduce.text = buffText;
+ [HarmonyPatch(nameof(TravelLookBuff.SetBuff))]
+ [HarmonyPostfix]
+ public static void Post_SetBuff(TravelLookBuff __instance)
+ {
+ SortedDictionary buffSet = translatedTravelBuffs[buffLinks[__instance.buffType]];
+ string buffText = buffSet.ContainsKey(__instance.buffIndex) ? buffSet[__instance.buffIndex] : StringStore.TranslateText(__instance.introduce.text);
+ __instance.introduce.text = buffText;
-// foreach (TextMeshProUGUI text in __instance.transform.FindChild("Images").FindChild("Button").GetComponentsInChildren())
-// {
-// text.text = StringStore.TranslateText(text.text);
-// }
-// }
-// }
-//}
\ No newline at end of file
+ foreach (TextMeshProUGUI text in __instance.transform.FindChild("Images").FindChild("Button").GetComponentsInChildren())
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelLookMenu_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelLookMenu_Patch.cs
index b00281a..cda2c7a 100644
--- a/MelonLoader/Patches/Modes/Odyssey/TravelLookMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelLookMenu_Patch.cs
@@ -1,46 +1,46 @@
-//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(TravelLookMenu))]
-// public static class TravelLookMenu_Patch
-// {
-// public static string savedAssetString = "";
+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())
-// {
-// txt.text = StringStore.TranslateText(txt.text);
-// txt.font = FontStore.LoadTMPFont(Utils.Language.ToString());
-// }
+ [HarmonyPatch(nameof(TravelLookMenu.Start))]
+ [HarmonyPostfix]
+ private static void Postfix_Start(TravelLookMenu __instance)
+ {
+ foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren())
+ {
+ 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())
-// {
-// txt.text = StringStore.TranslateText("合上");
-// txt.font = FontStore.LoadTMPFont(Utils.Language.ToString());
-// }
+ Transform quitButtonTransform = __instance.transform.Find("Quit");
+ foreach (TextMeshProUGUI txt in quitButtonTransform.GetComponentsInChildren())
+ {
+ txt.text = StringStore.TranslateText("合上");
+ txt.font = FontStore.LoadTMPFont(Utils.Language.ToString());
+ }
-// __instance.treasureText.text = StringStore.TranslateText(__instance.treasureText.text);
-// savedAssetString = __instance.treasureText.text;
-// }
+ __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;
-// }
-// }
-// }
-//}
\ No newline at end of file
+ [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;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelMgr_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelMgr_Patch.cs
index 7a53177..c214ddc 100644
--- a/MelonLoader/Patches/Modes/Odyssey/TravelMgr_Patch.cs
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelMgr_Patch.cs
@@ -1,102 +1,114 @@
-//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;
+using HarmonyLib;
+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 Unity.Collections;
+using static PvZ_Fusion_Translator.FileLoader;
-//namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
-//{
-// [HarmonyPatch(typeof(TravelMgr))]
-// public static class TravelMgr_Patch
-// {
-// public static Dictionary buffLinks = new Dictionary()
-// {
-// { BuffType.AdvancedBuff, "advancedUpgrades" },
-// { BuffType.UltimateBuff, "ultimateUpgrades" },
-// { BuffType.UnlockPlant, "strongUltimates" },
-// { BuffType.Debuff, "debuffs" },
-// };
+namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
+{
+ [HarmonyPatch(typeof(TravelMgr))]
+ public static class TravelMgr_Patch
+ {
+ public static Dictionary> dumpedTravelBuffs = new()
+ {
+ { "advancedBuffs", new SortedDictionary() },
+ { "ultimateBuffs", new SortedDictionary() },
+ { "debuffs", new SortedDictionary() },
+ { "unlocks", new SortedDictionary() },
+ { "investmentBuffs", new SortedDictionary() }
+ };
-// public static Dictionary> dumpedTravelBuffs = new Dictionary>()
-// {
-// { "advancedUpgrades", [] },
-// { "ultimateUpgrades", [] },
-// { "strongUltimates", [] },
-// { "debuffs", [] }
-// };
+ public static Dictionary> translatedTravelBuffs = new()
+ {
+ { "advancedBuffs", new SortedDictionary() },
+ { "ultimateBuffs", new SortedDictionary() },
+ { "debuffs", new SortedDictionary() },
+ { "unlocks", new SortedDictionary() },
+ { "investmentBuffs", new SortedDictionary() }
+ };
-// public static Dictionary> translatedTravelBuffs = new Dictionary>();
+ public static Dictionary buffLinks = new()
+ {
+ { BuffType.AdvancedBuff, "advancedBuffs" },
+ { BuffType.UltimateBuff, "ultimateBuffs" },
+ { BuffType.Debuff, "debuffs" },
+ { BuffType.UnlockPlant, "unlocks" },
+ { BuffType.InvestmentBuff, "investmentBuffs" }
+ };
-// public static void DumpTravelBuffs(Il2CppSystem.Collections.Generic.Dictionary source, Dictionary> dest, string index)
-// {
-// foreach (var i in source)
-// {
-// if (!Utils.CheckForUntranslatedText(i.Value))
-// {
-// break;
-// }
-// dest[index].Add(i.Value);
-// }
-// }
+ public static void DumpTravelBuffs()
+ {
+ TravelMgr.Instance.GetPlantBuffUnlockCount(PlantType.DoomGatling);
-// public static string MatchTravelBuff(string originalText)
-// {
-// string res = "";
+ foreach (var pair in TravelDictionary.advancedBuffsText)
+ {
+ dumpedTravelBuffs["advancedBuffs"].Add((int)pair.Key, pair.Value);
+ }
-// foreach(var i in dumpedTravelBuffs)
-// {
-// if(i.Value.Contains(originalText))
-// {
-// res = translatedTravelBuffs[i.Key][i.Value.IndexOf(originalText)];
-// break;
-// }
-// }
+ foreach (var pair in TravelDictionary.ultimateBuffsText)
+ {
+ dumpedTravelBuffs["ultimateBuffs"].Add((int)pair.Key, pair.Value);
+ }
-// return res;
-// }
+ foreach (var pair in TravelDictionary.debuffData)
+ {
+ dumpedTravelBuffs["debuffs"].Add((int)pair.Key, pair.Value.Item1);
+ }
-// [HarmonyPatch(nameof(TravelMgr.Awake))]
-// [HarmonyPrefix]
-// private static void Pre_Awake(TravelMgr __instance)
-// {
-// // Dump buffs
+ foreach (var pair in TravelDictionary.unlocksText)
+ {
+ dumpedTravelBuffs["unlocks"].Add((int)pair.Key, pair.Value);
+ }
-// dumpedTravelBuffs = new Dictionary>() // reset dump
-// {
-// { "advancedUpgrades", [] },
-// { "ultimateUpgrades", [] },
-// { "strongUltimates", [] },
-// { "debuffs", [] }
-// };
+ foreach (var pair in TravelMgr.InvestBuffsData)
+ {
+ dumpedTravelBuffs["investmentBuffs"].Add((int)pair.Key, pair.Value.GetDescription());
+ }
-// DumpTravelBuffs(TravelMgr.advancedBuffs, dumpedTravelBuffs, "advancedUpgrades");
-// DumpTravelBuffs(TravelMgr.ultimateBuffs, dumpedTravelBuffs, "ultimateUpgrades");
-// DumpTravelBuffs(TravelMgr.unlocks, dumpedTravelBuffs, "strongUltimates");
-// DumpTravelBuffs(TravelMgr.debuffs, dumpedTravelBuffs, "debuffs");
+ File.WriteAllText(Path.Combine(GetAssetDir(AssetType.Dumps), "travel_buffs.json"), JsonSerializer.Serialize(dumpedTravelBuffs, new JsonSerializerOptions
+ {
+ WriteIndented = true,
+ Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
+ }));
-// 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 translatedTravelBuffsPath = Path.Combine(GetAssetDir(AssetType.Strings, Utils.Language), "travel_buffs.json");
-// string stringDir = FileLoader.GetAssetDir(FileLoader.AssetType.Strings, Utils.Language);
-// string travelBuffDir = Path.Combine(stringDir, "travel_buffs.json");
+ if (!File.Exists(translatedTravelBuffsPath))
+ {
+ File.WriteAllText(translatedTravelBuffsPath, JsonSerializer.Serialize(dumpedTravelBuffs, new JsonSerializerOptions
+ {
+ WriteIndented = true,
+ Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
+ }));
+ translatedTravelBuffs = dumpedTravelBuffs;
+ }
+ }
-// if(!File.Exists(travelBuffDir))
-// {
-// File.WriteAllText(travelBuffDir, JsonSerializer.Serialize(dumpedTravelBuffs, options));
-// }
+ public static string MatchTravelBuff(string originalText)
+ {
+ string res = "";
-// string travelBuffs = File.ReadAllText(Path.Combine(stringDir, "travel_buffs.json"));
+ foreach (var i in translatedTravelBuffs)
+ {
+ foreach (var j in translatedTravelBuffs[i.Key])
+ {
+ if (j.Value == originalText)
+ {
+ res = j.Value;
+ break;
+ }
+ }
-// translatedTravelBuffs = JsonSerializer.Deserialize>>(travelBuffs);
-// }
-// }
-//}
+ if (res != "") break;
+ }
+
+ return res;
+ }
+ }
+}
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelStoreWindow_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelStoreWindow_Patch.cs
new file mode 100644
index 0000000..f80e5bd
--- /dev/null
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelStoreWindow_Patch.cs
@@ -0,0 +1,97 @@
+using HarmonyLib;
+using Il2Cpp;
+using Il2CppTMPro;
+using PvZ_Fusion_Translator.AssetStore;
+using static PvZ_Fusion_Translator.Patches.Modes.Odyssey.TravelMgr_Patch;
+using UnityEngine;
+using System.Text.RegularExpressions;
+
+namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
+{
+ [HarmonyPatch(typeof(TravelStoreWindow))]
+ public static class TravelStoreWindow_Patch
+ {
+ [HarmonyPatch(nameof(TravelStoreWindow.SetType))]
+ [HarmonyPostfix]
+ private static void SetType(TravelStoreWindow __instance)
+ {
+ var buffSet = translatedTravelBuffs[buffLinks[__instance.buffType]];
+
+ string buff = __instance.show != null && __instance.introduce.text != "词条已选完" ? buffSet[__instance.buffIndex] : StringStore.TranslateText("词条已选完");
+ string originalText = __instance.introduce.text;
+
+ string affinities = TranslateAffinities(originalText);
+
+ __instance.introduce.text = buff + affinities;
+
+ foreach (var text in __instance.buttonText)
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
+ }
+
+ [HarmonyPatch(nameof(TravelStoreWindow.UpdateButtonText))]
+ [HarmonyPostfix]
+ private static void UpdateButtonText(TravelStoreWindow __instance)
+ {
+ foreach (var text in __instance.buttonText)
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
+ }
+
+ public static string TranslateAffinities(string originalText)
+ {
+ string discolored = Utils.RemoveColorTags(originalText);
+ int firstNewlineIndex = discolored.IndexOf('\n');
+
+ string result = "";
+ List translatedAffinities = [];
+
+ if(firstNewlineIndex >= 0)
+ {
+ string affinityString = discolored.Substring(firstNewlineIndex);
+ string[] affinities = affinityString.Split('\n');
+
+ string fStr = StringStore.translationStringRegex.ContainsKey("【([^\\s]+)】_IV") ? StringStore.translationStringRegex["【([^\\s]+)】_IV"] : "[{0}]";
+ string originalPattern = "【([^\\s]+)】";
+
+ foreach (string affinity in affinities)
+ {
+ if(affinity != "")
+ {
+ string translatedAffinity = affinity;
+ if (StringStore.TestRegex(affinity, originalPattern))
+ {
+ // Extract dynamic parts from the original text
+ var regex = new Regex(originalPattern);
+ var match = regex.Match(affinity);
+ int groupCount = match.Groups.Count;
+
+ // List to hold formatted dynamic parts
+ List dynamicParts = [];
+
+ // Loop through each group and determine its translation
+ for (int i = 1; i < groupCount; i++)
+ {
+ string groupValue = match.Groups[i].Value;
+ string translatedValue = StringStore.translationString.ContainsKey(groupValue)
+ ? StringStore.translationString[groupValue]
+ : groupValue;
+ dynamicParts.Add(translatedValue);
+ }
+
+ // Format the output string with dynamic parts
+ translatedAffinity = string.Format(fStr, [.. dynamicParts]);
+ }
+
+ translatedAffinities.Add(translatedAffinity);
+ }
+ }
+ result = "\n" + "" + String.Join("\n", translatedAffinities) + "";
+ }
+
+ return result;
+ }
+ }
+}
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelStore_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelStore_Patch.cs
index 9de6677..e641fdf 100644
--- a/MelonLoader/Patches/Modes/Odyssey/TravelStore_Patch.cs
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelStore_Patch.cs
@@ -1,70 +1,63 @@
-//using HarmonyLib;
-//using Il2Cpp;
-//using Il2CppTMPro;
-//using PvZ_Fusion_Translator.AssetStore;
-//using static PvZ_Fusion_Translator.Patches.Modes.Odyssey.TravelMgr_Patch;
-//using UnityEngine;
+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);
-// }
-// }
+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)
+ {
+ TranslateStoreText(__instance);
+ }
-// [HarmonyPatch(nameof(TravelStore.RefreshBuff))]
-// [HarmonyPostfix]
-// private static void RefreshBuff(TravelStore __instance)
-// {
-// foreach (TravelBuff buff in __instance.travelBuffs)
-// {
-// TextMeshProUGUI cost = buff.transform.GetChild(1).GetComponent();
-// cost.text = StringStore.TranslateText(cost.text);
-// cost.font = FontStore.LoadTMPFont(Utils.Language.ToString());
-// }
+ [HarmonyPatch(nameof(TravelStore.RefreshBuff))]
+ [HarmonyPostfix]
+ private static void RefreshBuff(TravelStore __instance)
+ {
+ TranslateStoreText(__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);
-// }
-// }
-// }
-//}
+ public static void TranslateStoreText(TravelStore __instance)
+ {
+ __instance.investText.text = TranslateInvestText(__instance.investText.text);
+ __instance.investTextshadow.text = TranslateInvestText(__instance.investTextshadow.text);
+
+ foreach (var text in __instance.pointText)
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
+ foreach (var text in __instance.refreshText)
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
+ foreach(var text in __instance.transform.Find("Quit").GetComponentsInChildren())
+ {
+ text.text = StringStore.TranslateText("合上");
+ }
+ }
+
+ public static string TranslateInvestText(string investText)
+ {
+ string res = investText;
+
+ string[] investStats = investText.Split("\n\n");
+ List translatedInvestStats = new List();
+ foreach(string investStat in investStats)
+ {
+ string translatedInvestStat = StringStore.TranslateText(investStat);
+ translatedInvestStats.Add(translatedInvestStat);
+ }
+
+ res = String.Join("\n\n", translatedInvestStats);
+
+ return res;
+ }
+ }
+}
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelSynergyMenu_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelSynergyMenu_Patch.cs
new file mode 100644
index 0000000..f4b173c
--- /dev/null
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelSynergyMenu_Patch.cs
@@ -0,0 +1,110 @@
+using HarmonyLib;
+using Il2Cpp;
+using Il2CppTMPro;
+using PvZ_Fusion_Translator.AssetStore;
+using static PvZ_Fusion_Translator.Patches.Modes.Odyssey.TravelMgr_Patch;
+using UnityEngine;
+using System.Text.RegularExpressions;
+
+namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
+{
+ [HarmonyPatch(typeof(TravelSynergyMenu))]
+ public static class TravelSynergyMenu_Patch
+ {
+ [HarmonyPatch(nameof(TravelSynergyMenu.Awake))]
+ [HarmonyPostfix]
+ public static void Awake(TravelSynergyMenu __instance)
+ {
+ Transform background = __instance.transform.Find("Background");
+ Transform tip = __instance.transform.Find("Text (TMP)");
+
+ foreach(TextMeshProUGUI text in background.GetComponentsInChildren())
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
+
+ foreach (TextMeshProUGUI text in tip.GetComponentsInChildren())
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
+ }
+ }
+
+ [HarmonyPatch(typeof(SynergyNode))]
+ public static class SynergyNode_Patch
+ {
+ [HarmonyPatch(nameof(SynergyNode.InitNode))]
+ [HarmonyPostfix]
+ public static void InitNode(SynergyNode __instance)
+ {
+ int firstNewlineIndex = __instance.synergyTitle.text.IndexOf("\n");
+ string title = __instance.synergyTitle.text.Substring(0, firstNewlineIndex);
+ string description = __instance.synergyTitle.text.Substring(firstNewlineIndex + 1);
+ description = (description.Substring(0, 8) == "") ? description.Substring(8) : description;
+
+ string pattern = @"]+>[\s\S]*?(?:<\/color>|$)|(?:<(?!color=)|[^<])+";
+ string smallPattern = @"(]+>)(.*?)()";
+ MatchCollection matches = Regex.Matches(description, pattern);
+ string translatedDescription = "";
+ foreach(Match match in matches)
+ {
+ Match colorMatch = Regex.Match(match.Value, smallPattern, RegexOptions.Singleline);
+ if (colorMatch.Success)
+ {
+ translatedDescription += colorMatch.Groups[1].Value + TranslateSegment(colorMatch.Groups[2].Value) + colorMatch.Groups[3].Value;
+ }
+ else
+ {
+ FileLoader.DumpUntranslatedStrings(match.Value);
+ translatedDescription += TranslateSegment(match.Value) + "\n";
+ }
+ }
+
+ __instance.synergyTitle.text = "" + StringStore.TranslateColorText(title) + "\n" + translatedDescription;
+ }
+
+ public static string TranslateSegment(string text)
+ {
+ string res = "";
+
+ List parts = SplitSecondNewLines(text);
+
+ foreach(string part in parts)
+ {
+ string temp = "";
+ 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";
+ }
+ return res.Substring(0, res.Length - 1);
+ }
+
+ public static List SplitSecondNewLines(string originalText)
+ {
+ List results = new List();
+
+ string[] lines = originalText.Split('\n');
+ for (int i = 0; i < lines.Length; i += 2)
+ {
+ string res = "";
+ if(i + 1 < lines.Length)
+ {
+ res = lines[i] + "\n" + lines[i + 1];
+ results.Add(res);
+ }
+ else
+ {
+ res = lines[i];
+ results.Add(res);
+ }
+ }
+
+ return results;
+ }
+ }
+}
diff --git a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
index 3ccbe6a..3e06e1e 100644
--- a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
+++ b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
@@ -401,6 +401,9 @@
+
+
+
From 2901758559e94edcafd18af960618a718dd38ea3 Mon Sep 17 00:00:00 2001
From: SillyStar-Github <90102598+SillyStar-Github@users.noreply.github.com>
Date: Thu, 12 Feb 2026 12:15:28 -0500
Subject: [PATCH 10/10] odyssey/investment bugfixes
---
MelonLoader/AssetStore/StringStore.cs | 6 +--
.../Modes/Odyssey/SynergyDisplay_Patch.cs | 33 ++++++++++++
.../Modes/Odyssey/TravelBuffMenu_Patch.cs | 11 ++++
.../Modes/Odyssey/TravelInvestMenu_Patch.cs | 7 +++
.../Patches/Modes/Odyssey/TravelMgr_Patch.cs | 20 +++++--
.../Modes/Odyssey/TravelRefresh_Patch.cs | 52 +++++++++----------
.../Modes/Odyssey/TravelStore_Patch.cs | 30 ++++++++++-
.../Modes/Odyssey/TravelSynergyMenu_Patch.cs | 3 --
.../Starbound/AdvantureEvolutionMenu_Patch.cs | 3 --
...PvZ Fusion Translator [MelonLoader].csproj | 1 +
10 files changed, 126 insertions(+), 40 deletions(-)
create mode 100644 MelonLoader/Patches/Modes/Odyssey/SynergyDisplay_Patch.cs
diff --git a/MelonLoader/AssetStore/StringStore.cs b/MelonLoader/AssetStore/StringStore.cs
index 78b3727..9eae2e9 100644
--- a/MelonLoader/AssetStore/StringStore.cs
+++ b/MelonLoader/AssetStore/StringStore.cs
@@ -240,7 +240,7 @@ namespace PvZ_Fusion_Translator.AssetStore
public static string TranslateColorSegments(string input)
{
string result = "";
- string pattern = @"]+>[\s\S]*?<\/color>|(?:<(?!color=)|[^<])+";
+ string pattern = @"]+>[\s\S]*?(?:<\/color>|$)|(?:<(?!color=)|[^<])+";
string smallPattern = @"(]+>)(.*?)()";
MatchCollection matches = Regex.Matches(input, pattern);
@@ -254,8 +254,8 @@ namespace PvZ_Fusion_Translator.AssetStore
else
{
result += DoTranslateText(match.Value);
- }
- }
+ }
+ }
return result;
}
diff --git a/MelonLoader/Patches/Modes/Odyssey/SynergyDisplay_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/SynergyDisplay_Patch.cs
new file mode 100644
index 0000000..cd944ff
--- /dev/null
+++ b/MelonLoader/Patches/Modes/Odyssey/SynergyDisplay_Patch.cs
@@ -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 translatedParts = new List();
+ foreach(string part in parts)
+ {
+ translatedParts.Add(StringStore.TranslateColorText(part));
+ }
+ return String.Join("\n\n", translatedParts);
+ }
+ }
+}
\ No newline at end of file
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelBuffMenu_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelBuffMenu_Patch.cs
index 95bf66a..84c83bc 100644
--- a/MelonLoader/Patches/Modes/Odyssey/TravelBuffMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelBuffMenu_Patch.cs
@@ -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())
+ {
+ text.text = StringStore.TranslateText(text.text);
+ }
+ }
}
}
\ No newline at end of file
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelInvestMenu_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelInvestMenu_Patch.cs
index bb02cf8..bef66f2 100644
--- a/MelonLoader/Patches/Modes/Odyssey/TravelInvestMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelInvestMenu_Patch.cs
@@ -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);
+ }
}
}
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelMgr_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelMgr_Patch.cs
index c214ddc..af371b0 100644
--- a/MelonLoader/Patches/Modes/Odyssey/TravelMgr_Patch.cs
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelMgr_Patch.cs
@@ -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;
+ }
}
}
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelRefresh_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelRefresh_Patch.cs
index e7263c2..56f73e4 100644
--- a/MelonLoader/Patches/Modes/Odyssey/TravelRefresh_Patch.cs
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelRefresh_Patch.cs
@@ -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);
+ }
+ }
+}
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelStore_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelStore_Patch.cs
index e641fdf..3bcb5ef 100644
--- a/MelonLoader/Patches/Modes/Odyssey/TravelStore_Patch.cs
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelStore_Patch.cs
@@ -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 translatedInvestStats = new List();
foreach(string investStat in investStats)
{
- string translatedInvestStat = StringStore.TranslateText(investStat);
+ string[] lines = investStat.Split("\n");
+ List translatedLines = new List();
+ foreach(string line in lines)
+ {
+ translatedLines.Add(StringStore.TranslateColorText(line));
+ }
+ string translatedInvestStat = String.Join("\n", translatedLines);
translatedInvestStats.Add(translatedInvestStat);
}
diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelSynergyMenu_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelSynergyMenu_Patch.cs
index f4b173c..4c1f8a0 100644
--- a/MelonLoader/Patches/Modes/Odyssey/TravelSynergyMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Odyssey/TravelSynergyMenu_Patch.cs
@@ -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";
diff --git a/MelonLoader/Patches/Modes/Starbound/AdvantureEvolutionMenu_Patch.cs b/MelonLoader/Patches/Modes/Starbound/AdvantureEvolutionMenu_Patch.cs
index e2176fc..0564ff5 100644
--- a/MelonLoader/Patches/Modes/Starbound/AdvantureEvolutionMenu_Patch.cs
+++ b/MelonLoader/Patches/Modes/Starbound/AdvantureEvolutionMenu_Patch.cs
@@ -50,7 +50,6 @@ namespace PvZ_Fusion_Translator.Patches.Modes.Starbound
{
foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren())
{
- 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())
{
- 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())
{
- FileLoader.DumpUntranslatedStrings(text.text);
text.text = StringStore.TranslateColorText(text.text);
}
}
diff --git a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
index 3e06e1e..bc9ed8c 100644
--- a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
+++ b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj
@@ -402,6 +402,7 @@
+