button fixes (back to index, almanac skin button logging an error)
This commit is contained in:
parent
f02f75591d
commit
ce822a5d06
4 changed files with 53 additions and 4 deletions
|
|
@ -0,0 +1,19 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects.ButtonObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(BackToIndex))]
|
||||
public class BackToIndex_Patch
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(nameof(BackToIndex.Awake))]
|
||||
public static void Awake(BackToIndex __instance)
|
||||
{
|
||||
StringStore.TranslateTextTransform(__instance.transform.GetChild(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12,6 +12,8 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects.ButtonObjects
|
|||
[HarmonyPostfix]
|
||||
[HarmonyPatch(nameof(NormalBtn.OnMouseUpAsButton))]
|
||||
public static void OnMouseUpAsButton(NormalBtn __instance)
|
||||
{
|
||||
if(__instance.transform.childCount > 0)
|
||||
{
|
||||
Transform banTransform = __instance.transform.GetChild(0);
|
||||
if (banTransform != null)
|
||||
|
|
@ -20,4 +22,5 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects.ButtonObjects
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
24
MelonLoader/Patches/GameObjects/ButtonObjects/UIBtn_Patch.cs
Normal file
24
MelonLoader/Patches/GameObjects/ButtonObjects/UIBtn_Patch.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(UIBtn))]
|
||||
public static class UIBtn_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(UIBtn.Awake))]
|
||||
[HarmonyPostfix]
|
||||
private static void Postfix_Awake(UIBtn __instance)
|
||||
{
|
||||
if(__instance.TryGetComponent<BackToIndex>(out BackToIndex component))
|
||||
{
|
||||
Log.LogDebug("found BackToIndex class");
|
||||
Utils.ConvertButtonText(__instance.transform.parent, "BackToIndex");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -403,6 +403,8 @@
|
|||
<Compile Include="Patches\GameObjects\AbyssBuffMenu_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" />
|
||||
<Compile Include="Patches\GameObjects\ButtonObjects\UIBtn_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\ExploreMakeMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\AbyssSelectBuffWindow_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\SpriteRenderer_Patch.cs" />
|
||||
|
|
@ -521,5 +523,6 @@
|
|||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="COPY "$(TargetPath)" "$(GamePath)\Mods\"" />
|
||||
<Exec Command="COPY "$(TargetPath)" "$(GamePath)\Translation Builds\"" />
|
||||
<Exec Command="COPY "$(TargetPath)" "C:\Users\rainb\Documents\GitHub\PVZF-Translation\"" />
|
||||
</Target>
|
||||
</Project>
|
||||
Loading…
Add table
Reference in a new issue