Merge branch 'cassidy'
This commit is contained in:
commit
4fac789a6e
3 changed files with 91 additions and 3 deletions
88
MelonLoader/Patches/GameObjects/WarningMenu_Patch.cs
Normal file
88
MelonLoader/Patches/GameObjects/WarningMenu_Patch.cs
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(WarningMenu))]
|
||||
public static class WarningMenu_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(WarningMenu.Start))]
|
||||
[HarmonyPostfix]
|
||||
private static void Start(WarningMenu __instance)
|
||||
{
|
||||
TranslateInvestmentWarning(__instance);
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(WarningMenu.EnableChallengeMode))]
|
||||
[HarmonyPostfix]
|
||||
private static void EnableChallengeMode(WarningMenu __instance)
|
||||
{
|
||||
TranslateInvestmentWarning(__instance);
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(WarningMenu.Cancel))]
|
||||
[HarmonyPostfix]
|
||||
private static void Cancel(WarningMenu __instance)
|
||||
{
|
||||
TranslateInvestmentWarning(__instance);
|
||||
}
|
||||
|
||||
public static void TranslateInvestmentWarning(WarningMenu __instance)
|
||||
{
|
||||
Transform normalModeTransform = __instance.transform.Find("Normal");
|
||||
Transform challengeModeTransform = __instance.transform.Find("Challenge");
|
||||
|
||||
if (normalModeTransform != null)
|
||||
{
|
||||
TextMeshProUGUI text = normalModeTransform.Find("text").GetComponent<TextMeshProUGUI>();
|
||||
TextMeshProUGUI textShadow = normalModeTransform.Find("text (1)").GetComponent<TextMeshProUGUI>();
|
||||
|
||||
text.text = Utils.RemoveColorTags(StringStore.TranslateText(text.text));
|
||||
textShadow.text = Utils.RemoveColorTags(textShadow.text);
|
||||
}
|
||||
|
||||
if (challengeModeTransform != null)
|
||||
{
|
||||
TextMeshProUGUI text = challengeModeTransform.Find("text").GetComponent<TextMeshProUGUI>();
|
||||
TextMeshProUGUI textShadow = challengeModeTransform.Find("text (1)").GetComponent<TextMeshProUGUI>();
|
||||
|
||||
text.text = Utils.RemoveColorTags(StringStore.TranslateText(text.text));
|
||||
textShadow.text = Utils.RemoveColorTags(textShadow.text);
|
||||
}
|
||||
|
||||
if (__instance.tutor != null)
|
||||
{
|
||||
foreach (TextMeshProUGUI text in __instance.tutor.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
if (text.gameObject.name == "text1")
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
if (text.transform.parent.Find("text").TryGetComponent<TextMeshProUGUI>(out TextMeshProUGUI textShadow))
|
||||
{
|
||||
textShadow.text = Utils.RemoveColorTags(text.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (__instance.challenge != null)
|
||||
{
|
||||
foreach (TextMeshProUGUI text in __instance.challenge.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
if (text.gameObject.name == "text1")
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
if (text.transform.parent.Find("text").TryGetComponent<TextMeshProUGUI>(out TextMeshProUGUI textShadow))
|
||||
{
|
||||
textShadow.text = Utils.RemoveColorTags(text.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,11 +2,10 @@
|
|||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using PvZ_Fusion_Translator.Patches.Modes.Odyssey;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.Managers
|
||||
namespace PvZ_Fusion_Translator.Patches.Modes.Odyssey
|
||||
{
|
||||
[HarmonyPatch(typeof(OppositeBuffManager))]
|
||||
public static class OppositeBuffManager_Patch
|
||||
|
|
@ -402,6 +402,7 @@
|
|||
<Compile Include="Log.cs" />
|
||||
<Compile Include="ModFeatures.cs" />
|
||||
<Compile Include="AssetStore\AudioStore.cs" />
|
||||
<Compile Include="Patches\GameObjects\WarningMenu_Patch.cs" />
|
||||
<Compile Include="Patches\Modes\Abyss\AbyssBuffMenu_Patch.cs" />
|
||||
<Compile Include="Patches\Modes\Odyssey\TravelInvestMenu_Patch.cs" />
|
||||
<Compile Include="Patches\Modes\Odyssey\SynergyDisplay_Patch.cs" />
|
||||
|
|
@ -423,7 +424,7 @@
|
|||
<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\OppositeBuffManager_Patch.cs" />
|
||||
<Compile Include="Patches\Modes\Odyssey\OppositeBuffManager_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\ButtonObjects\ExploreMakeSceneButton_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\ButtonObjects\ExploreMakeZombieButton_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\ButtonObjects\BackToIndex_Patch.cs" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue