diff --git a/.gitignore b/.gitignore index 615b362..66a3158 100644 --- a/.gitignore +++ b/.gitignore @@ -11,127 +11,10 @@ /BepInEx/obj /BepInEx/bin/ReleaseMulti/net6.0 /AlmanacPlantBank_Patch.cs -MelonLoader/bin/x64/Debug/net6.0/0Harmony.dll -MelonLoader/bin/x64/Debug/net6.0/AsmResolver.dll -MelonLoader/bin/x64/Debug/net6.0/AsmResolver.DotNet.dll -MelonLoader/bin/x64/Debug/net6.0/AsmResolver.PE.dll -MelonLoader/bin/x64/Debug/net6.0/AsmResolver.PE.File.dll -MelonLoader/bin/x64/Debug/net6.0/Assembly-CSharp.dll -MelonLoader/bin/x64/Debug/net6.0/AssetRipper.Primitives.dll -MelonLoader/bin/x64/Debug/net6.0/AssetsTools.NET.dll -MelonLoader/bin/x64/Debug/net6.0/AudioImportLib.dll -MelonLoader/bin/x64/Debug/net6.0/bHapticsLib.dll -MelonLoader/bin/x64/Debug/net6.0/Il2Cpp__Generated.dll -MelonLoader/bin/x64/Debug/net6.0/Il2CppInterop.Common.dll -MelonLoader/bin/x64/Debug/net6.0/Il2CppInterop.Generator.dll -MelonLoader/bin/x64/Debug/net6.0/Il2CppInterop.HarmonySupport.dll -MelonLoader/bin/x64/Debug/net6.0/Il2CppInterop.Runtime.dll -MelonLoader/bin/x64/Debug/net6.0/Il2CppMono.Security.dll -MelonLoader/bin/x64/Debug/net6.0/Il2Cppmscorlib.dll -MelonLoader/bin/x64/Debug/net6.0/Il2CppSystem.Configuration.dll -MelonLoader/bin/x64/Debug/net6.0/Il2CppSystem.Core.dll -MelonLoader/bin/x64/Debug/net6.0/Il2CppSystem.dll -MelonLoader/bin/x64/Debug/net6.0/Il2CppSystem.Xml.dll -MelonLoader/bin/x64/Debug/net6.0/MelonLoader.dll -MelonLoader/bin/x64/Debug/net6.0/MelonLoader.pdb -MelonLoader/bin/x64/Debug/net6.0/MelonLoader.xml -MelonLoader/bin/x64/Debug/net6.0/Microsoft.Diagnostics.NETCore.Client.dll -MelonLoader/bin/x64/Debug/net6.0/Microsoft.Diagnostics.Runtime.dll -MelonLoader/bin/x64/Debug/net6.0/Microsoft.Extensions.Logging.Abstractions.dll -MelonLoader/bin/x64/Debug/net6.0/Mono.Cecil.dll -MelonLoader/bin/x64/Debug/net6.0/Mono.Cecil.Mdb.dll -MelonLoader/bin/x64/Debug/net6.0/Mono.Cecil.Pdb.dll -MelonLoader/bin/x64/Debug/net6.0/Mono.Cecil.Rocks.dll -MelonLoader/bin/x64/Debug/net6.0/MonoMod.Backports.dll -MelonLoader/bin/x64/Debug/net6.0/MonoMod.ILHelpers.dll -MelonLoader/bin/x64/Debug/net6.0/MonoMod.RuntimeDetour.dll -MelonLoader/bin/x64/Debug/net6.0/MonoMod.Utils.dll -MelonLoader/bin/x64/Debug/net6.0/PvZ_Fusion_Translator.deps.json -MelonLoader/bin/x64/Debug/net6.0/PvZ_Fusion_Translator.dll -MelonLoader/bin/x64/Debug/net6.0/PvZ_Fusion_Translator.pdb -MelonLoader/bin/x64/Debug/net6.0/Tomlet.dll -MelonLoader/bin/x64/Debug/net6.0/Unity.2D.Animation.Runtime.dll -MelonLoader/bin/x64/Debug/net6.0/Unity.2D.Common.Runtime.dll -MelonLoader/bin/x64/Debug/net6.0/Unity.2D.SpriteShape.Runtime.dll -MelonLoader/bin/x64/Debug/net6.0/Unity.Burst.dll -MelonLoader/bin/x64/Debug/net6.0/Unity.Burst.Unsafe.dll -MelonLoader/bin/x64/Debug/net6.0/Unity.Collections.dll -MelonLoader/bin/x64/Debug/net6.0/Unity.Collections.LowLevel.ILSupport.dll -MelonLoader/bin/x64/Debug/net6.0/Unity.InternalAPIEngineBridge.001.dll -MelonLoader/bin/x64/Debug/net6.0/Unity.Mathematics.dll -MelonLoader/bin/x64/Debug/net6.0/Unity.RenderPipeline.Universal.ShaderLibrary.dll -MelonLoader/bin/x64/Debug/net6.0/Unity.RenderPipelines.Core.Runtime.dll -MelonLoader/bin/x64/Debug/net6.0/Unity.RenderPipelines.Universal.Runtime.dll -MelonLoader/bin/x64/Debug/net6.0/Unity.TextMeshPro.dll -MelonLoader/bin/x64/Debug/net6.0/Unity.VisualScripting.Core.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.AccessibilityModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.AIModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.AndroidJNIModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.AnimationModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.ARModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.AssetBundleModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.AudioModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.ClothModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.ContentLoadModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.CoreModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.CrashReportingModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.DirectorModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.DSPGraphModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.GameCenterModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.GIModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.GridModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.HotReloadModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.ImageConversionModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.IMGUIModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.InputLegacyModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.InputModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.JSONSerializeModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.LocalizationModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.ParticleSystemModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.PerformanceReportingModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.Physics2DModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.PhysicsModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.ProfilerModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.PropertiesModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.ScreenCaptureModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.SharedInternalsModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.SpriteMaskModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.SpriteShapeModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.StreamingModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.SubstanceModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.SubsystemsModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.TerrainModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.TerrainPhysicsModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.TextCoreFontEngineModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.TextCoreTextEngineModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.TextRenderingModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.TilemapModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.TLSModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.UI.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.UIElementsModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.UIModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.UmbraModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.UnityAnalyticsCommonModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.UnityAnalyticsModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.UnityConnectModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.UnityCurlModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.UnityTestProtocolModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.UnityWebRequestAssetBundleModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.UnityWebRequestAudioModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.UnityWebRequestModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.UnityWebRequestTextureModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.UnityWebRequestWWWModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.VehiclesModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.VFXModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.VideoModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.VRModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.WindModule.dll -MelonLoader/bin/x64/Debug/net6.0/UnityEngine.XRModule.dll -MelonLoader/bin/x64/Debug/net6.0/WebSocketDotNet.dll +/MelonLoader/bin/x64/Debug /BepInEx/bin/Debug/net6.0 .HOWTO-sync-MelonLoader-from-origin-main.txt /MelonLoader/bin/ReleaseMulti/net6.0 BepInEx/Patches/GameObjects/changes.txt -/Assembly-CSharp \ No newline at end of file +/Assembly-CSharp +/MelonLoader/bin/Debug/net6.0 diff --git a/MelonLoader/AssetStore/StringStore.cs b/MelonLoader/AssetStore/StringStore.cs index 24ec52b..9eae2e9 100644 --- a/MelonLoader/AssetStore/StringStore.cs +++ b/MelonLoader/AssetStore/StringStore.cs @@ -211,14 +211,75 @@ namespace PvZ_Fusion_Translator.AssetStore if (isLog) Log.LogDebug($"Text '{originalText}' not translated"); + if(Utils.CheckForUntranslatedText(originalText)) + { + FileLoader.DumpUntranslatedStrings(originalText); + } return originalText; } - private 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) { return anchor switch 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 2cd2294..6fa5ac4 100644 --- a/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs +++ b/MelonLoader/Patches/BaseTextObjects/InGameText_Patch.cs @@ -2,42 +2,80 @@ using Il2Cpp; using Il2CppTMPro; using PvZ_Fusion_Translator.AssetStore; -using PvZ_Fusion_Translator.Patches.Managers; +using PvZ_Fusion_Translator.Patches.Modes.Odyssey; + +//using PvZ_Fusion_Translator.Patches.Modes.Odyssey; +using System.Text.RegularExpressions; +using System.Xml.Linq; +using UnityEngine; 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))] + [HarmonyPostfix] + 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.GetComponentsInChildren()) + { + string originalText = txt.text; + string travelMatch = TravelMgr_Patch.MatchTravelBuff(originalText); - #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 (txt.gameObject.name.Contains("shadow")) + { + continue; + } - if(travelMatch != "") - { - txt.text = travelMatch; - } - else - { + 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) && !StringStore.translationString.ContainsKey(txt.text)) + { + 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; - } - } + } + + if(__instance.TryGetComponent(out TextMeshProUGUI text)) + { + text.text = StringStore.TranslateText(text.text); + } + } } } \ 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..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,8 +50,18 @@ 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); __instance.showedZombieIntroduce.enableWordWrapping = true; 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 bcdd189..ea643de 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; + if (translatedText == null) return; + string pattern = "(\\d+)阶\n([\\s\\S]+)"; + if (StringStore.TestRegex(translatedText, pattern)) + { + 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, [tier, healthText]); + } + else + { + translatedText = TranslateHPText(origText, __instance); + } textTMP.text = translatedText == origText ? origText : translatedText; textTMP.autoSizeTextContainer = false; if (translatedText != origText) @@ -91,8 +105,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; @@ -146,6 +159,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/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/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/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/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/Patches/Managers/OppositeBuffManager_Patch.cs b/MelonLoader/Patches/Managers/OppositeBuffManager_Patch.cs index 11a18af..fbf82c7 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; @@ -11,7 +12,7 @@ namespace PvZ_Fusion_Translator.Patches.Managers public static class OppositeBuffManager_Patch { public static Dictionary buffLinks = TravelMgr_Patch.buffLinks; - public static Dictionary> translatedTravelBuffs = TravelMgr_Patch.translatedTravelBuffs; + 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()); @@ -30,9 +31,9 @@ namespace PvZ_Fusion_Translator.Patches.Managers { string buff = translatedTravelBuffs[buffLinks[buffType]][buffIndex]; - foreach(var text in textList) + foreach (var text in textList) { - if(isBad) + if (isBad) { text.text = string.Format(badFormat, buff); } 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 52% rename from MelonLoader/Patches/GameObjects/GardenBagMenu_Patch.cs rename to MelonLoader/Patches/Modes/Harvest/GardenBagMenu_Patch.cs index 093cacd..3f009bd 100644 --- a/MelonLoader/Patches/GameObjects/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 @@ -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 92% rename from MelonLoader/Patches/GameObjects/GardenCard_Patch.cs rename to MelonLoader/Patches/Modes/Harvest/GardenCard_Patch.cs index cb4e23d..d1baac8 100644 --- a/MelonLoader/Patches/GameObjects/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/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/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 new file mode 100644 index 0000000..84c83bc --- /dev/null +++ b/MelonLoader/Patches/Modes/Odyssey/TravelBuffMenu_Patch.cs @@ -0,0 +1,35 @@ +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); + } + } + + [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/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/GameObjects/TravelBuffOptionButton_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelBuffOptionButton_Patch.cs similarity index 73% rename from MelonLoader/Patches/GameObjects/TravelBuffOptionButton_Patch.cs rename to MelonLoader/Patches/Modes/Odyssey/TravelBuffOptionButton_Patch.cs index 461de17..a0ef13c 100644 --- a/MelonLoader/Patches/GameObjects/TravelBuffOptionButton_Patch.cs +++ b/MelonLoader/Patches/Modes/Odyssey/TravelBuffOptionButton_Patch.cs @@ -4,9 +4,9 @@ using Il2CppTMPro; using MelonLoader; using PvZ_Fusion_Translator.AssetStore; using static MelonLoader.MelonLogger; -using static PvZ_Fusion_Translator.Patches.Managers.TravelMgr_Patch; +using static PvZ_Fusion_Translator.Patches.Modes.Odyssey.TravelMgr_Patch; -namespace PvZ_Fusion_Translator.Patches.GameObjects +namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey { [HarmonyPatch(typeof(TravelBuffOptionButton))] public static class TravelBuffOptionButton_Patch @@ -27,9 +27,9 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects public static void TranslateOptionButton(TravelBuffOptionButton button) { - List buffSet = translatedTravelBuffs[buffLinks[button.buffType]]; + 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; } 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/TravelInvestMenu_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelInvestMenu_Patch.cs new file mode 100644 index 0000000..bef66f2 --- /dev/null +++ b/MelonLoader/Patches/Modes/Odyssey/TravelInvestMenu_Patch.cs @@ -0,0 +1,32 @@ +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); + } + + [HarmonyPatch(nameof(TravelInvestMenu.RefreshBuff))] + [HarmonyPostfix] + private static void RefreshBuff(TravelInvestMenu __instance, ref TravelBuffOptionButton option) + { + TravelBuffOptionButton_Patch.TranslateOptionButton(option); + } + } +} diff --git a/MelonLoader/Patches/GameObjects/TravelLookBuff_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelLookBuff_Patch.cs similarity index 80% rename from MelonLoader/Patches/GameObjects/TravelLookBuff_Patch.cs rename to MelonLoader/Patches/Modes/Odyssey/TravelLookBuff_Patch.cs index 1004d00..ecf918a 100644 --- a/MelonLoader/Patches/GameObjects/TravelLookBuff_Patch.cs +++ b/MelonLoader/Patches/Modes/Odyssey/TravelLookBuff_Patch.cs @@ -2,11 +2,11 @@ using Il2Cpp; using Il2CppTMPro; using PvZ_Fusion_Translator.AssetStore; -using static PvZ_Fusion_Translator.Patches.Managers.TravelMgr_Patch; +using static PvZ_Fusion_Translator.Patches.Modes.Odyssey.TravelMgr_Patch; using UnityEngine; using MelonLoader; -namespace PvZ_Fusion_Translator.Patches.GameObjects +namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey { [HarmonyPatch(typeof(TravelLookBuff))] public static class TravelLookBuff_Patch @@ -38,8 +38,8 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects [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); + 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()) diff --git a/MelonLoader/Patches/GameObjects/TravelLookMenu_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelLookMenu_Patch.cs similarity index 96% rename from MelonLoader/Patches/GameObjects/TravelLookMenu_Patch.cs rename to MelonLoader/Patches/Modes/Odyssey/TravelLookMenu_Patch.cs index b775a7a..cda2c7a 100644 --- a/MelonLoader/Patches/GameObjects/TravelLookMenu_Patch.cs +++ b/MelonLoader/Patches/Modes/Odyssey/TravelLookMenu_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.Odyssey { [HarmonyPatch(typeof(TravelLookMenu))] public static class TravelLookMenu_Patch diff --git a/MelonLoader/Patches/Modes/Odyssey/TravelMgr_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelMgr_Patch.cs new file mode 100644 index 0000000..af371b0 --- /dev/null +++ b/MelonLoader/Patches/Modes/Odyssey/TravelMgr_Patch.cs @@ -0,0 +1,126 @@ +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 UnityEngine.Rendering; +using static PvZ_Fusion_Translator.FileLoader; + +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> translatedTravelBuffs = new() + { + { "advancedBuffs", new SortedDictionary() }, + { "ultimateBuffs", new SortedDictionary() }, + { "debuffs", new SortedDictionary() }, + { "unlocks", new SortedDictionary() }, + { "investmentBuffs", new SortedDictionary() } + }; + + public static Dictionary buffLinks = new() + { + { BuffType.AdvancedBuff, "advancedBuffs" }, + { BuffType.UltimateBuff, "ultimateBuffs" }, + { BuffType.Debuff, "debuffs" }, + { BuffType.UnlockPlant, "unlocks" }, + { BuffType.InvestmentBuff, "investmentBuffs" } + }; + + public static void DumpTravelBuffs() + { + TravelMgr.Instance.GetPlantBuffUnlockCount(PlantType.DoomGatling); + + foreach (var pair in TravelDictionary.advancedBuffsText) + { + dumpedTravelBuffs["advancedBuffs"].Add((int)pair.Key, pair.Value); + } + + foreach (var pair in TravelDictionary.ultimateBuffsText) + { + dumpedTravelBuffs["ultimateBuffs"].Add((int)pair.Key, pair.Value); + } + + foreach (var pair in TravelDictionary.debuffData) + { + dumpedTravelBuffs["debuffs"].Add((int)pair.Key, pair.Value.Item1); + } + + foreach (var pair in TravelDictionary.unlocksText) + { + dumpedTravelBuffs["unlocks"].Add((int)pair.Key, pair.Value); + } + + foreach (var pair in TravelMgr.InvestBuffsData) + { + dumpedTravelBuffs["investmentBuffs"].Add((int)pair.Key, pair.Value.GetDescription()); + } + + File.WriteAllText(Path.Combine(GetAssetDir(AssetType.Dumps), "travel_buffs.json"), JsonSerializer.Serialize(dumpedTravelBuffs, new JsonSerializerOptions + { + WriteIndented = true, + Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping + })); + + string translatedTravelBuffsPath = Path.Combine(GetAssetDir(AssetType.Strings, Utils.Language), "travel_buffs.json"); + + if (!File.Exists(translatedTravelBuffsPath)) + { + File.WriteAllText(translatedTravelBuffsPath, JsonSerializer.Serialize(dumpedTravelBuffs, new JsonSerializerOptions + { + WriteIndented = true, + Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping + })); + translatedTravelBuffs = dumpedTravelBuffs; + } + } + + public static string MatchTravelBuff(string originalText) + { + string res = ""; + + foreach (var i in dumpedTravelBuffs) + { + foreach (var j in dumpedTravelBuffs[i.Key]) + { + if (j.Value == originalText || j.Value == RemoveBuffName(originalText)) + { + res = translatedTravelBuffs[i.Key][j.Key]; + break; + } + } + + if (res != "") break; + } + + 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/GameObjects/TravelRefresh_Patch.cs b/MelonLoader/Patches/Modes/Odyssey/TravelRefresh_Patch.cs similarity index 94% rename from MelonLoader/Patches/GameObjects/TravelRefresh_Patch.cs rename to MelonLoader/Patches/Modes/Odyssey/TravelRefresh_Patch.cs index 6206e7a..56f73e4 100644 --- a/MelonLoader/Patches/GameObjects/TravelRefresh_Patch.cs +++ b/MelonLoader/Patches/Modes/Odyssey/TravelRefresh_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.Odyssey { [HarmonyPatch(typeof(TravelRefresh))] public static class TravelRefresh_Patch 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 new file mode 100644 index 0000000..3bcb5ef --- /dev/null +++ b/MelonLoader/Patches/Modes/Odyssey/TravelStore_Patch.cs @@ -0,0 +1,91 @@ +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.Start))] + [HarmonyPostfix] + private static void Start(TravelStore __instance) + { + TranslateStoreText(__instance); + } + + [HarmonyPatch(nameof(TravelStore.Update))] + [HarmonyPostfix] + private static void Update(TravelStore __instance) + { + TranslateStoreText(__instance); + } + + [HarmonyPatch(nameof(TravelStore.RefreshBuff))] + [HarmonyPostfix] + private static void RefreshBuff(TravelStore __instance) + { + 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); + __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[] 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); + } + + 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..4c1f8a0 --- /dev/null +++ b/MelonLoader/Patches/Modes/Odyssey/TravelSynergyMenu_Patch.cs @@ -0,0 +1,107 @@ +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 + { + 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) + { + 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/Patches/Modes/Starbound/AdvantureEvolutionMenu_Patch.cs b/MelonLoader/Patches/Modes/Starbound/AdvantureEvolutionMenu_Patch.cs new file mode 100644 index 0000000..0564ff5 --- /dev/null +++ b/MelonLoader/Patches/Modes/Starbound/AdvantureEvolutionMenu_Patch.cs @@ -0,0 +1,77 @@ +using HarmonyLib; +using Il2Cpp; +using Il2CppTMPro; +using PvZ_Fusion_Translator.AssetStore; +using UnityEngine; + +namespace PvZ_Fusion_Translator.Patches.Modes.Starbound +{ + [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()) + { + text.text = StringStore.TranslateColorText(text.text); + } + } + + [HarmonyPatch(nameof(AdvantureEvolutionMenu.RollEvolution))] + [HarmonyPostfix] + public static void RollEvolution(AdvantureEvolutionMenu __instance) + { + foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren()) + { + text.text = StringStore.TranslateColorText(text.text); + } + } + + [HarmonyPatch(nameof(AdvantureEvolutionMenu.RollEvolutionGood))] + [HarmonyPostfix] + public static void RollEvolutionGood(AdvantureEvolutionMenu __instance) + { + foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren()) + { + text.text = StringStore.TranslateColorText(text.text); + } + } + } +} diff --git a/MelonLoader/Patches/Modes/Starbound/AdvantureHelpMenu_Patch.cs b/MelonLoader/Patches/Modes/Starbound/AdvantureHelpMenu_Patch.cs new file mode 100644 index 0000000..4f9751f --- /dev/null +++ b/MelonLoader/Patches/Modes/Starbound/AdvantureHelpMenu_Patch.cs @@ -0,0 +1,21 @@ +using HarmonyLib; +using Il2Cpp; +using Il2CppTMPro; +using PvZ_Fusion_Translator.AssetStore; + +namespace PvZ_Fusion_Translator.Patches.Modes.Starbound +{ + [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/Modes/Starbound/AdvantureMenu2_Patch.cs b/MelonLoader/Patches/Modes/Starbound/AdvantureMenu2_Patch.cs new file mode 100644 index 0000000..46814ba --- /dev/null +++ b/MelonLoader/Patches/Modes/Starbound/AdvantureMenu2_Patch.cs @@ -0,0 +1,28 @@ +using HarmonyLib; +using Il2Cpp; +using Il2CppTMPro; +using PvZ_Fusion_Translator.AssetStore; + +namespace PvZ_Fusion_Translator.Patches.Modes.Starbound +{ + [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/Modes/Starbound/AdvantureMenu_Patch.cs b/MelonLoader/Patches/Modes/Starbound/AdvantureMenu_Patch.cs new file mode 100644 index 0000000..91c593b --- /dev/null +++ b/MelonLoader/Patches/Modes/Starbound/AdvantureMenu_Patch.cs @@ -0,0 +1,64 @@ +using HarmonyLib; +using Il2Cpp; +using Il2CppTMPro; +using PvZ_Fusion_Translator.AssetStore; + +namespace PvZ_Fusion_Translator.Patches.Modes.Starbound +{ + [HarmonyPatch(typeof(AdvantureMenu))] + public static class AdvantureMenu_Patch + { + [HarmonyPatch(nameof(AdvantureMenu.Start))] + [HarmonyPostfix] + private static void Start(AdvantureMenu __instance) + { + TranslateAdvantureMenu(__instance); + } + + [HarmonyPatch(nameof(AdvantureMenu.ChangeDifficulty))] + [HarmonyPostfix] + private static void ChangeDifficulty(AdvantureMenu __instance) + { + TranslateAdvantureMenu(__instance); + } + + [HarmonyPatch(nameof(AdvantureMenu.GetChapterDifficulty))] + [HarmonyPostfix] + private static void GetChapterDifficulty(AdvantureMenu __instance) + { + TranslateAdvantureMenu(__instance); + } + + [HarmonyPatch(nameof(AdvantureMenu.UpdateChapterDifficulty))] + [HarmonyPostfix] + private static void UpdateChapterDifficulty(AdvantureMenu __instance) + { + TranslateAdvantureMenu(__instance); + } + + [HarmonyPatch(nameof(AdvantureMenu.UpdateStarCount))] + [HarmonyPostfix] + private static void UpdateStarCount(AdvantureMenu __instance) + { + TranslateAdvantureMenu(__instance); + } + + public static void TranslateAdvantureMenu(AdvantureMenu __instance) + { + 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); + + 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/Modes/Starbound/AdvantureMissionMenu_Patch.cs b/MelonLoader/Patches/Modes/Starbound/AdvantureMissionMenu_Patch.cs new file mode 100644 index 0000000..2aac117 --- /dev/null +++ b/MelonLoader/Patches/Modes/Starbound/AdvantureMissionMenu_Patch.cs @@ -0,0 +1,56 @@ +using HarmonyLib; +using Il2Cpp; +using Il2CppTMPro; +using PvZ_Fusion_Translator.AssetStore; + +namespace PvZ_Fusion_Translator.Patches.Modes.Starbound +{ + [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.contant.GetComponentsInChildren()) + { + 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.contant.GetComponentsInChildren()) + { + text.text = StringStore.TranslateColorText(text.text); + } + + //foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren()) + //{ + // text.text = StringStore.TranslateText(text.text); + //} + } + } +} diff --git a/MelonLoader/Patches/Modes/Starbound/AdvantureStarMenu_Patch.cs b/MelonLoader/Patches/Modes/Starbound/AdvantureStarMenu_Patch.cs new file mode 100644 index 0000000..2b8c4b1 --- /dev/null +++ b/MelonLoader/Patches/Modes/Starbound/AdvantureStarMenu_Patch.cs @@ -0,0 +1,61 @@ +using HarmonyLib; +using Il2Cpp; +using Il2CppTMPro; +using PvZ_Fusion_Translator.AssetStore; + +namespace PvZ_Fusion_Translator.Patches.Modes.Starbound +{ + [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 22943d4..8d1d420 100644 --- a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj +++ b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj @@ -402,7 +402,17 @@ - + + + + + + + + + + + @@ -419,76 +429,76 @@ - + - + - + - - - - - - - + + + + + + + - - - - + + + + - - - + + + - + - - - - + + + + - + - - - + + + - - + + - + @@ -514,10 +524,10 @@ - - - - + + + + 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 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