Sync MelonLoader from origin/main (keep BepInEx changes)
This commit is contained in:
parent
e36fad45ca
commit
25621b7df0
20 changed files with 395 additions and 210 deletions
|
|
@ -114,6 +114,14 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
StringStore.TranslateTextTransform(pageEndlessLevelTransform.Find("LastPage"));
|
StringStore.TranslateTextTransform(pageEndlessLevelTransform.Find("LastPage"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Transform pageNewAdvantureLevelTransform = levelsTransform.transform.Find("PageNewAdvantureLevel");
|
||||||
|
if (pageNewAdvantureLevelTransform != null)
|
||||||
|
{
|
||||||
|
StringStore.TranslateTextTransform(pageNewAdvantureLevelTransform.Find("BackToIndex"));
|
||||||
|
StringStore.TranslateTextTransform(pageNewAdvantureLevelTransform.Find("Nextpage"));
|
||||||
|
StringStore.TranslateTextTransform(pageNewAdvantureLevelTransform.Find("LastPage"));
|
||||||
|
}
|
||||||
|
|
||||||
foreach (TextMeshProUGUI txt in mainTransform.GetComponentsInChildren<TextMeshProUGUI>())
|
foreach (TextMeshProUGUI txt in mainTransform.GetComponentsInChildren<TextMeshProUGUI>())
|
||||||
{
|
{
|
||||||
// Still dump untranslated strings for modded plants and zombies
|
// Still dump untranslated strings for modded plants and zombies
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,16 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects
|
||||||
{
|
{
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(nameof(NormalBtn.OnMouseUpAsButton))]
|
[HarmonyPatch(nameof(NormalBtn.OnMouseUpAsButton))]
|
||||||
public static void OnMouseUpAsButton(NormalBtn __instance)
|
public static void OnMouseUpAsButton(NormalBtn __instance)
|
||||||
{
|
{
|
||||||
Transform banTransform = __instance.transform.GetChild(0);
|
if (__instance.transform.childCount > 0)
|
||||||
if (banTransform != null)
|
{
|
||||||
{
|
Transform banTransform = __instance.transform.GetChild(0);
|
||||||
banTransform.GetComponent<TextMeshPro>().text = StringStore.TranslateText(banTransform.GetComponent<TextMeshPro>().text);
|
if (banTransform != null)
|
||||||
}
|
{
|
||||||
|
banTransform.GetComponent<TextMeshPro>().text = StringStore.TranslateText(banTransform.GetComponent<TextMeshPro>().text);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,6 +3,7 @@ using TMPro;
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
using static PvZ_Fusion_Translator__BepInEx_.Patches.Managers.TravelMgr_Patch;
|
using static PvZ_Fusion_Translator__BepInEx_.Patches.Managers.TravelMgr_Patch;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
{
|
{
|
||||||
|
|
@ -16,6 +17,9 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
foreach (TravelBuffOptionButton button in __instance.options)
|
foreach (TravelBuffOptionButton button in __instance.options)
|
||||||
{
|
{
|
||||||
button.introduce.text = translatedTravelBuffs[buffLinks[button.buffType]][button.buffIndex];
|
button.introduce.text = translatedTravelBuffs[buffLinks[button.buffType]][button.buffIndex];
|
||||||
|
List<string> buffSet = translatedTravelBuffs[buffLinks[button.buffType]];
|
||||||
|
string buffText = (button.buffIndex < buffSet.Count && button.show != null) ? buffSet[button.buffIndex] : StringStore.TranslateText(button.introduce.text);
|
||||||
|
button.introduce.text = buffText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
private static void SetBuff(TravelBuffOptionButton __instance)
|
private static void SetBuff(TravelBuffOptionButton __instance)
|
||||||
{
|
{
|
||||||
List<string> buffSet = translatedTravelBuffs[buffLinks[__instance.buffType]];
|
List<string> buffSet = translatedTravelBuffs[buffLinks[__instance.buffType]];
|
||||||
string buffText = (__instance.buffIndex < buffSet.Count) ? buffSet[__instance.buffIndex] : StringStore.TranslateText(__instance.introduce.text);
|
string buffText = (__instance.buffIndex < buffSet.Count && __instance.show != null) ? buffSet[__instance.buffIndex] : StringStore.TranslateText(__instance.introduce.text);
|
||||||
|
__instance.introduce.text = buffText;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPatch(nameof(TravelBuffOptionButton.Awake))]
|
[HarmonyPatch(nameof(TravelBuffOptionButton.Awake))]
|
||||||
|
|
@ -24,7 +25,8 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
private static void Awake(TravelBuffOptionButton __instance)
|
private static void Awake(TravelBuffOptionButton __instance)
|
||||||
{
|
{
|
||||||
List<string> buffSet = translatedTravelBuffs[buffLinks[__instance.buffType]];
|
List<string> buffSet = translatedTravelBuffs[buffLinks[__instance.buffType]];
|
||||||
string buffText = (__instance.buffIndex < buffSet.Count) ? buffSet[__instance.buffIndex] : StringStore.TranslateText(__instance.introduce.text);
|
string buffText = (__instance.buffIndex < buffSet.Count && __instance.show != null) ? buffSet[__instance.buffIndex] : StringStore.TranslateText(__instance.introduce.text);
|
||||||
|
__instance.introduce.text = buffText;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPatch(nameof(TravelBuffOptionButton.OnAnimOver))]
|
[HarmonyPatch(nameof(TravelBuffOptionButton.OnAnimOver))]
|
||||||
|
|
@ -32,7 +34,8 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
private static void OnAnimOver(TravelBuffOptionButton __instance)
|
private static void OnAnimOver(TravelBuffOptionButton __instance)
|
||||||
{
|
{
|
||||||
List<string> buffSet = translatedTravelBuffs[buffLinks[__instance.buffType]];
|
List<string> buffSet = translatedTravelBuffs[buffLinks[__instance.buffType]];
|
||||||
string buffText = (__instance.buffIndex < buffSet.Count) ? buffSet[__instance.buffIndex] : StringStore.TranslateText(__instance.introduce.text);
|
string buffText = (__instance.buffIndex < buffSet.Count && __instance.show != null) ? buffSet[__instance.buffIndex] : StringStore.TranslateText(__instance.introduce.text);
|
||||||
|
__instance.introduce.text = buffText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,19 +8,18 @@ using System.Linq;
|
||||||
|
|
||||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
{
|
{
|
||||||
[HarmonyPatch(typeof(TravelStore))]
|
|
||||||
public static class TravelStore_Patch
|
public static class TravelStore_Patch
|
||||||
{
|
{
|
||||||
[HarmonyPatch(nameof(TravelStore.Update))]
|
[HarmonyPatch(nameof(TravelStore.Update))]
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
private static void Update(TravelStore __instance)
|
private static void Update(TravelStore __instance)
|
||||||
{
|
{
|
||||||
foreach(TextMeshProUGUI text in __instance.introduces)
|
foreach (TextMeshProUGUI text in __instance.introduces)
|
||||||
{
|
{
|
||||||
if(__instance.currentSelect != null)
|
if (__instance.currentSelect != null)
|
||||||
{
|
{
|
||||||
var buffList = translatedTravelBuffs[buffLinks[(BuffType)__instance.currentSelect.theBuffType]];
|
var buffList = translatedTravelBuffs[buffLinks[(BuffType)__instance.currentSelect.theBuffType]];
|
||||||
if(__instance.currentSelect.theBuffNumber < buffList.Count)
|
if (__instance.currentSelect.theBuffNumber < buffList.Count && __instance.currentSelect.theBuffNumber > -1)
|
||||||
{
|
{
|
||||||
text.text = buffList[__instance.currentSelect.theBuffNumber];
|
text.text = buffList[__instance.currentSelect.theBuffNumber];
|
||||||
}
|
}
|
||||||
|
|
@ -45,13 +44,21 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects
|
||||||
TextMeshProUGUI cost = buff.transform.GetChild(1).GetComponent<TextMeshProUGUI>();
|
TextMeshProUGUI cost = buff.transform.GetChild(1).GetComponent<TextMeshProUGUI>();
|
||||||
cost.text = StringStore.TranslateText(cost.text);
|
cost.text = StringStore.TranslateText(cost.text);
|
||||||
cost.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
cost.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||||
//FileLoader.DumpUntranslatedStrings(cost.text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (TextMeshProUGUI text in __instance.introduces)
|
foreach (TextMeshProUGUI text in __instance.introduces)
|
||||||
{
|
{
|
||||||
if (__instance.currentSelect != null)
|
if (__instance.currentSelect != null)
|
||||||
{
|
{
|
||||||
text.text = translatedTravelBuffs[buffLinks[(BuffType)__instance.currentSelect.theBuffType]][__instance.currentSelect.theBuffNumber];
|
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)
|
foreach (var textMesh in __instance.points)
|
||||||
|
|
|
||||||
|
|
@ -204,5 +204,23 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
||||||
banText.text = StringStore.TranslateText(banText.text);
|
banText.text = StringStore.TranslateText(banText.text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(nameof(AlmanacPlantBank.Start))]
|
||||||
|
[HarmonyPostfix]
|
||||||
|
public static void Post_Start(AlmanacPlantBank __instance)
|
||||||
|
{
|
||||||
|
GameObject skinTextObj = __instance.skinButton.transform.GetChild(0).gameObject;
|
||||||
|
GameObject skinShadowTextObj = UnityEngine.Object.Instantiate(skinTextObj, parent: __instance.skinButton.transform);
|
||||||
|
TextMeshPro skinShadowText = skinShadowTextObj.GetComponent<TextMeshPro>();
|
||||||
|
skinShadowText.text = StringStore.TranslateText("换肤_S");
|
||||||
|
skinShadowText.sortingOrder -= 2;
|
||||||
|
skinShadowTextObj.transform.Translate(new Vector3(0.015f, -0.015f, 0));
|
||||||
|
skinTextObj.transform.Translate(new Vector3(-0.022f, 0));
|
||||||
|
skinShadowTextObj.transform.Translate(new Vector3(-0.022f, 0));
|
||||||
|
__instance.skinButton.transform.localScale /= 1.75f;
|
||||||
|
__instance.skinButton.transform.Translate(new Vector3(-0.075f, -0.15f, 0));
|
||||||
|
__instance.skinButton.transform.GetChild(1).Translate(new Vector3(0.35f, 0));
|
||||||
|
__instance.skinButton.transform.GetChild(2).Translate(new Vector3(-0.35f, 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,89 +1,48 @@
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using System;
|
|
||||||
using TMPro;
|
|
||||||
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
using PvZ_Fusion_Translator__BepInEx_.AssetStore;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using TMPro;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers
|
||||||
{
|
{
|
||||||
[HarmonyPatch(typeof(OppositeBuffManager))]
|
[HarmonyPatch(typeof(OppositeBuffManager))]
|
||||||
public static class OppositeBuffManager_Patch
|
public static class OppositeBuffManager_Patch
|
||||||
{
|
{
|
||||||
#if TESTING
|
public static Dictionary<BuffType, string> buffLinks = TravelMgr_Patch.buffLinks;
|
||||||
[HarmonyPatch(nameof(OppositeBuffManager.InitBuffPool))]
|
public static Dictionary<string, List<string>> translatedTravelBuffs = TravelMgr_Patch.translatedTravelBuffs;
|
||||||
[HarmonyPostfix]
|
public static string badPattern = @"^但(.*)";
|
||||||
private static void InitBuffPool(OppositeBuffManager __instance)
|
public static string badFormat = StringStore.translationStringRegex.ContainsKey(badPattern) ? StringStore.translationStringRegex[badPattern] : "But, {0}";
|
||||||
{
|
public static TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||||
foreach(TextMeshProUGUI text in __instance.textA_bad)
|
|
||||||
{
|
|
||||||
string stripText = text.text.Replace("但", "");
|
|
||||||
string translatedText = StringStore.TranslateText(stripText);
|
|
||||||
string replacementText = StringStore.translationString["但"] + translatedText;
|
|
||||||
text.text = replacementText;
|
|
||||||
}
|
|
||||||
foreach(TextMeshProUGUI text in __instance.textA_good)
|
|
||||||
{
|
|
||||||
text.text = StringStore.TranslateText(text.text);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach(TextMeshProUGUI text in __instance.textB_bad)
|
[HarmonyPatch(nameof(OppositeBuffManager.Awake))]
|
||||||
{
|
[HarmonyPostfix]
|
||||||
string stripText = text.text.Replace("但", "");
|
private static void Awake(OppositeBuffManager __instance)
|
||||||
string translatedText = StringStore.TranslateText(stripText);
|
{
|
||||||
string replacementText = StringStore.translationString["但"] + translatedText;
|
TranslateOppositeText(__instance.textA_bad, BuffType.Debuff, __instance.buffA.theDebuffID, true);
|
||||||
text.text = replacementText;
|
TranslateOppositeText(__instance.textA_good, __instance.buffA.theOptionType, __instance.buffA.theOptionID);
|
||||||
}
|
TranslateOppositeText(__instance.textB_bad, BuffType.Debuff, __instance.buffB.theDebuffID, true);
|
||||||
foreach(TextMeshProUGUI text in __instance.textB_good)
|
TranslateOppositeText(__instance.textB_good, __instance.buffB.theOptionType, __instance.buffB.theOptionID);
|
||||||
{
|
}
|
||||||
text.text = StringStore.TranslateText(text.text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[HarmonyPatch(nameof(OppositeBuffManager.SetText), new Type[] { typeof(TextMeshProUGUI), typeof(BuffType), typeof(int)})]
|
public static void TranslateOppositeText(Il2CppSystem.Collections.Generic.List<TextMeshProUGUI> textList, BuffType buffType, int buffIndex, bool isBad = false)
|
||||||
[HarmonyPostfix]
|
{
|
||||||
private static void SetText(OppositeBuffManager __instance)
|
string buff = translatedTravelBuffs[buffLinks[buffType]][buffIndex];
|
||||||
{
|
|
||||||
foreach(TextMeshProUGUI text in __instance.textA_bad)
|
|
||||||
{
|
|
||||||
string stripText = text.text.Replace("?", "");
|
|
||||||
string translatedText = StringStore.TranslateText(stripText);
|
|
||||||
string replacementText = StringStore.translationString["但"] + translatedText;
|
|
||||||
text.text = replacementText;
|
|
||||||
}
|
|
||||||
foreach(TextMeshProUGUI text in __instance.textA_good)
|
|
||||||
{
|
|
||||||
text.text = StringStore.TranslateText(text.text);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach(TextMeshProUGUI text in __instance.textB_bad)
|
foreach (var text in textList)
|
||||||
{
|
{
|
||||||
string stripText = text.text.Replace("但", "");
|
if (isBad)
|
||||||
string translatedText = StringStore.TranslateText(stripText);
|
{
|
||||||
string replacementText = StringStore.translationString["但"] + translatedText;
|
text.text = string.Format(badFormat, buff);
|
||||||
text.text = replacementText;
|
}
|
||||||
}
|
else
|
||||||
foreach(TextMeshProUGUI text in __instance.textB_good)
|
{
|
||||||
{
|
text.text = buff;
|
||||||
text.text = StringStore.TranslateText(text.text);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
[HarmonyPatch(nameof(OppositeBuffManager.SetText), new Type[] { typeof(TextMeshProUGUI), typeof(BuffType), typeof(int)})]
|
text.font = fontAsset;
|
||||||
[HarmonyPostfix]
|
}
|
||||||
private static void SetText(OppositeBuffManager __instance, ref TextMeshProUGUI text)
|
}
|
||||||
{
|
}
|
||||||
StringStore.TranslateTextUI(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HarmonyPatch(nameof(OppositeBuffManager.Awake))]
|
|
||||||
[HarmonyPostfix]
|
|
||||||
private static void Awake(OppositeBuffManager __instance)
|
|
||||||
{
|
|
||||||
StringStore.TranslateTextUI(__instance.textA_bad[0]);
|
|
||||||
StringStore.TranslateTextUI(__instance.textA_bad[1]);
|
|
||||||
StringStore.TranslateTextUI(__instance.textB_bad[0]);
|
|
||||||
StringStore.TranslateTextUI(__instance.textB_bad[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,8 @@
|
||||||
https://nuget.samboy.dev/v3/index.json
|
https://nuget.samboy.dev/v3/index.json
|
||||||
</RestoreAdditionalProjectSources>
|
</RestoreAdditionalProjectSources>
|
||||||
<RootNamespace>PvZ_Fusion_Translator__BepInEx_</RootNamespace>
|
<RootNamespace>PvZ_Fusion_Translator__BepInEx_</RootNamespace>
|
||||||
<GamePath>D:\PvZ Fusion\BepInEx Game Files</GamePath>
|
<GamePath>C:\Users\rainb\Desktop\PC_PVZ-Fusion_3.1.1-BepInEx</GamePath>
|
||||||
|
<GamePathMelon>C:\Users\rainb\Desktop\PC_PVZ-Fusion_3.1.1</GamePathMelon>
|
||||||
<Configurations>Debug;DebugEnglish;ReleaseMulti;ReleaseEnglish;DebugTesting;ReleaseOther;DebugObfuscate;ReleaseObfuscate;DebugMulti</Configurations>
|
<Configurations>Debug;DebugEnglish;ReleaseMulti;ReleaseEnglish;DebugTesting;ReleaseOther;DebugObfuscate;ReleaseObfuscate;DebugMulti</Configurations>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
@ -592,8 +593,7 @@
|
||||||
|
|
||||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||||
<Exec Command="COPY "$(TargetPath)" "$(GamePath)\BepInEx\plugins"" />
|
<Exec Command="COPY "$(TargetPath)" "$(GamePath)\BepInEx\plugins"" />
|
||||||
<!--<Exec Command="COPY "$(TargetPath)" "$(GamePathMelon)\Translation Builds\"" />-->
|
<Exec Command="COPY "$(TargetPath)" "$(GamePathMelon)\Translation Builds\"" />
|
||||||
|
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ namespace PvZ_Fusion_Translator
|
||||||
AudioStore.Init();
|
AudioStore.Init();
|
||||||
FontStore.Init();
|
FontStore.Init();
|
||||||
Utils.RegisterPlantIndices();
|
Utils.RegisterPlantIndices();
|
||||||
|
//Utils.RegisterRecipeLinks();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnLateInitializeMelon()
|
public override void OnLateInitializeMelon()
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ using Unity.Collections;
|
||||||
using Unity.VisualScripting;
|
using Unity.VisualScripting;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using static Il2Cpp.AlmanacPlantBank;
|
||||||
using static PvZ_Fusion_Translator.FileLoader;
|
using static PvZ_Fusion_Translator.FileLoader;
|
||||||
using static PvZ_Fusion_Translator.Utils;
|
using static PvZ_Fusion_Translator.Utils;
|
||||||
|
|
||||||
|
|
@ -50,7 +51,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||||
public static bool SearchChanged(AlmanacPlantMenu __instance, ref TMP_InputField inputField)
|
public static bool SearchChanged(AlmanacPlantMenu __instance, ref TMP_InputField inputField)
|
||||||
{
|
{
|
||||||
string search = inputField.text;
|
string search = inputField.text;
|
||||||
if (search != StringStore.TranslateText("搜索"))
|
if (search != StringStore.TranslateText("搜索") && search != "")
|
||||||
{
|
{
|
||||||
string currentLanguage = Utils.Language.ToString();
|
string currentLanguage = Utils.Language.ToString();
|
||||||
string almanacDir = GetAssetDir(AssetType.Almanac, Utils.Language);
|
string almanacDir = GetAssetDir(AssetType.Almanac, Utils.Language);
|
||||||
|
|
@ -62,30 +63,12 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||||
|
|
||||||
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(currentLanguage);
|
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(currentLanguage);
|
||||||
|
|
||||||
AlmanacPlantBank.PlantData plantData = JsonUtility.FromJson<AlmanacPlantBank.PlantData>(json);
|
PlantData plantData = JsonUtility.FromJson<PlantData>(json);
|
||||||
|
|
||||||
Il2CppSystem.Collections.Generic.List<PlantType> searchedPlants = new();
|
Il2CppSystem.Collections.Generic.List<PlantType> searchedPlants = new();
|
||||||
|
|
||||||
foreach (AlmanacPlantBank.PlantInfo plantInfo in plantData.plants)
|
foreach (PlantInfo plantInfo in plantData.plants)
|
||||||
{
|
{
|
||||||
//List<int> uniqueIngredients = GetIngredients(plantInfo.seedType);
|
|
||||||
|
|
||||||
//// ingredient-based search
|
|
||||||
|
|
||||||
//foreach(int i in uniqueIngredients)
|
|
||||||
//{
|
|
||||||
// string name = Utils.GetPlantNameFromAlmanac((PlantType)i);
|
|
||||||
|
|
||||||
// if(name.ToLower().Contains(search.ToLower()))
|
|
||||||
// {
|
|
||||||
// searchedPlants.Add((PlantType)i);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
// keyword-based search
|
|
||||||
|
|
||||||
// name-based search
|
|
||||||
|
|
||||||
if (plantInfo.name.ToLower().Contains(search.ToLower()))
|
if (plantInfo.name.ToLower().Contains(search.ToLower()))
|
||||||
{
|
{
|
||||||
searchedPlants.Add((PlantType)plantInfo.seedType);
|
searchedPlants.Add((PlantType)plantInfo.seedType);
|
||||||
|
|
@ -99,65 +82,5 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<int> GetIngredients(int theSeedType)
|
|
||||||
{
|
|
||||||
List<int> ingredientPairs = new();
|
|
||||||
Il2CppSystem.Array mixData = MixData.data.Cast<Il2CppSystem.Array>();
|
|
||||||
int rows = mixData.GetLength(0);
|
|
||||||
int columns = mixData.GetLength(1);
|
|
||||||
|
|
||||||
for(int i = 0; i < rows; i++)
|
|
||||||
{
|
|
||||||
for(int j = 0; j < columns; j++)
|
|
||||||
{
|
|
||||||
if(ContainsFormula(theSeedType))
|
|
||||||
{
|
|
||||||
if (mixData.GetValue(i, j).Unbox<int>() == theSeedType)
|
|
||||||
{
|
|
||||||
if (!ingredientPairs.Contains(i))
|
|
||||||
{
|
|
||||||
ingredientPairs.Add(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ingredientPairs.Contains(j))
|
|
||||||
{
|
|
||||||
ingredientPairs.Add(j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return ingredientPairs;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ingredientPairs;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool ContainsFormula(int theSeedType)
|
|
||||||
{
|
|
||||||
bool contains = false;
|
|
||||||
|
|
||||||
Il2CppSystem.Array mixData = MixData.data.Cast<Il2CppSystem.Array>();
|
|
||||||
int rows = mixData.GetLength(0);
|
|
||||||
int columns = mixData.GetLength(1);
|
|
||||||
|
|
||||||
for (int i = 0; i < rows; i++)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < columns; j++)
|
|
||||||
{
|
|
||||||
if (mixData.GetValue(i, j).Unbox<int>() == theSeedType)
|
|
||||||
{
|
|
||||||
contains = true;
|
|
||||||
return contains;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return contains;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects.ButtonObjects
|
||||||
[HarmonyPatch(nameof(ExploreMakeZombieButton.Start))]
|
[HarmonyPatch(nameof(ExploreMakeZombieButton.Start))]
|
||||||
public static void Start(ExploreMakeZombieButton __instance)
|
public static void Start(ExploreMakeZombieButton __instance)
|
||||||
{
|
{
|
||||||
//__instance.sceneText.text = Utils.GetZombieNameFromAlmanac(__instance.theZombieType);
|
__instance.sceneText.text = Utils.GetZombieNameFromAlmanac(__instance.theZombieType);
|
||||||
//__instance.sceneText.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
__instance.sceneText.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -41,5 +41,45 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(nameof(UIButton.OnMouseUpAsButton))]
|
||||||
|
[HarmonyPostfix]
|
||||||
|
public static void Postfix_OnMouseUpAsButton(UIButton __instance)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (__instance.transform.childCount >= 2)
|
||||||
|
{
|
||||||
|
if (__instance.name == "EditMode")
|
||||||
|
{
|
||||||
|
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||||
|
|
||||||
|
TextMeshProUGUI text = __instance.transform.GetChild(0).GetComponent<TextMeshProUGUI>();
|
||||||
|
TextMeshProUGUI[] extraTexts = __instance.transform.GetChild(1).GetComponentsInChildren<TextMeshProUGUI>();
|
||||||
|
|
||||||
|
text.text = StringStore.TranslateText(text.text, false);
|
||||||
|
text.font = fontAsset;
|
||||||
|
|
||||||
|
foreach (TextMeshProUGUI extraText in extraTexts)
|
||||||
|
{
|
||||||
|
extraText.text = StringStore.TranslateText(extraText.text, false);
|
||||||
|
extraText.font = fontAsset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TextMeshProUGUI text = __instance.transform.GetChild(0).GetComponent<TextMeshProUGUI>();
|
||||||
|
TextMeshProUGUI textShadow = __instance.transform.GetChild(1).GetComponent<TextMeshProUGUI>();
|
||||||
|
|
||||||
|
text.text = StringStore.TranslateText(text.text, false);
|
||||||
|
textShadow.text = StringStore.TranslateText(textShadow.text, false);
|
||||||
|
|
||||||
|
text.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||||
|
textShadow.font = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception) { }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
38
MelonLoader/Patches/GameObjects/EveBuffMenu_Patch.cs
Normal file
38
MelonLoader/Patches/GameObjects/EveBuffMenu_Patch.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
using HarmonyLib;
|
||||||
|
using Il2Cpp;
|
||||||
|
using Il2CppTMPro;
|
||||||
|
using PvZ_Fusion_Translator.AssetStore;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(EveBuffMenu))]
|
||||||
|
public static class EveBuffMenu_Patch
|
||||||
|
{
|
||||||
|
[HarmonyPatch(nameof(EveBuffMenu.Start))]
|
||||||
|
[HarmonyPostfix]
|
||||||
|
private static void Start(EveBuffMenu __instance)
|
||||||
|
{
|
||||||
|
foreach (EveOptionWindow window in __instance.windows)
|
||||||
|
{
|
||||||
|
EveOptionWindow_Patch.TranslateEveOptionWindow(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (TextMeshProUGUI text in __instance.quitButton.GetComponentsInChildren<TextMeshProUGUI>())
|
||||||
|
{
|
||||||
|
text.text = StringStore.TranslateText("合上");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(nameof(EveBuffMenu.InitWindows))]
|
||||||
|
[HarmonyPostfix]
|
||||||
|
private static void InitWindows(EveBuffMenu __instance)
|
||||||
|
{
|
||||||
|
foreach(EveOptionWindow window in __instance.windows)
|
||||||
|
{
|
||||||
|
EveOptionWindow_Patch.TranslateEveOptionWindow(window);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
50
MelonLoader/Patches/GameObjects/EveOptionWindow_Patch.cs
Normal file
50
MelonLoader/Patches/GameObjects/EveOptionWindow_Patch.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
using HarmonyLib;
|
||||||
|
using Il2Cpp;
|
||||||
|
using Il2CppTMPro;
|
||||||
|
using PvZ_Fusion_Translator.AssetStore;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(EveOptionWindow))]
|
||||||
|
public static class EveOptionWindow_Patch
|
||||||
|
{
|
||||||
|
[HarmonyPatch(nameof(EveOptionWindow.SetType))]
|
||||||
|
[HarmonyPostfix]
|
||||||
|
private static void SetType(EveOptionWindow __instance)
|
||||||
|
{
|
||||||
|
TranslateEveOptionWindow(__instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(nameof(EveOptionWindow.OnAnimOver))]
|
||||||
|
[HarmonyPostfix]
|
||||||
|
private static void OnAnimOver(EveOptionWindow __instance)
|
||||||
|
{
|
||||||
|
TranslateEveOptionWindow(__instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(nameof(EveOptionWindow.SelectedByRow))]
|
||||||
|
[HarmonyPostfix]
|
||||||
|
private static void SelectedByRow(EveOptionWindow __instance)
|
||||||
|
{
|
||||||
|
TranslateEveOptionWindow(__instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void TranslateEveOptionWindow(EveOptionWindow __instance)
|
||||||
|
{
|
||||||
|
Transform introduceTransform = __instance.transform.FindChild("Images").FindChild("Introduce");
|
||||||
|
TextMeshProUGUI introduceText = introduceTransform.GetComponent<TextMeshProUGUI>();
|
||||||
|
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||||
|
|
||||||
|
introduceText.text = StringStore.TranslateText(introduceText.text);
|
||||||
|
introduceText.font = fontAsset;
|
||||||
|
|
||||||
|
foreach (TextMeshProUGUI text in __instance.buttonText)
|
||||||
|
{
|
||||||
|
text.text = StringStore.TranslateText(text.text);
|
||||||
|
text.font = fontAsset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
57
MelonLoader/Patches/GameObjects/MinorObjects/Brain_Patch.cs
Normal file
57
MelonLoader/Patches/GameObjects/MinorObjects/Brain_Patch.cs
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
using HarmonyLib;
|
||||||
|
using Il2Cpp;
|
||||||
|
using Il2CppTMPro;
|
||||||
|
using PvZ_Fusion_Translator.AssetStore;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace PvZ_Fusion_Translator.Patches.GameObjects.MinorObjects
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(Brain))]
|
||||||
|
public static class Brain_Patch
|
||||||
|
{
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(nameof(Brain.Awake))]
|
||||||
|
private static void Awake(Brain __instance)
|
||||||
|
{
|
||||||
|
// reposition original points
|
||||||
|
Transform pointsTransform = __instance.points.transform;
|
||||||
|
GameObject pointsObject = __instance.points.gameObject;
|
||||||
|
pointsTransform.position = new Vector3(-6.5f, pointsTransform.position.y, pointsTransform.position.z);
|
||||||
|
|
||||||
|
// instantiate and move new shadow
|
||||||
|
GameObject pointsShadowObject = UnityEngine.Object.Instantiate(pointsObject, parent: pointsTransform);
|
||||||
|
pointsShadowObject.SetActive(true);
|
||||||
|
Transform pointsShadowTransform = pointsShadowObject.transform;
|
||||||
|
pointsShadowTransform.position = new Vector3(-6.485f, pointsTransform.position.y - 0.015f, pointsTransform.position.z);
|
||||||
|
|
||||||
|
// set points text
|
||||||
|
TextMeshPro pointsShadowText = pointsShadowObject.GetComponent<TextMeshPro>();
|
||||||
|
pointsShadowText.text = __instance.points.text;
|
||||||
|
pointsShadowText.sortingOrder -= 2;
|
||||||
|
pointsShadowText.color = Color.black;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(nameof(Brain.Update))]
|
||||||
|
private static void Update(Brain __instance)
|
||||||
|
{
|
||||||
|
if(__instance.transform.Find("Points").GetChild(0) != null)
|
||||||
|
{
|
||||||
|
TextMeshPro shadowText = __instance.transform.Find("Points").GetChild(0).GetComponent<TextMeshPro>();
|
||||||
|
shadowText.text = __instance.points.text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(nameof(Brain.WinAction))]
|
||||||
|
private static void WinAction(Brain __instance)
|
||||||
|
{
|
||||||
|
if (__instance.transform.Find("Points").GetChild(0) != null)
|
||||||
|
{
|
||||||
|
TextMeshPro shadowText = __instance.transform.Find("Points").GetChild(0).GetComponent<TextMeshPro>();
|
||||||
|
shadowText.text = __instance.points.text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -38,7 +38,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||||
|
|
||||||
string changelogText = File.ReadAllText(changelogDir);
|
string changelogText = File.ReadAllText(changelogDir);
|
||||||
|
|
||||||
GameObject contentObject = __instance.transform.FindChild("Scroll View").GetChild(0).GetChild(0).gameObject; //bc normal Find or FindChild didn't work
|
GameObject contentObject = __instance.transform.FindChild("Scroll View/Viewport/Content").gameObject;
|
||||||
|
|
||||||
TextMeshProUGUI contentText = contentObject.GetComponent<TextMeshProUGUI>();
|
TextMeshProUGUI contentText = contentObject.GetComponent<TextMeshProUGUI>();
|
||||||
contentText.text = changelogText;
|
contentText.text = changelogText;
|
||||||
|
|
|
||||||
37
MelonLoader/Patches/GameObjects/PlantDamageMenu_Patch.cs
Normal file
37
MelonLoader/Patches/GameObjects/PlantDamageMenu_Patch.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
using HarmonyLib;
|
||||||
|
using Il2Cpp;
|
||||||
|
using Il2CppTMPro;
|
||||||
|
using PvZ_Fusion_Translator.AssetStore;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(PlantDamageMenu))]
|
||||||
|
public static class PlantDamageMenu_Patch
|
||||||
|
{
|
||||||
|
[HarmonyPatch(nameof(PlantDamageMenu.Awake))]
|
||||||
|
[HarmonyPostfix]
|
||||||
|
private static void Awake(PlantDamageMenu __instance)
|
||||||
|
{
|
||||||
|
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||||
|
foreach(TextMeshProUGUI text in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||||
|
{
|
||||||
|
text.text = StringStore.TranslateText(text.text);
|
||||||
|
text.font = fontAsset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(nameof(PlantDamageMenu.InitCards))]
|
||||||
|
[HarmonyPostfix]
|
||||||
|
private static void InitCards(PlantDamageMenu __instance)
|
||||||
|
{
|
||||||
|
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||||
|
foreach (TextMeshProUGUI text in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||||
|
{
|
||||||
|
text.text = StringStore.TranslateText(text.text);
|
||||||
|
text.font = fontAsset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -14,24 +14,19 @@ namespace PvZ_Fusion_Translator.Patches.Managers
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
public static void ChangeStringz(IZBottomMenu __instance)
|
public static void ChangeStringz(IZBottomMenu __instance)
|
||||||
{
|
{
|
||||||
TextMeshProUGUI[] array =
|
foreach(TextMeshProUGUI text in __instance.levelName)
|
||||||
[
|
|
||||||
__instance.transform.GetChild(0).GetComponent<TextMeshProUGUI>(),
|
|
||||||
__instance.transform.GetChild(0).GetChild(0).GetComponent<TextMeshProUGUI>(),
|
|
||||||
];
|
|
||||||
for (int i = 0; i < array.Length; i++)
|
|
||||||
{
|
{
|
||||||
string fStr = StringStore.translationStringRegex["([^\\s]+),推荐难度:(\\d+)"];
|
string fStr = StringStore.translationStringRegex["([^\\s]+),推荐难度:(\\d+)"];
|
||||||
string[] parts = array[i].text.Split(",推荐难度:");
|
string[] parts = text.text.Split(",推荐难度:");
|
||||||
|
|
||||||
if(new Regex("([^\\s]+),推荐难度:(\\d+)").IsMatch(array[i].text))
|
if(new Regex("([^\\s]+),推荐难度:(\\d+)").IsMatch(text.text))
|
||||||
{
|
{
|
||||||
string customName = (StringStore.translationString.ContainsKey(parts[0] + "_IZ")) ? parts[0] + "_IZ" : parts[0];
|
string customName = (StringStore.translationString.ContainsKey(parts[0] + "_IZ")) ? parts[0] + "_IZ" : parts[0];
|
||||||
array[i].text = string.Format(fStr, StringStore.TranslateText(customName), parts[1]);
|
text.text = string.Format(fStr, StringStore.TranslateText(customName), parts[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
array[i] = StringStore.TranslateText(array[i]);
|
text.text = StringStore.TranslateText(text.text);
|
||||||
array[i].text = array[i].text.Replace("\n", " ");
|
text.text = text.text.Replace("\n", " ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,23 +34,18 @@ namespace PvZ_Fusion_Translator.Patches.Managers
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
public static void SetLevelName(IZBottomMenu __instance)
|
public static void SetLevelName(IZBottomMenu __instance)
|
||||||
{
|
{
|
||||||
TextMeshProUGUI[] array =
|
foreach(TextMeshProUGUI text in __instance.levelName)
|
||||||
[
|
|
||||||
__instance.transform.GetChild(0).GetComponent<TextMeshProUGUI>(),
|
|
||||||
__instance.transform.GetChild(0).GetChild(0).GetComponent<TextMeshProUGUI>(),
|
|
||||||
];
|
|
||||||
for (int i = 0; i < array.Length; i++)
|
|
||||||
{
|
{
|
||||||
string fStr = StringStore.translationStringRegex["([^\\s]+),推荐难度:(\\d+)"];
|
string fStr = StringStore.translationStringRegex["([^\\s]+),推荐难度:(\\d+)"];
|
||||||
string[] parts = array[i].text.Split(",推荐难度:");
|
string[] parts = text.text.Split(",推荐难度:");
|
||||||
|
|
||||||
if (new Regex("([^\\s]+),推荐难度:(\\d+)").IsMatch(array[i].text))
|
if (new Regex("([^\\s]+),推荐难度:(\\d+)").IsMatch(text.text))
|
||||||
{
|
{
|
||||||
array[i].text = string.Format(fStr, StringStore.TranslateText(parts[0]), parts[1]);
|
text.text = string.Format(fStr, StringStore.TranslateText(parts[0]), parts[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
array[i] = StringStore.TranslateText(array[i]);
|
text.text = StringStore.TranslateText(text.text);
|
||||||
array[i].text = array[i].text.Replace("\n", " ");
|
text.text = text.text.Replace("\n", " ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -406,6 +406,10 @@
|
||||||
<Compile Include="Patches\GameObjects\AlmanacPlantMenu_Patch.cs" />
|
<Compile Include="Patches\GameObjects\AlmanacPlantMenu_Patch.cs" />
|
||||||
<Compile Include="Patches\GameObjects\AlmanacPlantWindow_Patch.cs" />
|
<Compile Include="Patches\GameObjects\AlmanacPlantWindow_Patch.cs" />
|
||||||
<Compile Include="Patches\GameObjects\Almanac_Patch.cs" />
|
<Compile Include="Patches\GameObjects\Almanac_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\MinorObjects\Brain_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\PlantDamageMenu_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\EveBuffMenu_Patch.cs" />
|
||||||
|
<Compile Include="Patches\GameObjects\EveOptionWindow_Patch.cs" />
|
||||||
<Compile Include="Patches\Managers\GameAPP_Patch.cs" />
|
<Compile Include="Patches\Managers\GameAPP_Patch.cs" />
|
||||||
<Compile Include="Patches\Managers\OppositeBuffManager_Patch.cs" />
|
<Compile Include="Patches\Managers\OppositeBuffManager_Patch.cs" />
|
||||||
<Compile Include="Patches\GameObjects\ButtonObjects\ExploreMakeSceneButton_Patch.cs" />
|
<Compile Include="Patches\GameObjects\ButtonObjects\ExploreMakeSceneButton_Patch.cs" />
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ using PvZ_Fusion_Translator.AssetStore;
|
||||||
using PvZ_Fusion_Translator.Patches.GameObjects.MinorObjects;
|
using PvZ_Fusion_Translator.Patches.GameObjects.MinorObjects;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using Unity.Burst.Intrinsics;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Experimental.Rendering;
|
using UnityEngine.Experimental.Rendering;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
@ -299,6 +300,49 @@ namespace PvZ_Fusion_Translator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Dictionary<int, List<int>> recipeLinks = new Dictionary<int, List<int>>();
|
||||||
|
|
||||||
|
public static void RegisterRecipeLinks()
|
||||||
|
{
|
||||||
|
recipeLinks.Clear();
|
||||||
|
|
||||||
|
Il2CppSystem.Array mixData = MixData.data.Cast<Il2CppSystem.Array>();
|
||||||
|
int rows = mixData.GetLength(0);
|
||||||
|
int columns = mixData.GetLength(1);
|
||||||
|
|
||||||
|
foreach (PlantType plantType in Enum.GetValues(typeof(PlantType)))
|
||||||
|
{
|
||||||
|
int seedType = (int)plantType;
|
||||||
|
|
||||||
|
recipeLinks.Add(seedType, new());
|
||||||
|
|
||||||
|
if(seedType > 0)
|
||||||
|
{
|
||||||
|
foreach (PlantType checkType in Enum.GetValues(typeof(PlantType)))
|
||||||
|
{
|
||||||
|
if(checkType > 0)
|
||||||
|
{
|
||||||
|
int[] checks = [mixData.GetValue(seedType, (int)checkType).Unbox<int>(), mixData.GetValue((int)checkType, seedType).Unbox<int>()];
|
||||||
|
|
||||||
|
if (checks[0] != 0)
|
||||||
|
{
|
||||||
|
recipeLinks[seedType].Add(checks[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checks[1] != 0)
|
||||||
|
{
|
||||||
|
recipeLinks[seedType].Add(checks[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (recipeLinks[seedType].Count > 0)
|
||||||
|
{
|
||||||
|
Log.LogDebug($"Found {recipeLinks[seedType].Count} fusions for {seedType}!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static bool CheckForUntranslatedText(string text)
|
public static bool CheckForUntranslatedText(string text)
|
||||||
{
|
{
|
||||||
Regex regex = new("\\p{IsCJKUnifiedIdeographs}+");
|
Regex regex = new("\\p{IsCJKUnifiedIdeographs}+");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue