Add some bugs
This commit is contained in:
parent
030e849a6b
commit
89ad093762
4 changed files with 74 additions and 4 deletions
|
|
@ -6,12 +6,12 @@ using UnityEngine;
|
|||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects.ButtonObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(UIButton))]
|
||||
[HarmonyPatch(typeof(EveManager))]
|
||||
public static class EveManager_UIButton_Patch
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(nameof(UIButton.Start))]
|
||||
private static void Start(UIButton __instance)
|
||||
[HarmonyPatch(nameof(EveManager.Balanced))]
|
||||
private static void Start(EveManager __instance)
|
||||
{
|
||||
Transform sceneText = __instance.transform.FindChild("text");
|
||||
if(sceneText != null)
|
||||
|
|
|
|||
34
MelonLoader/Patches/GameObjects/ButtonObjects/UIButton.cs
Normal file
34
MelonLoader/Patches/GameObjects/ButtonObjects/UIButton.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(UIButton))]
|
||||
public static class UIButton_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(UIButton.Start))]
|
||||
[HarmonyPostfix]
|
||||
private static void Postfix_Start(UIButton __instance)
|
||||
{
|
||||
Text[] textComponents = __instance.GetComponentsInChildren<Text>(true);
|
||||
|
||||
foreach (Text textComponent in textComponents)
|
||||
{
|
||||
if (textComponent != null && !string.IsNullOrEmpty(textComponent.text))
|
||||
{
|
||||
string translatedText = StringStore.TranslateText(textComponent.text);
|
||||
|
||||
if (!string.IsNullOrEmpty(translatedText) && translatedText != textComponent.text)
|
||||
{
|
||||
textComponent.text = translatedText;
|
||||
// TODO: Add a new font handler for UnityEngine.Font
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
34
MelonLoader/Patches/GameObjects/TravelLookMenu_Patch.cs
Normal file
34
MelonLoader/Patches/GameObjects/TravelLookMenu_Patch.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using HarmonyLib;
|
||||
using Il2Cpp;
|
||||
using Il2CppTMPro;
|
||||
using PvZ_Fusion_Translator.AssetStore;
|
||||
using UnityEngine;
|
||||
|
||||
namespace PvZ_Fusion_Translator.Patches.GameObjects
|
||||
{
|
||||
[HarmonyPatch(typeof(TravelLookMenu))]
|
||||
public static class TravelLookMenu_Patch
|
||||
{
|
||||
[HarmonyPatch(nameof(TravelLookMenu.Start))]
|
||||
[HarmonyPostfix]
|
||||
private static void Postfix_Start(TravelLookMenu __instance)
|
||||
{
|
||||
Transform quitButtonTransform = __instance.transform.Find("Quit");
|
||||
if (quitButtonTransform != null)
|
||||
{
|
||||
TextMeshProUGUI[] allTexts = quitButtonTransform.GetComponentsInChildren<TextMeshProUGUI>(true);
|
||||
|
||||
foreach (var textComp in allTexts)
|
||||
{
|
||||
if (textComp != null && textComp.text == StringStore.TranslateText("关闭"))
|
||||
{
|
||||
textComp.text = StringStore.TranslateText("关闭_close");
|
||||
|
||||
TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString());
|
||||
textComp.font = fontAsset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -405,6 +405,7 @@
|
|||
<Compile Include="Patches\GameObjects\AbyssStoreMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\AbyssSettlementMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\ButtonObjects\NormalBtn_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\ButtonObjects\UIButton.cs" />
|
||||
<Compile Include="Patches\GameObjects\OtherMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\ButtonObjects\AbyssCheckSellMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\ButtonObjects\AbyssBuffButton_Patch.cs" />
|
||||
|
|
@ -423,6 +424,7 @@
|
|||
<Compile Include="Patches\GameObjects\AbyssMenu2_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\AbyssMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TravelLookBuff_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TravelLookMenu_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\CustomLevelShower_Patch.cs" />
|
||||
<Compile Include="Patches\Managers\SaveMenu_Patch.cs" />
|
||||
<Compile Include="Patches\GameObjects\TravelBuffOptionButton_Patch.cs" />
|
||||
|
|
@ -468,7 +470,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue