odyssey id system + some other stuff
This commit is contained in:
parent
c59f94c6dd
commit
14a1681ea9
19 changed files with 403 additions and 396 deletions
|
|
@ -6,6 +6,7 @@ using PvZ_Fusion_Translator.Patches.OtherManagers;
|
|||
using System.Text.Encodings.Web;
|
||||
using System.Text.Json;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace PvZ_Fusion_Translator
|
||||
{
|
||||
|
|
@ -312,8 +313,10 @@ namespace PvZ_Fusion_Translator
|
|||
}
|
||||
string LawnStrings = Resources.Load<TextAsset>("LawnStrings").text;
|
||||
string ZombieStrings = Resources.Load<TextAsset>("ZombieStrings").text;
|
||||
string AbyssBuffData = Resources.Load<TextAsset>("AbyssBuffData").text;
|
||||
File.WriteAllText(Path.Combine(dumpDir, "LawnStrings.json"), LawnStrings);
|
||||
File.WriteAllText(Path.Combine(dumpDir, "ZombieStrings.json"), ZombieStrings);
|
||||
File.WriteAllText(Path.Combine(dumpDir, "AbyssBuffData.json"), AbyssBuffData);
|
||||
|
||||
Dictionary<Achievement, AchievementObject> achievementsList = new Dictionary<Achievement, AchievementObject>();
|
||||
foreach (Il2CppSystem.Collections.Generic.KeyValuePair<Achievement, Il2CppSystem.Tuple<string, string>> entry in AchievementClip.achievementsText)
|
||||
|
|
|
|||
|
|
@ -1,30 +1,30 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using MelonLoader;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TextCore.Text;
|
||||
using UnityEngine.UI;
|
||||
using static MelonLoader.MelonLogger;
|
||||
//using HarmonyLib;
|
||||
//using Il2Cpp;
|
||||
//using Il2CppTMPro;
|
||||
//using MelonLoader;
|
||||
//using PvZ_Fusion_Translator.AssetStore;
|
||||
//using UnityEngine;
|
||||
//using UnityEngine.TextCore.Text;
|
||||
//using UnityEngine.UI;
|
||||
//using static MelonLoader.MelonLogger;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
//namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
//{
|
||||
|
||||
[HarmonyPatch(typeof(AbyssBagMenu))]
|
||||
public static class AbyssBagMenu_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(AbyssBagMenu.Awake))]
|
||||
[HarmonyPostfix]
|
||||
private static void Awake_Post(AbyssCheckInBag __instance)
|
||||
{
|
||||
foreach(TextMeshProUGUI text in __instance.transform.FindChild("Background").GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
text.text = text.text + "_深渊";
|
||||
text.text = StringStore.TranslateText("背包_深渊");
|
||||
text.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
}
|
||||
AbyssMenu2.Instance.UpdateIcons();
|
||||
}
|
||||
}
|
||||
}
|
||||
// [HarmonyPatch(typeof(AbyssBagMenu))]
|
||||
// public static class AbyssBagMenu_Patch
|
||||
// {
|
||||
// [HarmonyPatch(nameof(AbyssBagMenu.Awake))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void Awake_Post(AbyssCheckInBag __instance)
|
||||
// {
|
||||
// foreach(TextMeshProUGUI text in __instance.transform.FindChild("Background").GetComponentsInChildren<TextMeshProUGUI>())
|
||||
// {
|
||||
// text.text = text.text + "_深渊";
|
||||
// text.text = StringStore.TranslateText("背包_深渊");
|
||||
// text.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
// }
|
||||
// AbyssMenu2.Instance.UpdateIcons();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -1,31 +1,31 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using MelonLoader;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TextCore.Text;
|
||||
using UnityEngine.UI;
|
||||
using static MelonLoader.MelonLogger;
|
||||
//using HarmonyLib;
|
||||
//using Il2Cpp;
|
||||
//using Il2CppTMPro;
|
||||
//using MelonLoader;
|
||||
//using PvZ_Fusion_Translator.AssetStore;
|
||||
//using UnityEngine;
|
||||
//using UnityEngine.TextCore.Text;
|
||||
//using UnityEngine.UI;
|
||||
//using static MelonLoader.MelonLogger;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
//namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
//{
|
||||
|
||||
[HarmonyPatch(typeof(AbyssCheckInBag))]
|
||||
public static class AbyssCheckInBag_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(AbyssCheckInBag.MoveFromBag))]
|
||||
[HarmonyPostfix]
|
||||
private static void MoveFromBag(AbyssCheckInBag __instance)
|
||||
{
|
||||
AbyssMenu2.Instance.UpdateIcons();
|
||||
}
|
||||
// [HarmonyPatch(typeof(AbyssCheckInBag))]
|
||||
// public static class AbyssCheckInBag_Patch
|
||||
// {
|
||||
// [HarmonyPatch(nameof(AbyssCheckInBag.MoveFromBag))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void MoveFromBag(AbyssCheckInBag __instance)
|
||||
// {
|
||||
// AbyssMenu2.Instance.UpdateIcons();
|
||||
// }
|
||||
|
||||
[HarmonyPatch(nameof(AbyssCheckInBag.SellIcon))]
|
||||
[HarmonyPostfix]
|
||||
private static void SellIcon(AbyssCheckInBag __instance)
|
||||
{
|
||||
AbyssMenu2.Instance.UpdateIcons();
|
||||
}
|
||||
}
|
||||
}
|
||||
// [HarmonyPatch(nameof(AbyssCheckInBag.SellIcon))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void SellIcon(AbyssCheckInBag __instance)
|
||||
// {
|
||||
// AbyssMenu2.Instance.UpdateIcons();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -1,48 +1,48 @@
|
|||
using System.Text.RegularExpressions;
|
||||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using MelonLoader;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine.TextCore.Text;
|
||||
//using System.Text.RegularExpressions;
|
||||
//using HarmonyLib;
|
||||
//using Il2Cpp;
|
||||
//using Il2CppTMPro;
|
||||
//using MelonLoader;
|
||||
//using PvZ_Fusion_Translator.AssetStore;
|
||||
//using UnityEngine.TextCore.Text;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(AbyssDevelopMenu))]
|
||||
public static class AbyssDevelopMenu_Patch
|
||||
{
|
||||
//namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
//{
|
||||
// [HarmonyPatch(typeof(AbyssDevelopMenu))]
|
||||
// public static class AbyssDevelopMenu_Patch
|
||||
// {
|
||||
|
||||
[HarmonyPatch(nameof(AbyssDevelopMenu.UpdateInfo))]
|
||||
[HarmonyPostfix]
|
||||
private static void UpdateInfo(AbyssDevelopMenu __instance)
|
||||
{
|
||||
__instance.currentMoney.text = StringStore.TranslateText(__instance.currentMoney.text);
|
||||
__instance.upgradeTextInfo.text = StringStore.TranslateText(__instance.upgradeTextInfo.text);
|
||||
// [HarmonyPatch(nameof(AbyssDevelopMenu.UpdateInfo))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void UpdateInfo(AbyssDevelopMenu __instance)
|
||||
// {
|
||||
// __instance.currentMoney.text = StringStore.TranslateText(__instance.currentMoney.text);
|
||||
// __instance.upgradeTextInfo.text = StringStore.TranslateText(__instance.upgradeTextInfo.text);
|
||||
|
||||
TextMeshProUGUI upgradeCostText = __instance.transform.FindChild("UpgradeCost").GetComponent<TextMeshProUGUI>();
|
||||
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
// TextMeshProUGUI upgradeCostText = __instance.transform.FindChild("UpgradeCost").GetComponent<TextMeshProUGUI>();
|
||||
// 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);
|
||||
// Regex regex = new Regex(regexStr);
|
||||
|
||||
if (regex.IsMatch(upgradeCostText.text))
|
||||
{
|
||||
Match match = regex.Match(upgradeCostText.text);
|
||||
int groupCount = match.Groups.Count;
|
||||
// if (regex.IsMatch(upgradeCostText.text))
|
||||
// {
|
||||
// Match match = regex.Match(upgradeCostText.text);
|
||||
// int groupCount = match.Groups.Count;
|
||||
|
||||
List<string> dynamicParts = [];
|
||||
// List<string> dynamicParts = [];
|
||||
|
||||
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);
|
||||
}
|
||||
// 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);
|
||||
// }
|
||||
|
||||
upgradeCostText.text = string.Format(StringStore.translationStringRegex[regexStr], [.. dynamicParts]);
|
||||
upgradeCostText.font = fontAsset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// upgradeCostText.text = string.Format(StringStore.translationStringRegex[regexStr], [.. dynamicParts]);
|
||||
// upgradeCostText.font = fontAsset;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -1,104 +1,104 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using MelonLoader;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TextCore.Text;
|
||||
using UnityEngine.UI;
|
||||
using static MelonLoader.MelonLogger;
|
||||
//using HarmonyLib;
|
||||
//using Il2Cpp;
|
||||
//using Il2CppTMPro;
|
||||
//using MelonLoader;
|
||||
//using PvZ_Fusion_Translator.AssetStore;
|
||||
//using UnityEngine;
|
||||
//using UnityEngine.TextCore.Text;
|
||||
//using UnityEngine.UI;
|
||||
//using static MelonLoader.MelonLogger;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
//namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
//{
|
||||
|
||||
[HarmonyPatch(typeof(AbyssMenu2))]
|
||||
public static class AbyssMenu2_Patch
|
||||
{
|
||||
private static void UpdateAbyss2Text(AbyssMenu2 __instance)
|
||||
{
|
||||
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
// [HarmonyPatch(typeof(AbyssMenu2))]
|
||||
// public static class AbyssMenu2_Patch
|
||||
// {
|
||||
// private static void UpdateAbyss2Text(AbyssMenu2 __instance)
|
||||
// {
|
||||
// TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
|
||||
__instance.buffCountText.text = StringStore.TranslateText(__instance.buffCountText.text);
|
||||
__instance.buffCountText.font = fontAsset;
|
||||
// __instance.buffCountText.text = StringStore.TranslateText(__instance.buffCountText.text);
|
||||
// __instance.buffCountText.font = fontAsset;
|
||||
|
||||
__instance.money.text = StringStore.TranslateText(__instance.money.text);
|
||||
__instance.money.font = fontAsset;
|
||||
// __instance.money.text = StringStore.TranslateText(__instance.money.text);
|
||||
// __instance.money.font = fontAsset;
|
||||
|
||||
__instance.refreshText.text = StringStore.TranslateText(__instance.refreshText.text);
|
||||
__instance.refreshText.font = fontAsset;
|
||||
// __instance.refreshText.text = StringStore.TranslateText(__instance.refreshText.text);
|
||||
// __instance.refreshText.font = fontAsset;
|
||||
|
||||
__instance.statistics.text = StringStore.TranslateText(__instance.statistics.text);
|
||||
__instance.statistics.font = fontAsset;
|
||||
// __instance.statistics.text = StringStore.TranslateText(__instance.statistics.text);
|
||||
// __instance.statistics.font = fontAsset;
|
||||
|
||||
Transform buffTextTransform = __instance.transform.FindChild("BuffText").transform;
|
||||
if (buffTextTransform != null) StringStore.TranslateTextTransform(buffTextTransform);
|
||||
// Transform buffTextTransform = __instance.transform.FindChild("BuffText").transform;
|
||||
// if (buffTextTransform != null) StringStore.TranslateTextTransform(buffTextTransform);
|
||||
|
||||
Transform moneyTransform = __instance.transform.FindChild("Money").transform;
|
||||
if (moneyTransform != null) StringStore.TranslateTextTransform(moneyTransform);
|
||||
// Transform moneyTransform = __instance.transform.FindChild("Money").transform;
|
||||
// if (moneyTransform != null) StringStore.TranslateTextTransform(moneyTransform);
|
||||
|
||||
Transform buffCountTextTransform = __instance.transform.FindChild("BuffCountText").transform;
|
||||
if (buffCountTextTransform != null) StringStore.TranslateTextTransform(buffCountTextTransform);
|
||||
// Transform buffCountTextTransform = __instance.transform.FindChild("BuffCountText").transform;
|
||||
// if (buffCountTextTransform != null) StringStore.TranslateTextTransform(buffCountTextTransform);
|
||||
|
||||
Transform refreshTextTransform = __instance.transform.FindChild("RefreshText").transform;
|
||||
if (refreshTextTransform != null) StringStore.TranslateTextTransform(refreshTextTransform);
|
||||
// Transform refreshTextTransform = __instance.transform.FindChild("RefreshText").transform;
|
||||
// if (refreshTextTransform != null) StringStore.TranslateTextTransform(refreshTextTransform);
|
||||
|
||||
Transform optionsTransform = __instance.transform.FindChild("Options").transform;
|
||||
foreach (AbyssBuffButton abyssBuffButton in optionsTransform.GetComponentsInChildren<AbyssBuffButton>())
|
||||
{
|
||||
foreach (TextMeshProUGUI textMesh in abyssBuffButton.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
textMesh.text = StringStore.TranslateText(textMesh.text);
|
||||
}
|
||||
}
|
||||
// Transform optionsTransform = __instance.transform.FindChild("Options").transform;
|
||||
// foreach (AbyssBuffButton abyssBuffButton in optionsTransform.GetComponentsInChildren<AbyssBuffButton>())
|
||||
// {
|
||||
// foreach (TextMeshProUGUI textMesh in abyssBuffButton.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
// {
|
||||
// textMesh.text = StringStore.TranslateText(textMesh.text);
|
||||
// }
|
||||
// }
|
||||
|
||||
foreach(TextMeshProUGUI text in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
text.font = fontAsset;
|
||||
}
|
||||
}
|
||||
// foreach(TextMeshProUGUI text in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
// {
|
||||
// text.text = StringStore.TranslateText(text.text);
|
||||
// text.font = fontAsset;
|
||||
// }
|
||||
// }
|
||||
|
||||
[HarmonyPatch(nameof(AbyssMenu2.Start))]
|
||||
[HarmonyPostfix]
|
||||
private static void Start(AbyssMenu2 __instance)
|
||||
{
|
||||
UpdateAbyss2Text(__instance);
|
||||
// [HarmonyPatch(nameof(AbyssMenu2.Start))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void Start(AbyssMenu2 __instance)
|
||||
// {
|
||||
// UpdateAbyss2Text(__instance);
|
||||
|
||||
Utils.ConvertButtonText(__instance.transform, "Help");
|
||||
// Utils.ConvertButtonText(__instance.transform, "Help");
|
||||
|
||||
// custom bag text :D
|
||||
// // custom bag text :D
|
||||
|
||||
__instance.transform.FindChild("Bag").FindChild("text").GetComponent<Text>().text += "_深渊";
|
||||
// __instance.transform.FindChild("Bag").FindChild("text").GetComponent<Text>().text += "_深渊";
|
||||
|
||||
Utils.ConvertButtonText(__instance.transform, "Bag");
|
||||
}
|
||||
// Utils.ConvertButtonText(__instance.transform, "Bag");
|
||||
// }
|
||||
|
||||
[HarmonyPatch(nameof(AbyssMenu2.UpdateIcons))]
|
||||
[HarmonyPostfix]
|
||||
private static void UpdateIcons(AbyssMenu2 __instance)
|
||||
{
|
||||
UpdateAbyss2Text(__instance);
|
||||
}
|
||||
// [HarmonyPatch(nameof(AbyssMenu2.UpdateIcons))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void UpdateIcons(AbyssMenu2 __instance)
|
||||
// {
|
||||
// UpdateAbyss2Text(__instance);
|
||||
// }
|
||||
|
||||
[HarmonyPatch(nameof(AbyssMenu2.UpdateBuff))]
|
||||
[HarmonyPostfix]
|
||||
private static void UpdateBuff(AbyssMenu2 __instance)
|
||||
{
|
||||
UpdateAbyss2Text(__instance);
|
||||
}
|
||||
// [HarmonyPatch(nameof(AbyssMenu2.UpdateBuff))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void UpdateBuff(AbyssMenu2 __instance)
|
||||
// {
|
||||
// UpdateAbyss2Text(__instance);
|
||||
// }
|
||||
|
||||
[HarmonyPatch(nameof(AbyssMenu2.BuyBuff))]
|
||||
[HarmonyPostfix]
|
||||
private static void BuyBuff(AbyssMenu2 __instance)
|
||||
{
|
||||
UpdateAbyss2Text(__instance);
|
||||
}
|
||||
// [HarmonyPatch(nameof(AbyssMenu2.BuyBuff))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void BuyBuff(AbyssMenu2 __instance)
|
||||
// {
|
||||
// UpdateAbyss2Text(__instance);
|
||||
// }
|
||||
|
||||
[HarmonyPatch(nameof(AbyssMenu2.ShowBag))]
|
||||
[HarmonyPostfix]
|
||||
private static void ShowBag(AbyssMenu2 __instance)
|
||||
{
|
||||
UpdateAbyss2Text(__instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
// [HarmonyPatch(nameof(AbyssMenu2.ShowBag))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void ShowBag(AbyssMenu2 __instance)
|
||||
// {
|
||||
// UpdateAbyss2Text(__instance);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -1,55 +1,55 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using MelonLoader;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using System.Text.RegularExpressions;
|
||||
//using HarmonyLib;
|
||||
//using Il2Cpp;
|
||||
//using Il2CppTMPro;
|
||||
//using MelonLoader;
|
||||
//using PvZ_Fusion_Translator.AssetStore;
|
||||
//using Unity.VisualScripting;
|
||||
//using UnityEngine;
|
||||
//using System.Text.RegularExpressions;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(AbyssSettlementMenu))]
|
||||
public static class AbyssSettlementMenu_Patch
|
||||
{
|
||||
//namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
//{
|
||||
// [HarmonyPatch(typeof(AbyssSettlementMenu))]
|
||||
// public static class AbyssSettlementMenu_Patch
|
||||
// {
|
||||
|
||||
[HarmonyPatch(nameof(AbyssSettlementMenu.InitSettle))]
|
||||
[HarmonyPostfix]
|
||||
private static void InitSettle(AbyssSettlementMenu __instance)
|
||||
{
|
||||
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
// [HarmonyPatch(nameof(AbyssSettlementMenu.InitSettle))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void InitSettle(AbyssSettlementMenu __instance)
|
||||
// {
|
||||
// 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+)"
|
||||
];
|
||||
// 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+)"
|
||||
// ];
|
||||
|
||||
foreach(string regexStr in regexStrList)
|
||||
{
|
||||
Regex regex = new Regex(regexStr);
|
||||
// foreach(string regexStr in regexStrList)
|
||||
// {
|
||||
// Regex regex = new Regex(regexStr);
|
||||
|
||||
if (regex.IsMatch(__instance.settleInfo.text))
|
||||
{
|
||||
Match match = regex.Match(__instance.settleInfo.text);
|
||||
int groupCount = match.Groups.Count;
|
||||
// if (regex.IsMatch(__instance.settleInfo.text))
|
||||
// {
|
||||
// Match match = regex.Match(__instance.settleInfo.text);
|
||||
// int groupCount = match.Groups.Count;
|
||||
|
||||
List<string> dynamicParts = [];
|
||||
// List<string> dynamicParts = [];
|
||||
|
||||
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);
|
||||
}
|
||||
// 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);
|
||||
// }
|
||||
|
||||
__instance.settleInfo.text = string.Format(StringStore.translationStringRegex[regexStr], [.. dynamicParts]);
|
||||
__instance.settleInfo.font = fontAsset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// __instance.settleInfo.text = string.Format(StringStore.translationStringRegex[regexStr], [.. dynamicParts]);
|
||||
// __instance.settleInfo.font = fontAsset;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
//using HarmonyLib;
|
||||
//using Il2Cpp;
|
||||
//using Il2CppTMPro;
|
||||
//using PvZ_Fusion_Translator.AssetStore;
|
||||
//using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects.ButtonObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(AbyssCheckSellMenu))]
|
||||
public static class AbyssCheckSellMenu_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(AbyssCheckSellMenu.SellIcon))]
|
||||
[HarmonyPostfix]
|
||||
private static void SellIcon(AbyssCheckSellMenu __instance)
|
||||
{
|
||||
AbyssMenu2.Instance.UpdateIcons();
|
||||
}
|
||||
//namespace PvZ_Fusion_Translator.Patches.GameObjects.ButtonObjects
|
||||
//{
|
||||
// [HarmonyPatch(typeof(AbyssCheckSellMenu))]
|
||||
// public static class AbyssCheckSellMenu_Patch
|
||||
// {
|
||||
// [HarmonyPatch(nameof(AbyssCheckSellMenu.SellIcon))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void SellIcon(AbyssCheckSellMenu __instance)
|
||||
// {
|
||||
// AbyssMenu2.Instance.UpdateIcons();
|
||||
// }
|
||||
|
||||
[HarmonyPatch(nameof(AbyssCheckSellMenu.MoveInBag))]
|
||||
[HarmonyPostfix]
|
||||
private static void MoveInBag(AbyssCheckSellMenu __instance)
|
||||
{
|
||||
AbyssMenu2.Instance.UpdateIcons();
|
||||
}
|
||||
}
|
||||
}
|
||||
// [HarmonyPatch(nameof(AbyssCheckSellMenu.MoveInBag))]
|
||||
// [HarmonyPostfix]
|
||||
// private static void MoveInBag(AbyssCheckSellMenu __instance)
|
||||
// {
|
||||
// AbyssMenu2.Instance.UpdateIcons();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
@ -23,13 +23,10 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
Transform randomLevelTextTransform = __instance.transform.FindChild("RandomLevel");
|
||||
foreach(TextMeshProUGUI txt in randomLevelTextTransform.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
if (txt.name.Contains("Text (TMP)"))
|
||||
if (txt.name.Contains("(TMP)"))
|
||||
{
|
||||
Log.LogDebug(txt.transform.parent.name);
|
||||
txt.autoSizeTextContainer = true;
|
||||
if (txt.name == "Text (TMP)")
|
||||
{
|
||||
txt.transform.localPosition = new Vector3(94.4225f, -45.1565f, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,31 +2,40 @@
|
|||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using System.Text.Json;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(NoticeMenu))]
|
||||
public class NoticePauseMenu_Patch
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(nameof(NoticeMenu.Awake))]
|
||||
private static void Pre_Awake(NoticeMenu __instance)
|
||||
{
|
||||
GameObject contentObject = __instance.transform.FindChild("Scroll View").GetChild(0).GetChild(0).gameObject; //bc normal Find or FindChild didn't work
|
||||
|
||||
TextMeshProUGUI contentText = contentObject.GetComponent<TextMeshProUGUI>();
|
||||
File.WriteAllText(Path.Combine(FileLoader.GetAssetDir(FileLoader.AssetType.Dumps), "changelog.txt"), contentText.text);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(nameof(NoticeMenu.Start))]
|
||||
private static void Start(NoticeMenu __instance)
|
||||
[HarmonyPatch(nameof(NoticeMenu.Awake))]
|
||||
private static void Post_Awake(NoticeMenu __instance)
|
||||
{
|
||||
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
Transform warningTransform = __instance.transform.FindChild("窗口");
|
||||
Transform warningTextTransform = warningTransform.FindChild("文字");
|
||||
Transform warningTextShadowTransform = warningTransform.FindChild("文字2");
|
||||
Transform[] array = [warningTextTransform, warningTextShadowTransform];
|
||||
string changelogText = File.ReadAllText(Path.Combine(FileLoader.GetAssetDir(FileLoader.AssetType.Strings, Utils.Language), "changelog.txt"));
|
||||
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
if (array[i] != null)
|
||||
{
|
||||
array[i].GetComponent<TextMeshProUGUI>().text = StringStore.TranslateText(array[i].GetComponent<TextMeshProUGUI>().text);
|
||||
array[i].GetComponent<TextMeshProUGUI>().font = fontAsset;
|
||||
}
|
||||
}
|
||||
GameObject contentObject = __instance.transform.FindChild("Scroll View").GetChild(0).GetChild(0).gameObject; //bc normal Find or FindChild didn't work
|
||||
|
||||
TextMeshProUGUI contentText = contentObject.GetComponent<TextMeshProUGUI>();
|
||||
contentText.text = changelogText;
|
||||
|
||||
ContentSizeFitter sizeFitter = contentObject.AddComponent<ContentSizeFitter>();
|
||||
sizeFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
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
|
||||
|
|
@ -13,9 +14,9 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
[HarmonyPostfix]
|
||||
private static void RefeshOptions(TravelBuffMenu __instance)
|
||||
{
|
||||
foreach(TravelBuffOptionButton button in __instance.options)
|
||||
foreach (TravelBuffOptionButton button in __instance.options)
|
||||
{
|
||||
button.introduce.text = StringStore.TranslateText(button.introduce.text);
|
||||
button.introduce.text = translatedTravelBuffs[buffLinks[button.buffType]][button.buffIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using static PvZ_Fusion_Translator.Patches.Managers.TravelMgr_Patch;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
|
|
@ -12,54 +13,28 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
[HarmonyPostfix]
|
||||
private static void SetBuff(TravelBuffOptionButton __instance)
|
||||
{
|
||||
__instance.introduce.text = StringStore.TranslateText(__instance.introduce.text);
|
||||
__instance.introduce.text = translatedTravelBuffs[buffLinks[__instance.buffType]][__instance.buffIndex];
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TravelBuffOptionButton.Awake))]
|
||||
[HarmonyPostfix]
|
||||
private static void Awake(TravelBuffOptionButton __instance)
|
||||
{
|
||||
__instance.introduce.text = StringStore.TranslateText(__instance.introduce.text);
|
||||
__instance.introduce.text = translatedTravelBuffs[buffLinks[__instance.buffType]][__instance.buffIndex];
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TravelBuffOptionButton.OnAnimOver))]
|
||||
[HarmonyPostfix]
|
||||
private static void OnAnimOver(TravelBuffOptionButton __instance)
|
||||
{
|
||||
__instance.introduce.text = StringStore.TranslateText(__instance.introduce.text);
|
||||
__instance.introduce.text = translatedTravelBuffs[buffLinks[__instance.buffType]][__instance.buffIndex];
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TravelBuffOptionButton.SetBackground))]
|
||||
[HarmonyPostfix]
|
||||
private static void SetBackground(TravelBuffOptionButton __instance)
|
||||
{
|
||||
__instance.introduce.text = StringStore.TranslateText(__instance.introduce.text);
|
||||
__instance.introduce.text = translatedTravelBuffs[buffLinks[__instance.buffType]][__instance.buffIndex];
|
||||
}
|
||||
//[HarmonyPatch(nameof(TravelMenuMgr.SetText))]
|
||||
//[HarmonyPostfix]
|
||||
//private static void SetText(TravelMenuMgr __instance)
|
||||
//{
|
||||
// foreach(TextMeshProUGUI text in __instance.textMesh)
|
||||
// {
|
||||
// text.text = StringStore.TranslateText(text.text);
|
||||
// }
|
||||
// foreach(TextMeshProUGUI text in __instance.textMeshShadow)
|
||||
// {
|
||||
// text.text = StringStore.TranslateText(text.text);
|
||||
// }
|
||||
//}
|
||||
//[HarmonyPatch(nameof(TravelMenuMgr.SetRichText), [typeof(int), typeof(int), typeof(TextMeshProUGUI), typeof(string)])]
|
||||
//[HarmonyPostfix]
|
||||
//private static void SetRichText(TravelMenuMgr __instance)
|
||||
//{
|
||||
// foreach(TextMeshProUGUI text in __instance.textMesh)
|
||||
// {
|
||||
// text.text = StringStore.TranslateText(text.text);
|
||||
// }
|
||||
// foreach(TextMeshProUGUI text in __instance.textMeshShadow)
|
||||
// {
|
||||
// text.text = StringStore.TranslateText(text.text);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
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
|
||||
|
|
@ -9,11 +10,13 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
[HarmonyPatch(typeof(TravelLookBuff))]
|
||||
public static class TravelLookBuff_Patch
|
||||
{
|
||||
private static void TranslateTexts(TravelLookBuff instance)
|
||||
private static void TranslateTexts(TravelLookBuff __instance)
|
||||
{
|
||||
instance.introduce.text = StringStore.TranslateText(instance.introduce.text);
|
||||
string buffText = translatedTravelBuffs[buffLinks[__instance.buffType]][__instance.buffIndex];
|
||||
|
||||
Transform transform = instance.rectTransform.transform;
|
||||
__instance.introduce.text = buffText;
|
||||
|
||||
Transform transform = __instance.rectTransform.transform;
|
||||
var component1 = transform.GetChild(0).GetComponent<TextMeshProUGUI>();
|
||||
var component2 = transform.GetChild(1).GetComponent<TextMeshProUGUI>();
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
[HarmonyPostfix]
|
||||
private static void Postfix_Start(TravelLookMenu __instance)
|
||||
{
|
||||
foreach(TextMeshProUGUI txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
foreach (TextMeshProUGUI txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
txt.text = StringStore.TranslateText(txt.text);
|
||||
txt.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
|
|
@ -36,7 +36,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
[HarmonyPostfix]
|
||||
private static void Update(TravelLookMenu __instance)
|
||||
{
|
||||
if(savedAssetString != __instance.treasureText.text)
|
||||
if (savedAssetString != __instance.treasureText.text)
|
||||
{
|
||||
__instance.treasureText.text = StringStore.TranslateText(__instance.treasureText.text);
|
||||
savedAssetString = __instance.treasureText.text;
|
||||
|
|
|
|||
|
|
@ -15,41 +15,6 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
{
|
||||
__instance.text = StringStore.TranslateText(__instance.text);
|
||||
__instance.text_shadow = StringStore.TranslateText(__instance.text_shadow);
|
||||
|
||||
//TextMeshProUGUI pointsText = __instance.transform.GetChild(0).GetComponent<TextMeshProUGUI>();
|
||||
//pointsText = StringStore.TranslateText(pointsText);
|
||||
//pointsText.autoSizeTextContainer = true;
|
||||
|
||||
|
||||
//Transform TravelMenuTransform = __instance.transform.parent.transform;
|
||||
|
||||
//Transform refreshTransform = TravelMenuTransform.Find("Refresh2").transform.Find("bank");
|
||||
//if (refreshTransform != null)
|
||||
//{
|
||||
// Transform text_1Transform = refreshTransform.Find("text_1");
|
||||
// if (text_1Transform != null)
|
||||
// {
|
||||
// TextMeshProUGUI text_1 = text_1Transform.GetComponent<TextMeshProUGUI>();
|
||||
|
||||
// if (text_1)
|
||||
// {
|
||||
// text_1 = StringStore.TranslateText(text_1);
|
||||
// text_1.autoSizeTextContainer = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// Transform text_2Transform = refreshTransform.Find("text_2");
|
||||
// if (text_2Transform != null)
|
||||
// {
|
||||
// TextMeshProUGUI text_2 = text_2Transform.GetComponent<TextMeshProUGUI>();
|
||||
|
||||
// if (text_2)
|
||||
// {
|
||||
// text_2 = StringStore.TranslateText(text_2);
|
||||
// text_2.autoSizeTextContainer = true;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TravelRefresh.OnMouseUpAsButton))]
|
||||
|
|
@ -58,41 +23,6 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
{
|
||||
__instance.text = StringStore.TranslateText(__instance.text);
|
||||
__instance.text_shadow = StringStore.TranslateText(__instance.text_shadow);
|
||||
|
||||
//TextMeshProUGUI pointsText = __instance.transform.GetChild(0).GetComponent<TextMeshProUGUI>();
|
||||
//pointsText = StringStore.TranslateText(pointsText);
|
||||
//pointsText.autoSizeTextContainer = true;
|
||||
|
||||
|
||||
//Transform TravelMenuTransform = __instance.transform.parent.transform;
|
||||
|
||||
//Transform refreshTransform = TravelMenuTransform.Find("Refresh2").transform.Find("bank");
|
||||
//if (refreshTransform != null)
|
||||
//{
|
||||
// Transform text_1Transform = refreshTransform.Find("text_1");
|
||||
// if (text_1Transform != null)
|
||||
// {
|
||||
// TextMeshProUGUI text_1 = text_1Transform.GetComponent<TextMeshProUGUI>();
|
||||
|
||||
// if (text_1)
|
||||
// {
|
||||
// text_1 = StringStore.TranslateText(text_1);
|
||||
// text_1.autoSizeTextContainer = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// Transform text_2Transform = refreshTransform.Find("text_2");
|
||||
// if (text_2Transform != null)
|
||||
// {
|
||||
// TextMeshProUGUI text_2 = text_2Transform.GetComponent<TextMeshProUGUI>();
|
||||
|
||||
// if (text_2)
|
||||
// {
|
||||
// text_2 = StringStore.TranslateText(text_2);
|
||||
// text_2.autoSizeTextContainer = true;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
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
|
||||
|
|
@ -13,11 +14,18 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
[HarmonyPostfix]
|
||||
private static void Update(TravelStore __instance)
|
||||
{
|
||||
foreach (TextMeshProUGUI intr in __instance.introduces)
|
||||
intr.text = StringStore.TranslateText(intr.text);
|
||||
foreach(TextMeshProUGUI text in __instance.introduces)
|
||||
{
|
||||
if(__instance.currentSelect != null)
|
||||
{
|
||||
text.text = translatedTravelBuffs[buffLinks[(BuffType)__instance.currentSelect.theBuffType]][__instance.currentSelect.theBuffNumber];
|
||||
}
|
||||
}
|
||||
foreach (var textMesh in __instance.points)
|
||||
{
|
||||
textMesh.text = StringStore.TranslateText(textMesh.text);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TravelStore.RefreshBuff))]
|
||||
[HarmonyPostfix]
|
||||
|
|
@ -28,12 +36,19 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
|||
TextMeshProUGUI cost = buff.transform.GetChild(1).GetComponent<TextMeshProUGUI>();
|
||||
cost.text = StringStore.TranslateText(cost.text);
|
||||
cost.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
FileLoader.DumpUntranslatedStrings(cost.text);
|
||||
}
|
||||
foreach (TextMeshProUGUI intr in __instance.introduces)
|
||||
intr.text = StringStore.TranslateText(intr.text);
|
||||
|
||||
foreach (TextMeshProUGUI text in __instance.introduces)
|
||||
{
|
||||
if (__instance.currentSelect != null)
|
||||
{
|
||||
text.text = translatedTravelBuffs[buffLinks[(BuffType)__instance.currentSelect.theBuffType]][__instance.currentSelect.theBuffNumber];
|
||||
}
|
||||
}
|
||||
foreach (var textMesh in __instance.points)
|
||||
{
|
||||
textMesh.text = StringStore.TranslateText(textMesh.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.Managers
|
||||
{
|
||||
|
|
|
|||
71
MelonLoader/Patches/Managers/TravelMgr_Patch.cs
Normal file
71
MelonLoader/Patches/Managers/TravelMgr_Patch.cs
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
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<BuffType, string> buffLinks = new Dictionary<BuffType, string>()
|
||||
{
|
||||
{ BuffType.AdvancedBuff, "advancedUpgrades" },
|
||||
{ BuffType.UltimateBuff, "ultimateUpgrades" },
|
||||
{ BuffType.UnlockPlant, "strongUltimates" },
|
||||
{ BuffType.Debuff, "debuffs" },
|
||||
};
|
||||
|
||||
public static Dictionary<string, List<string>> translatedTravelBuffs = new Dictionary<string, List<string>>();
|
||||
|
||||
public static void DumpTravelBuffs(Il2CppSystem.Collections.Generic.Dictionary<int, string> source, Dictionary<string, List<string>> dest, string index)
|
||||
{
|
||||
foreach (var i in source)
|
||||
{
|
||||
if (!Utils.CheckForUntranslatedText(i.Value))
|
||||
{
|
||||
break;
|
||||
}
|
||||
dest[index].Add(i.Value);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(TravelMgr.Awake))]
|
||||
[HarmonyPrefix]
|
||||
private static void Pre_Awake(TravelMgr __instance)
|
||||
{
|
||||
// Dump buffs
|
||||
|
||||
Dictionary<string, List<string>> dumpedTravelBuffs = new Dictionary<string, List<string>>()
|
||||
{
|
||||
{ "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 travelBuffs = File.ReadAllText(Path.Combine(stringDir, "travel_buffs.json"));
|
||||
|
||||
translatedTravelBuffs = JsonSerializer.Deserialize<Dictionary<string, List<string>>>(travelBuffs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
<LangVersion>latest</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Configurations>Debug;DebugEnglish;ReleaseMulti;ReleaseEnglish;DebugTesting;ReleaseOther;DebugObfuscate;ReleaseObfuscate</Configurations>
|
||||
<GamePath>C:\Users\rainb\Desktop\PC_PVZ-Fusion_3.0.1</GamePath>
|
||||
<GamePath>C:\Users\rainb\Desktop\PC_PVZ-Fusion_3.1.1</GamePath>
|
||||
<Platforms>AnyCPU;ARM64;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
@ -461,6 +461,7 @@
|
|||
<Compile Include="Patches\Managers\CustomLevelShower_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\Garden_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\DrawCardManager_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\TravelMgr_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\TreasureManager_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\TowerManager_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\SaveMenu_Patch.cs" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue