diff --git a/BepInEx/Patches/BaseTextObjects/TextMeshProUGUI_Patch.cs b/BepInEx/Patches/BaseTextObjects/TextMeshProUGUI_Patch.cs index d03bb9c..4ef8e8e 100644 --- a/BepInEx/Patches/BaseTextObjects/TextMeshProUGUI_Patch.cs +++ b/BepInEx/Patches/BaseTextObjects/TextMeshProUGUI_Patch.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using System; using TMPro; using PvZ_Fusion_Translator__BepInEx_.AssetStore; @@ -51,9 +51,9 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.BaseTextObjects __instance.fontSize = 12; } - if (__instance.text == "?????? ????" && __instance.transform.parent.parent.Find("Image").GetComponent().activeSprite.name == "Present") + if (__instance.text == "Полный Хаосs" && __instance.transform.parent.parent.Find("Image").GetComponent().activeSprite.name == "Present") { - __instance.text += "\n??????????"; + __instance.text += "\nБесконечно"; } // __instance.ForceMeshUpdate(); diff --git a/BepInEx/Patches/GameObjects/AbyssDevelopMenu_Patch.cs b/BepInEx/Patches/GameObjects/AbyssDevelopMenu_Patch.cs index 60d9445..be85734 100644 --- a/BepInEx/Patches/GameObjects/AbyssDevelopMenu_Patch.cs +++ b/BepInEx/Patches/GameObjects/AbyssDevelopMenu_Patch.cs @@ -1,4 +1,4 @@ -using System.Text.RegularExpressions; +using System.Text.RegularExpressions; using HarmonyLib; using System; using System.Collections.Generic; @@ -23,7 +23,7 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects TextMeshProUGUI upgradeCostText = __instance.transform.FindChild("UpgradeCost").GetComponent(); TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); - string regexStr = "([^\\s]+)\n????:([^\\s]+)\n\n????:\n([^\\s]+)\n\n????:([^\\s]+)"; + string regexStr = "([^\\s]+)\n当前等级:([^\\s]+)\n\n升级条件:\n([^\\s]+)\n\n升级消耗:([^\\s]+)"; Regex regex = new Regex(regexStr); diff --git a/BepInEx/Patches/GameObjects/AbyssMenu_Patch.cs b/BepInEx/Patches/GameObjects/AbyssMenu_Patch.cs index 0d563e4..f67b7cc 100644 --- a/BepInEx/Patches/GameObjects/AbyssMenu_Patch.cs +++ b/BepInEx/Patches/GameObjects/AbyssMenu_Patch.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using System; using System.Collections.Generic; using TMPro; @@ -37,7 +37,7 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects foreach (TextMeshProUGUI txt in __instance.levelInfo) { - string regexStr = "?(\\d+)?\n??:([^\\s]+)\n???:(\\d+)?\n????:([^\\s:]+)\n????:(\\d+)"; + string regexStr = "第(\\d+)关\n场景:([^\\s]+)\n总波数:(\\d+)波\n特殊环境:([^\\s:]+)\n减伤强度:(\\d+)"; Regex regex = new Regex(regexStr); diff --git a/BepInEx/Patches/GameObjects/AbyssSettlementMenu_Patch.cs b/BepInEx/Patches/GameObjects/AbyssSettlementMenu_Patch.cs index 9a26e09..075d065 100644 --- a/BepInEx/Patches/GameObjects/AbyssSettlementMenu_Patch.cs +++ b/BepInEx/Patches/GameObjects/AbyssSettlementMenu_Patch.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using System; using System.Collections.Generic; using TMPro; @@ -20,12 +20,12 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); string[] regexStrList = [ - "?(\\d+)?\n????:(\\d+)?(\\d+)?\n????:(\\d+)\n???????:(\\d+)\n??????:(\\d+)\n????????\n???????:(\\d+)", - "?(\\d+)?\n????:(\\d+)?(\\d+)?\n????:(\\d+)\n???????:(\\d+)\n??????:(\\d+)\n????:(\\d+)\n???????:(\\d+),?????:(\\d+)\n???????:(\\d+)", - "?(\\d+)?\n????:(\\d+)?(\\d+)?\n????:(\\d+)\n???????:(\\d+)\n????:(\\d+)\n???????:(\\d+),?????:(\\d+)\n???????:(\\d+)", - "?(\\d+)?\n????:(\\d+)?(\\d+)?\n????:(\\d+)\n???????:(\\d+)\n??????:(\\d+)\n????:(\\d+)\n???????:(\\d+),?????:(\\d+)\n???????:(\\d+)", - "?(\\d+)?\n????:(\\d+)?(\\d+)?\n????:(\\d+)\n???????:(\\d+)\n????????\n???????:(\\d+)", - "?(\\d+)?\n????:(\\d+)?(\\d+)?\n????:(\\d+)\n???????:(\\d+)\n??????:(\\d+)\n????????\n???????:(\\d+)" + "第(\\d+)关\n通关用时:(\\d+)分(\\d+)秒\n杀敌数量:(\\d+)\n关卡叶绿素产出:(\\d+)\n极限模式产出:(\\d+)\n非首胜无额外产出\n产出叶绿素总计:(\\d+)", + "第(\\d+)关\n通关用时:(\\d+)分(\\d+)秒\n杀敌数量:(\\d+)\n关卡叶绿素产出:(\\d+)\n极限模式产出:(\\d+)\n首胜产出:(\\d+)\n剩余小推车数量:(\\d+),获得叶绿素:(\\d+)\n产出叶绿素总计:(\\d+)", + "第(\\d+)关\n通关用时:(\\d+)分(\\d+)秒\n杀敌数量:(\\d+)\n关卡叶绿素产出:(\\d+)\n首胜产出:(\\d+)\n剩余小推车数量:(\\d+),获得叶绿素:(\\d+)\n产出叶绿素总计:(\\d+)", + "第(\\d+)关\n通关用时:(\\d+)分(\\d+)秒\n杀敌数量:(\\d+)\n关卡叶绿素产出:(\\d+)\n困难模式产出:(\\d+)\n首胜产出:(\\d+)\n剩余小推车数量:(\\d+),获得叶绿素:(\\d+)\n产出叶绿素总计:(\\d+)", + "第(\\d+)关\n通关用时:(\\d+)分(\\d+)秒\n杀敌数量:(\\d+)\n关卡叶绿素产出:(\\d+)\n非首胜无额外产出\n产出叶绿素总计:(\\d+)", + "第(\\d+)关\n通关用时:(\\d+)分(\\d+)秒\n杀敌数量:(\\d+)\n关卡叶绿素产出:(\\d+)\n困难模式产出:(\\d+)\n非首胜无额外产出\n产出叶绿素总计:(\\d+)" ]; foreach(string regexStr in regexStrList) diff --git a/BepInEx/Patches/GameObjects/ButtonObjects/AbyssBuffButton_Patch.cs b/BepInEx/Patches/GameObjects/ButtonObjects/AbyssBuffButton_Patch.cs index 7921fcc..83a2ad1 100644 --- a/BepInEx/Patches/GameObjects/ButtonObjects/AbyssBuffButton_Patch.cs +++ b/BepInEx/Patches/GameObjects/ButtonObjects/AbyssBuffButton_Patch.cs @@ -1,4 +1,4 @@ -#if FIX +#if FIX using System.Text.RegularExpressions; using HarmonyLib; using System; @@ -17,7 +17,7 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects { TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); - Regex regex = new Regex("([^\\s]+)\n??:(\\d+)"); + Regex regex = new Regex("([^\\s]+)\n价格:(\\d+)"); if (regex.IsMatch(__instance.description.text)) { @@ -34,7 +34,7 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects MelonLogger.Msg(translatedValue); } - __instance.description.text = string.Format(StringStore.translationStringRegex["([^\\s]+)\n??:(\\d+)"], [.. dynamicParts]); + __instance.description.text = string.Format(StringStore.translationStringRegex["([^\\s]+)\n价格:(\\d+)"], [.. dynamicParts]); __instance.description.font = fontAsset; } } diff --git a/BepInEx/Patches/GameObjects/Close_Patch.cs b/BepInEx/Patches/GameObjects/Close_Patch.cs index b0783e8..2df6f37 100644 --- a/BepInEx/Patches/GameObjects/Close_Patch.cs +++ b/BepInEx/Patches/GameObjects/Close_Patch.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using System; using TMPro; using PvZ_Fusion_Translator__BepInEx_.AssetStore; @@ -15,7 +15,7 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects { TextMeshPro closeText = __instance.transform.GetChild(0).GetComponent(); - closeText.text = "??"; + closeText.text = "合上"; closeText = StringStore.TranslateText(closeText); closeText.autoSizeTextContainer = true; diff --git a/BepInEx/Patches/GameObjects/MinorObjects/Zombie_Patch.cs b/BepInEx/Patches/GameObjects/MinorObjects/Zombie_Patch.cs index 499c6ab..4ee5f32 100644 --- a/BepInEx/Patches/GameObjects/MinorObjects/Zombie_Patch.cs +++ b/BepInEx/Patches/GameObjects/MinorObjects/Zombie_Patch.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using System; using System.Collections.Generic; using System.Linq; @@ -14,10 +14,10 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.MinorObjects { private static Dictionary HPStrings = new Dictionary() { - { "????:(\\d+)\nDPS:(.+)$", "Last damage: {0}\nDPS: {1}" }, - { "^HP:(\\d+)/(\\d+)\n\\D+(\\d+)/(\\d+)\n\\D+(\\d+)/(\\d+)$", "HP: {0}/{1}\nType 1 armor: {2}/{3}\nType 2 armor: {4}/{5}" }, - { "^HP:(\\d+)/(\\d+)\n\\D+(\\d+)/(\\d+)$", "HP: {0}/{1}\nType 1 armor: {2}/{3}" }, - { "^HP:(\\d+)/(\\d+)$", "HP: {0}/{1}" }, + { "最后一击:(\\d+)\nDPS:(.+)$", "Last damage: {0}\nDPS: {1}" }, + { "^HP:(\\d+)/(\\d+)\n\\D+(\\d+)/(\\d+)\n\\D+(\\d+)/(\\d+)$", "HP: {0}/{1}\nType 1 armor: {2}/{3}\nType 2 armor: {4}/{5}" }, + { "^HP:(\\d+)/(\\d+)\n\\D+(\\d+)/(\\d+)$", "HP: {0}/{1}\nType 1 armor: {2}/{3}" }, + { "^HP:(\\d+)/(\\d+)$", "HP: {0}/{1}" }, }; public static void LoadHPStrings() diff --git a/BepInEx/Patches/GameObjects/TravelLookMenu_Patch.cs b/BepInEx/Patches/GameObjects/TravelLookMenu_Patch.cs index 51d4139..ad915cd 100644 --- a/BepInEx/Patches/GameObjects/TravelLookMenu_Patch.cs +++ b/BepInEx/Patches/GameObjects/TravelLookMenu_Patch.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using System; using TMPro; using PvZ_Fusion_Translator__BepInEx_.AssetStore; @@ -20,9 +20,9 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects foreach (var textComp in allTexts) { - if (textComp != null && textComp.text == StringStore.TranslateText("??")) + if (textComp != null && textComp.text == StringStore.TranslateText("关闭")) { - textComp.text = StringStore.TranslateText("??_close"); + textComp.text = StringStore.TranslateText("关闭_close"); TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); textComp.font = fontAsset; diff --git a/BepInEx/Patches/Managers/InGameUI_Patch.cs b/BepInEx/Patches/Managers/InGameUI_Patch.cs index 2163be7..6217816 100644 --- a/BepInEx/Patches/Managers/InGameUI_Patch.cs +++ b/BepInEx/Patches/Managers/InGameUI_Patch.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using System; using TMPro; using PvZ_Fusion_Translator__BepInEx_.AssetStore; diff --git a/BepInEx/Patches/Managers/OppositeBuffManager_Patch.cs b/BepInEx/Patches/Managers/OppositeBuffManager_Patch.cs index 142c975..8111a9c 100644 --- a/BepInEx/Patches/Managers/OppositeBuffManager_Patch.cs +++ b/BepInEx/Patches/Managers/OppositeBuffManager_Patch.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using System; using TMPro; using PvZ_Fusion_Translator__BepInEx_.AssetStore; @@ -8,16 +8,16 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers [HarmonyPatch(typeof(OppositeBuffManager))] public static class OppositeBuffManager_Patch { - #if TESTING +#if TESTING [HarmonyPatch(nameof(OppositeBuffManager.InitBuffPool))] [HarmonyPostfix] private static void InitBuffPool(OppositeBuffManager __instance) { foreach(TextMeshProUGUI text in __instance.textA_bad) { - string stripText = text.text.Replace("?", ""); + string stripText = text.text.Replace("但", ""); string translatedText = StringStore.TranslateText(stripText); - string replacementText = StringStore.translationString["?"] + translatedText; + string replacementText = StringStore.translationString["但"] + translatedText; text.text = replacementText; } foreach(TextMeshProUGUI text in __instance.textA_good) @@ -27,9 +27,9 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers foreach(TextMeshProUGUI text in __instance.textB_bad) { - string stripText = text.text.Replace("?", ""); + string stripText = text.text.Replace("但", ""); string translatedText = StringStore.TranslateText(stripText); - string replacementText = StringStore.translationString["?"] + translatedText; + string replacementText = StringStore.translationString["但"] + translatedText; text.text = replacementText; } foreach(TextMeshProUGUI text in __instance.textB_good) @@ -46,7 +46,7 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers { string stripText = text.text.Replace("?", ""); string translatedText = StringStore.TranslateText(stripText); - string replacementText = StringStore.translationString["?"] + translatedText; + string replacementText = StringStore.translationString["但"] + translatedText; text.text = replacementText; } foreach(TextMeshProUGUI text in __instance.textA_good) @@ -56,9 +56,9 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers foreach(TextMeshProUGUI text in __instance.textB_bad) { - string stripText = text.text.Replace("?", ""); + string stripText = text.text.Replace("但", ""); string translatedText = StringStore.TranslateText(stripText); - string replacementText = StringStore.translationString["?"] + translatedText; + string replacementText = StringStore.translationString["但"] + translatedText; text.text = replacementText; } foreach(TextMeshProUGUI text in __instance.textB_good) @@ -66,9 +66,9 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers text.text = StringStore.TranslateText(text.text); } } - #endif +#endif - [HarmonyPatch(nameof(OppositeBuffManager.SetText), new Type[] { typeof(TextMeshProUGUI), typeof(BuffType), typeof(int)})] + [HarmonyPatch(nameof(OppositeBuffManager.SetText), new Type[] { typeof(TextMeshProUGUI), typeof(BuffType), typeof(int)})] [HarmonyPostfix] private static void SetText(OppositeBuffManager __instance, ref TextMeshProUGUI text) {