3.4.2 missing code
This commit is contained in:
parent
cf4c022522
commit
829f314392
4 changed files with 107 additions and 0 deletions
|
|
@ -0,0 +1,27 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using MelonLoader;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects.ButtonObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(GodShootingLevelButton))]
|
||||
public static class GodShootingLevelButton_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(GodShootingLevelButton.Awake))]
|
||||
[HarmonyPostfix]
|
||||
private static void Awake(GodShootingLevelButton __instance)
|
||||
{
|
||||
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
|
||||
foreach(TextMeshProUGUI txt in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
string originalKey = StringStore.translationString.FirstOrDefault(x => x.Value == txt.text).Key;
|
||||
txt.text = (StringStore.translationString.ContainsKey(originalKey + "_GS")) ? StringStore.TranslateText(originalKey + "_GS") : StringStore.TranslateText(txt.text);
|
||||
txt.font = fontAsset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
44
MelonLoader/Patches/GameObjects/GodShootingMenu_Patch.cs
Normal file
44
MelonLoader/Patches/GameObjects/GodShootingMenu_Patch.cs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
using static MelonLoader.MelonLogger;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(GodShootingMenu))]
|
||||
public static class GodShootingMenu_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(GodShootingMenu.Start))]
|
||||
[HarmonyPostfix]
|
||||
private static void Start(GodShootingMenu __instance)
|
||||
{
|
||||
foreach(TextMeshProUGUI text in __instance.transform.Find("Background").GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
text.autoSizeTextContainer = true;
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
}
|
||||
|
||||
foreach(TextMeshProUGUI text in __instance.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(GodShootingMenu.ShowRoutes))]
|
||||
[HarmonyPostfix]
|
||||
private static void ShowRoutes(GodShootingMenu __instance)
|
||||
{
|
||||
foreach(var route in __instance.routes)
|
||||
{
|
||||
if (route.Value == null) continue;
|
||||
|
||||
foreach(TextMeshProUGUI text in route.Value.GetComponentsInChildren<TextMeshProUGUI>())
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
33
MelonLoader/Patches/GameObjects/PVPRandomManager_Patch.cs
Normal file
33
MelonLoader/Patches/GameObjects/PVPRandomManager_Patch.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
using static MelonLoader.MelonLogger;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(PVPRandomManager))]
|
||||
public static class PVPRandomManager_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(PVPRandomManager.Start))]
|
||||
[HarmonyPostfix]
|
||||
private static void Start(PVPRandomManager __instance)
|
||||
{
|
||||
foreach(TextMeshPro text in __instance.texts)
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(PVPRandomManager.Update))]
|
||||
[HarmonyPostfix]
|
||||
private static void ZombieEnterHouse(PVPRandomManager __instance)
|
||||
{
|
||||
foreach(TextMeshPro text in __instance.texts)
|
||||
{
|
||||
text.text = StringStore.TranslateText(text.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -400,6 +400,9 @@
|
|||
<Compile Include="Log.cs" />
|
||||
<Compile Include="ModFeatures.cs" />
|
||||
<Compile Include="AssetStore\AudioStore.cs" />
|
||||
<Compile Include="Patches\GameObjects\PVPRandomManager_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\GodShootingMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\ButtonObjects\GodShootingLevelButton_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\PlantDataMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\WarningMenu_Patch.cs" />
|
||||
<Compile Include="Patches\Modes\Abyss\AbyssBuffMenu_Patch.cs" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue