proper backtoindex fix i promise

This commit is contained in:
SillyStar-Github 2025-11-21 21:32:15 -05:00
parent 3c6fef1ce5
commit 40215c68df
2 changed files with 30 additions and 22 deletions

View file

@ -114,6 +114,14 @@ namespace PvZ_Fusion_Translator.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>())
{ {
txt.text = StringStore.TranslateText(txt.text); txt.text = StringStore.TranslateText(txt.text);

View file

@ -1,23 +1,23 @@
using HarmonyLib; //using HarmonyLib;
using Il2Cpp; //using Il2Cpp;
using Il2CppTMPro; //using Il2CppTMPro;
using PvZ_Fusion_Translator.AssetStore; //using PvZ_Fusion_Translator.AssetStore;
using UnityEngine; //using UnityEngine;
using UnityEngine.UI; //using UnityEngine.UI;
namespace PvZ_Fusion_Translator.Patches.GameObjects //namespace PvZ_Fusion_Translator.Patches.GameObjects
{ //{
[HarmonyPatch(typeof(UIBtn))] // [HarmonyPatch(typeof(UIBtn))]
public static class UIBtn_Patch // public static class UIBtn_Patch
{ // {
[HarmonyPatch(nameof(UIBtn.Awake))] // [HarmonyPatch(nameof(UIBtn.Awake))]
[HarmonyPostfix] // [HarmonyPostfix]
private static void Postfix_Awake(UIBtn __instance) // private static void Postfix_Awake(UIBtn __instance)
{ // {
if(__instance.TryGetComponent<BackToIndex>(out BackToIndex component)) // if(__instance.TryGetComponent<BackToIndex>(out BackToIndex component))
{ // {
Utils.ConvertButtonText(__instance.transform.parent, "BackToIndex"); // Utils.ConvertButtonText(__instance.transform.parent, component.name);
} // }
} // }
} // }
} //}