diff --git a/MelonLoader/AssetStore/StringStore.cs b/MelonLoader/AssetStore/StringStore.cs index d666b66..21c499a 100644 --- a/MelonLoader/AssetStore/StringStore.cs +++ b/MelonLoader/AssetStore/StringStore.cs @@ -29,7 +29,7 @@ namespace PvZ_Fusion_Translator.AssetStore // UI - Playing { @"-------UI - Playing" , "UI - Playing-------" }, { @"快捷键:(\d+)" , "Hotkey: {0}" }, - { @"场上敌人数量:(\d+)" , "Zombies: {0}" }, + { @"场上敌人数量:(\d+)$" , "Zombies: {0}" }, { @"难度:(\d+)" , "Difficulty: {0}" }, // UI - Adventure Mode @@ -117,8 +117,8 @@ namespace PvZ_Fusion_Translator.AssetStore { @"-------Strings - Others" , "Strings - Others-------" }, // { @"HP:(\d+)/(\d+)\s+一类:(\d+)/(\d+)" , "HP: {0}/{1}\nArmor: {2}/{3}" }, // { @"HP:(\d+)/(\d+)\s+二类:(\d+)/(\d+)" , "HP: {0}/{1}\nArmor: {2}/{3}" }, - { @"^HP:(\d+)/(\d+)\s+([^\s+])类:(\d+)/(\d+)" , "HP: {0}/{1}\nArmor: {3}/{4}" }, - { @"^HP:(\d+)/(\d+)" , "HP: {0}/{1}" }, + // { @"^HP:(\d+)/(\d+)\s+([^\s+])类:(\d+)/(\d+)" , "HP: {0}/{1}\nArmor: {3}/{4}" }, + // { @"^HP:(\d+)/(\d+)" , "HP: {0}/{1}" }, // { @"平衡性调整(([^\s]+))" , "Balance Adjustment ({0})" }, { @"旅行:守护 (\d+)轮已经完成" , "Odyssey: Last Stand | {0} Rounds Completed"}, diff --git a/MelonLoader/Patches/GameObjects/MinorObjects/TrainingDummy_Patch.cs b/MelonLoader/Patches/GameObjects/MinorObjects/TrainingDummy_Patch.cs new file mode 100644 index 0000000..6ed9af6 --- /dev/null +++ b/MelonLoader/Patches/GameObjects/MinorObjects/TrainingDummy_Patch.cs @@ -0,0 +1,17 @@ +using HarmonyLib; +using Il2Cpp; +using PvZ_Fusion_Translator.AssetStore; + +namespace PvZ_Fusion_Translator.Patches.GameObjects.MinorObjects +{ + [HarmonyPatch(typeof(TrainingDummy), nameof(TrainingDummy.UpdateHealthText))] + public static class TrainingDummy_Patch + { + [HarmonyPostfix] + public static void UpdateHealthText(TrainingDummy __instance) + { + StringStore.TranslateText(__instance.healthText); + StringStore.TranslateText(__instance.healthTextShadow); + } + } +} \ No newline at end of file diff --git a/MelonLoader/Patches/GameObjects/MinorObjects/UltimateChomper_Patch.cs b/MelonLoader/Patches/GameObjects/MinorObjects/UltimateChomper_Patch.cs new file mode 100644 index 0000000..d04c947 --- /dev/null +++ b/MelonLoader/Patches/GameObjects/MinorObjects/UltimateChomper_Patch.cs @@ -0,0 +1,17 @@ +using HarmonyLib; +using Il2Cpp; +using PvZ_Fusion_Translator.AssetStore; + +namespace PvZ_Fusion_Translator.Patches.GameObjects.MinorObjects +{ + [HarmonyPatch(typeof(UltimateChomper), nameof(UltimateChomper.UpdateText))] + public static class UltimateChomper_Patch + { + [HarmonyPostfix] + public static void UpdateText(UltimateChomper __instance) + { + StringStore.TranslateText(__instance.killingText); + StringStore.TranslateText(__instance.killingTextShadow); + } + } +} \ 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 222b54e..621e41a 100644 --- a/MelonLoader/Patches/GameObjects/MinorObjects/Zombie_Patch.cs +++ b/MelonLoader/Patches/GameObjects/MinorObjects/Zombie_Patch.cs @@ -1,12 +1,33 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using HarmonyLib; +using Il2Cpp; +using PvZ_Fusion_Translator.AssetStore; +using UnityEngine; namespace PvZ_Fusion_Translator.Patches.GameObjects.MinorObjects { - class Zombie_Patch + [HarmonyPatch(typeof(Zombie))] + public static class Zombie_Patch { + [HarmonyPatch(nameof(Zombie.Start))] + [HarmonyPostfix] + public static void Start(Zombie __instance) + { + StringStore.TranslateText(__instance.healthText); + StringStore.TranslateText(__instance.healthTextShadow); + if (__instance.healthText.transform.rotation != Quaternion.Euler(0, 0, 0)) + __instance.healthText.transform.rotation = Quaternion.Euler(0f, 0f, 0f); + } + + [HarmonyPatch(nameof(Zombie.Update))] + [HarmonyPrefix] + public static void Update(Zombie __instance) + { + if (__instance.theZombieType == ZombieType.TrainingDummy || !Board.Instance.showZombieHealth) + return; + StringStore.TranslateText(__instance.healthText); + StringStore.TranslateText(__instance.healthTextShadow); + if (__instance.healthText.transform.rotation != Quaternion.Euler(0f, 0f, 0f)) + __instance.healthText.transform.rotation = Quaternion.Euler(0f, 0f, 0f); + } } -} +} \ No newline at end of file diff --git a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj index a2e65b8..b6b9f6e 100644 --- a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj +++ b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj @@ -406,6 +406,8 @@ + +