From 0b6c8327736dd5a8da863794427a50b8a40970ad Mon Sep 17 00:00:00 2001 From: SillyStar-Github <90102598+SillyStar-Github@users.noreply.github.com> Date: Wed, 14 May 2025 17:08:59 -0400 Subject: [PATCH] adsjkhf stuff --- BepInEx/AssetStore/TextureStore.cs | 10 ++++- BepInEx/FileLoader.cs | 7 ++-- .../Patches/GameObjects/AbyssBagMenu_Patch.cs | 32 +--------------- .../Patches/GameObjects/AbyssMenu2_Patch.cs | 36 ++---------------- .../Patches/GameObjects/AbyssMenu_Patch.cs | 32 +--------------- .../ButtonObjects/NormalBtn_Patch.cs | 25 ++++++++++++ .../ButtonObjects/OptLanguageBtn_Patch.cs | 2 +- .../Managers/AlmanacPlantBank_Patch.cs | 7 +++- .../PvZ Fusion Translator [BepInEx].csproj | 1 + BepInEx/Utils.cs | 34 ++++++++++++++++- .../Patches/GameObjects/AbyssBagMenu_Patch.cs | 32 +--------------- .../Patches/GameObjects/AbyssMenu2_Patch.cs | 36 ++---------------- .../Patches/GameObjects/AbyssMenu_Patch.cs | 32 +--------------- .../ButtonObjects/NormalBtn_Patch.cs | 22 +++++++++++ .../Managers/AlmanacPlantBank_Patch.cs | 5 +++ ...PvZ Fusion Translator [MelonLoader].csproj | 1 + MelonLoader/Utils.cs | 38 +++++++++++++++++-- 17 files changed, 152 insertions(+), 200 deletions(-) create mode 100644 BepInEx/Patches/GameObjects/ButtonObjects/NormalBtn_Patch.cs create mode 100644 MelonLoader/Patches/GameObjects/ButtonObjects/NormalBtn_Patch.cs diff --git a/BepInEx/AssetStore/TextureStore.cs b/BepInEx/AssetStore/TextureStore.cs index 8a222c0..de42ff0 100644 --- a/BepInEx/AssetStore/TextureStore.cs +++ b/BepInEx/AssetStore/TextureStore.cs @@ -17,12 +17,20 @@ namespace PvZ_Fusion_Translator__BepInEx_.AssetStore #if MULTI_LANGUAGE RestoreTextures(); #endif + if(!Utils.customTextures) + { + FileLoader.LoadDefaultTextures(); + } FileLoader.LoadTextures(); } public static IEnumerator ReplaceTexturesCoroutine() { - while (true) + if (!Utils.customTextures) + { + FileLoader.LoadDefaultTextures(); + } + while (true) { ReplaceTextures(); yield return new WaitForSeconds(0.5f); // Adjust this interval as needed diff --git a/BepInEx/FileLoader.cs b/BepInEx/FileLoader.cs index a2058a0..3effd03 100644 --- a/BepInEx/FileLoader.cs +++ b/BepInEx/FileLoader.cs @@ -94,15 +94,16 @@ namespace PvZ_Fusion_Translator__BepInEx_ internal static void LoadTextures() { - ConfigEntry defaultTextureEntry; - Core.Instance.Config.TryGetEntry(new ConfigDefinition("PvZ_Fusion_Translator", "DefaultTextures"), out defaultTextureEntry); // Default or Custom Texturse -> English Textures -> Localized Textures try { - if (!defaultTextureEntry.Value) + if (Utils.customTextures) { LoadCustomTextures(); + } else + { + LoadDefaultTextures(); } } catch (Exception e) diff --git a/BepInEx/Patches/GameObjects/AbyssBagMenu_Patch.cs b/BepInEx/Patches/GameObjects/AbyssBagMenu_Patch.cs index 22a8ee2..59a5db2 100644 --- a/BepInEx/Patches/GameObjects/AbyssBagMenu_Patch.cs +++ b/BepInEx/Patches/GameObjects/AbyssBagMenu_Patch.cs @@ -13,42 +13,12 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects [HarmonyPatch(typeof(AbyssBagMenu))] public static class AbyssBagMenu_Patch { - public static GameObject ConvertToTextMeshProUGUI(GameObject originalText, Transform parent, string name) - { - GameObject newObj = new GameObject(name); - newObj.transform.position = originalText.transform.position; - newObj.AddComponent(); - newObj.AddComponent(); - newObj.AddComponent(); - newObj.transform.SetParent(parent); - newObj.transform.localScale = Vector3.one; - - UnityEngine.Object.Destroy(originalText); - return newObj; - } - - private static void ConvertButtonText(Transform original, string name) - { - TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); - - Transform transform = original.FindChild(name); - Transform textTransform = transform.FindChild("text"); - string text = textTransform.GetComponent().text; - Color color = textTransform.GetComponent().color; - - TextMeshProUGUI newGoBackText = ConvertToTextMeshProUGUI(textTransform.gameObject, transform, "text2").GetComponent(); - newGoBackText.autoSizeTextContainer = true; - newGoBackText.text = StringStore.TranslateText(text, false); - newGoBackText.font = fontAsset; - newGoBackText.color = color; - } - [HarmonyPatch(nameof(AbyssBagMenu.Awake))] [HarmonyPostfix] private static void MoveFromBag(AbyssCheckInBag __instance) { AbyssMenu2.Instance.UpdateIcons(); - ConvertButtonText(__instance.transform, "Goback"); + Utils.ConvertButtonText(__instance.transform, "Goback"); } } } diff --git a/BepInEx/Patches/GameObjects/AbyssMenu2_Patch.cs b/BepInEx/Patches/GameObjects/AbyssMenu2_Patch.cs index 8dbc04e..ac9fdad 100644 --- a/BepInEx/Patches/GameObjects/AbyssMenu2_Patch.cs +++ b/BepInEx/Patches/GameObjects/AbyssMenu2_Patch.cs @@ -51,45 +51,15 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects } } - public static GameObject ConvertToTextMeshProUGUI(GameObject originalText, Transform parent, string name) - { - GameObject newObj = new GameObject(name); - newObj.transform.position = originalText.transform.position; - newObj.AddComponent(); - newObj.AddComponent(); - newObj.AddComponent(); - newObj.transform.SetParent(parent); - newObj.transform.localScale = Vector3.one; - - UnityEngine.Object.Destroy(originalText); - return newObj; - } - - private static void ConvertButtonText(Transform original, string name) - { - TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); - - Transform transform = original.FindChild(name); - Transform textTransform = transform.FindChild("text"); - string text = textTransform.GetComponent().text; - Color color = textTransform.GetComponent().color; - - TextMeshProUGUI newGoBackText = ConvertToTextMeshProUGUI(textTransform.gameObject, transform, "text2").GetComponent(); - newGoBackText.autoSizeTextContainer = true; - newGoBackText.text = StringStore.TranslateText(text, false); - newGoBackText.font = fontAsset; - newGoBackText.color = color; - } - [HarmonyPatch(nameof(AbyssMenu2.Start))] [HarmonyPostfix] private static void Start(AbyssMenu2 __instance) { UpdateAbyss2Text(__instance); - ConvertButtonText(__instance.transform, "Goback"); - ConvertButtonText(__instance.transform, "Help"); - ConvertButtonText(__instance.transform, "Bag"); + Utils.ConvertButtonText(__instance.transform, "Goback"); + Utils.ConvertButtonText(__instance.transform, "Help"); + Utils.ConvertButtonText(__instance.transform, "Bag"); } [HarmonyPatch(nameof(AbyssMenu2.UpdateIcons))] diff --git a/BepInEx/Patches/GameObjects/AbyssMenu_Patch.cs b/BepInEx/Patches/GameObjects/AbyssMenu_Patch.cs index 3e98623..d6654a6 100644 --- a/BepInEx/Patches/GameObjects/AbyssMenu_Patch.cs +++ b/BepInEx/Patches/GameObjects/AbyssMenu_Patch.cs @@ -15,36 +15,6 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects [HarmonyPatch(typeof(AbyssMenu))] public static class AbyssMenu_Patch { - public static GameObject ConvertToTextMeshProUGUI(GameObject originalText, Transform parent, string name) - { - GameObject newObj = new GameObject(name); - newObj.transform.position = originalText.transform.position; - newObj.AddComponent(); - newObj.AddComponent(); - newObj.AddComponent(); - newObj.transform.SetParent(parent); - newObj.transform.localScale = Vector3.one; - - UnityEngine.Object.Destroy(originalText); - return newObj; - } - - private static void ConvertButtonText(Transform original, string name) - { - TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); - - Transform transform = original.FindChild(name); - Transform textTransform = transform.FindChild("text"); - string text = textTransform.GetComponent().text; - Color color = textTransform.GetComponent().color; - - TextMeshProUGUI newGoBackText = ConvertToTextMeshProUGUI(textTransform.gameObject, transform, "text2").GetComponent(); - newGoBackText.autoSizeTextContainer = true; - newGoBackText.text = StringStore.TranslateText(text, false); - newGoBackText.font = fontAsset; - newGoBackText.color = color; - } - [HarmonyPatch(nameof(AbyssMenu.Awake))] [HarmonyPostfix] private static void Awake(AbyssMenu __instance) @@ -57,7 +27,7 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects txt.font = fontAsset; } - ConvertButtonText(__instance.transform, "Goback"); + Utils.ConvertButtonText(__instance.transform, "Goback"); } [HarmonyPatch(nameof(AbyssMenu.UpdateLevelInfo))] diff --git a/BepInEx/Patches/GameObjects/ButtonObjects/NormalBtn_Patch.cs b/BepInEx/Patches/GameObjects/ButtonObjects/NormalBtn_Patch.cs new file mode 100644 index 0000000..2e10909 --- /dev/null +++ b/BepInEx/Patches/GameObjects/ButtonObjects/NormalBtn_Patch.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using HarmonyLib; +using PvZ_Fusion_Translator__BepInEx_.AssetStore; +using TMPro; + +namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects +{ + [HarmonyPatch(typeof(NormalBtn))] + public class NormalBtn_Patch + { + [HarmonyPostfix] + [HarmonyPatch(nameof(NormalBtn.OnMouseUpAsButton))] + public static void OnMouseUpAsButton(NormalBtn __instance) + { + foreach (TextMeshPro textMeshPro in __instance.GetComponentsInChildren()) + { + textMeshPro.text = StringStore.TranslateText(textMeshPro.text); + } + } + } +} diff --git a/BepInEx/Patches/GameObjects/ButtonObjects/OptLanguageBtn_Patch.cs b/BepInEx/Patches/GameObjects/ButtonObjects/OptLanguageBtn_Patch.cs index e732656..cd6f0cd 100644 --- a/BepInEx/Patches/GameObjects/ButtonObjects/OptLanguageBtn_Patch.cs +++ b/BepInEx/Patches/GameObjects/ButtonObjects/OptLanguageBtn_Patch.cs @@ -318,7 +318,7 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.GameObjects.ButtonObjects ToggleCustomAssets(toggleType); if (toggleType == "Textures") { - FlashMessage(toggleData.Button, "Toggled custom textures!", 0.1f); + FlashMessage(toggleData.Button, "Toggled custom textures!\nRestart your game for everything to apply.", 0.1f); } else if (toggleType == "Audio") { diff --git a/BepInEx/Patches/Managers/AlmanacPlantBank_Patch.cs b/BepInEx/Patches/Managers/AlmanacPlantBank_Patch.cs index dae4d68..c645bd9 100644 --- a/BepInEx/Patches/Managers/AlmanacPlantBank_Patch.cs +++ b/BepInEx/Patches/Managers/AlmanacPlantBank_Patch.cs @@ -146,7 +146,12 @@ namespace PvZ_Fusion_Translator__BepInEx_.Patches.Managers } } - return; + foreach (TextMeshPro textMeshPro in __instance.GetComponentsInChildren()) + { + textMeshPro.text = StringStore.TranslateText(textMeshPro.text); + } + + return; } [HarmonyPatch(nameof(AlmanacPlantBank.OnMouseDown))] diff --git a/BepInEx/PvZ Fusion Translator [BepInEx].csproj b/BepInEx/PvZ Fusion Translator [BepInEx].csproj index ac777dd..fb2d6cc 100644 --- a/BepInEx/PvZ Fusion Translator [BepInEx].csproj +++ b/BepInEx/PvZ Fusion Translator [BepInEx].csproj @@ -121,6 +121,7 @@ + diff --git a/BepInEx/Utils.cs b/BepInEx/Utils.cs index a27283e..a5eb015 100644 --- a/BepInEx/Utils.cs +++ b/BepInEx/Utils.cs @@ -5,9 +5,11 @@ using System; using System.Diagnostics; using System.IO; using System.Text.RegularExpressions; +using TMPro; using Unity.VisualScripting.FullSerializer; using UnityEngine; using UnityEngine.Experimental.Rendering; +using UnityEngine.UI; namespace PvZ_Fusion_Translator__BepInEx_ { @@ -80,7 +82,37 @@ namespace PvZ_Fusion_Translator__BepInEx_ return Regex.Replace(text, @"]+>", ""); } - #if MULTI_LANGUAGE + public static GameObject ConvertToTextMeshProUGUI(GameObject originalText, Transform parent, string name) + { + GameObject newObj = new GameObject(name); + newObj.transform.position = originalText.transform.position; + newObj.AddComponent(); + newObj.AddComponent(); + newObj.AddComponent(); + newObj.transform.SetParent(parent); + newObj.transform.localScale = Vector3.one; + + UnityEngine.Object.Destroy(originalText); + return newObj; + } + + public static void ConvertButtonText(Transform original, string name) + { + TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); + + Transform transform = original.FindChild(name); + Transform textTransform = transform.FindChild("text"); + string text = textTransform.GetComponent().text; + Color color = textTransform.GetComponent().color; + + TextMeshProUGUI newGoBackText = Utils.ConvertToTextMeshProUGUI(textTransform.gameObject, transform, "text2").GetComponent(); + newGoBackText.autoSizeTextContainer = true; + newGoBackText.text = StringStore.TranslateText(text, false); + newGoBackText.font = fontAsset; + newGoBackText.color = color; + } + +#if MULTI_LANGUAGE internal static void ChangeLanguage(string language) { OldLanguage = Language; diff --git a/MelonLoader/Patches/GameObjects/AbyssBagMenu_Patch.cs b/MelonLoader/Patches/GameObjects/AbyssBagMenu_Patch.cs index 2065fa9..75d8bab 100644 --- a/MelonLoader/Patches/GameObjects/AbyssBagMenu_Patch.cs +++ b/MelonLoader/Patches/GameObjects/AbyssBagMenu_Patch.cs @@ -14,42 +14,12 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects [HarmonyPatch(typeof(AbyssBagMenu))] public static class AbyssBagMenu_Patch { - public static GameObject ConvertToTextMeshProUGUI(GameObject originalText, Transform parent, string name) - { - GameObject newObj = new GameObject(name); - newObj.transform.position = originalText.transform.position; - newObj.AddComponent(); - newObj.AddComponent(); - newObj.AddComponent(); - newObj.transform.SetParent(parent); - newObj.transform.localScale = Vector3.one; - - UnityEngine.Object.Destroy(originalText); - return newObj; - } - - private static void ConvertButtonText(Transform original, string name) - { - TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); - - Transform transform = original.FindChild(name); - Transform textTransform = transform.FindChild("text"); - string text = textTransform.GetComponent().text; - Color color = textTransform.GetComponent().color; - - TextMeshProUGUI newGoBackText = ConvertToTextMeshProUGUI(textTransform.gameObject, transform, "text2").GetComponent(); - newGoBackText.autoSizeTextContainer = true; - newGoBackText.text = StringStore.TranslateText(text, false); - newGoBackText.font = fontAsset; - newGoBackText.color = color; - } - [HarmonyPatch(nameof(AbyssBagMenu.Awake))] [HarmonyPostfix] private static void MoveFromBag(AbyssCheckInBag __instance) { AbyssMenu2.Instance.UpdateIcons(); - ConvertButtonText(__instance.transform, "Goback"); + Utils.ConvertButtonText(__instance.transform, "Goback"); } } } diff --git a/MelonLoader/Patches/GameObjects/AbyssMenu2_Patch.cs b/MelonLoader/Patches/GameObjects/AbyssMenu2_Patch.cs index 05a0fb2..a410739 100644 --- a/MelonLoader/Patches/GameObjects/AbyssMenu2_Patch.cs +++ b/MelonLoader/Patches/GameObjects/AbyssMenu2_Patch.cs @@ -52,45 +52,15 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects } } - public static GameObject ConvertToTextMeshProUGUI(GameObject originalText, Transform parent, string name) - { - GameObject newObj = new GameObject(name); - newObj.transform.position = originalText.transform.position; - newObj.AddComponent(); - newObj.AddComponent(); - newObj.AddComponent(); - newObj.transform.SetParent(parent); - newObj.transform.localScale = Vector3.one; - - UnityEngine.Object.Destroy(originalText); - return newObj; - } - - private static void ConvertButtonText(Transform original, string name) - { - TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); - - Transform transform = original.FindChild(name); - Transform textTransform = transform.FindChild("text"); - string text = textTransform.GetComponent().text; - Color color = textTransform.GetComponent().color; - - TextMeshProUGUI newGoBackText = ConvertToTextMeshProUGUI(textTransform.gameObject, transform, "text2").GetComponent(); - newGoBackText.autoSizeTextContainer = true; - newGoBackText.text = StringStore.TranslateText(text, false); - newGoBackText.font = fontAsset; - newGoBackText.color = color; - } - [HarmonyPatch(nameof(AbyssMenu2.Start))] [HarmonyPostfix] private static void Start(AbyssMenu2 __instance) { UpdateAbyss2Text(__instance); - ConvertButtonText(__instance.transform, "Goback"); - ConvertButtonText(__instance.transform, "Help"); - ConvertButtonText(__instance.transform, "Bag"); + Utils.ConvertButtonText(__instance.transform, "Goback"); + Utils.ConvertButtonText(__instance.transform, "Help"); + Utils.ConvertButtonText(__instance.transform, "Bag"); } [HarmonyPatch(nameof(AbyssMenu2.UpdateIcons))] diff --git a/MelonLoader/Patches/GameObjects/AbyssMenu_Patch.cs b/MelonLoader/Patches/GameObjects/AbyssMenu_Patch.cs index 4c9473d..49ee31f 100644 --- a/MelonLoader/Patches/GameObjects/AbyssMenu_Patch.cs +++ b/MelonLoader/Patches/GameObjects/AbyssMenu_Patch.cs @@ -14,36 +14,6 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects [HarmonyPatch(typeof(AbyssMenu))] public static class AbyssMenu_Patch { - public static GameObject ConvertToTextMeshProUGUI(GameObject originalText, Transform parent, string name) - { - GameObject newObj = new GameObject(name); - newObj.transform.position = originalText.transform.position; - newObj.AddComponent(); - newObj.AddComponent(); - newObj.AddComponent(); - newObj.transform.SetParent(parent); - newObj.transform.localScale = Vector3.one; - - UnityEngine.Object.Destroy(originalText); - return newObj; - } - - private static void ConvertButtonText(Transform original, string name) - { - TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); - - Transform transform = original.FindChild(name); - Transform textTransform = transform.FindChild("text"); - string text = textTransform.GetComponent().text; - Color color = textTransform.GetComponent().color; - - TextMeshProUGUI newGoBackText = ConvertToTextMeshProUGUI(textTransform.gameObject, transform, "text2").GetComponent(); - newGoBackText.autoSizeTextContainer = true; - newGoBackText.text = StringStore.TranslateText(text, false); - newGoBackText.font = fontAsset; - newGoBackText.color = color; - } - [HarmonyPatch(nameof(AbyssMenu.Awake))] [HarmonyPostfix] private static void Awake(AbyssMenu __instance) @@ -56,7 +26,7 @@ namespace PvZ_Fusion_Translator.Patches.GameObjects txt.font = fontAsset; } - ConvertButtonText(__instance.transform, "Goback"); + Utils.ConvertButtonText(__instance.transform, "Goback"); } [HarmonyPatch(nameof(AbyssMenu.UpdateLevelInfo))] diff --git a/MelonLoader/Patches/GameObjects/ButtonObjects/NormalBtn_Patch.cs b/MelonLoader/Patches/GameObjects/ButtonObjects/NormalBtn_Patch.cs new file mode 100644 index 0000000..2bb0d03 --- /dev/null +++ b/MelonLoader/Patches/GameObjects/ButtonObjects/NormalBtn_Patch.cs @@ -0,0 +1,22 @@ +using HarmonyLib; +using Il2Cpp; +using Il2CppTMPro; +using PvZ_Fusion_Translator.AssetStore; +using UnityEngine; + +namespace PvZ_Fusion_Translator.Patches.GameObjects.ButtonObjects +{ + [HarmonyPatch(typeof(NormalBtn))] + public class NormalBtn_Patch + { + [HarmonyPostfix] + [HarmonyPatch(nameof(NormalBtn.OnMouseUpAsButton))] + public static void OnMouseUpAsButton(NormalBtn __instance) + { + foreach (TextMeshPro textMeshPro in __instance.GetComponentsInChildren()) + { + textMeshPro.text = StringStore.TranslateText(textMeshPro.text); + } + } + } +} diff --git a/MelonLoader/Patches/Managers/AlmanacPlantBank_Patch.cs b/MelonLoader/Patches/Managers/AlmanacPlantBank_Patch.cs index f09e3e8..b36c307 100644 --- a/MelonLoader/Patches/Managers/AlmanacPlantBank_Patch.cs +++ b/MelonLoader/Patches/Managers/AlmanacPlantBank_Patch.cs @@ -146,6 +146,11 @@ namespace PvZ_Fusion_Translator.Patches.Managers } } + foreach(TextMeshPro textMeshPro in __instance.GetComponentsInChildren()) + { + textMeshPro.text = StringStore.TranslateText(textMeshPro.text); + } + return; } diff --git a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj index ed6500a..dceb6a0 100644 --- a/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj +++ b/MelonLoader/PvZ Fusion Translator [MelonLoader].csproj @@ -404,6 +404,7 @@ + diff --git a/MelonLoader/Utils.cs b/MelonLoader/Utils.cs index de1ae12..01fe81a 100644 --- a/MelonLoader/Utils.cs +++ b/MelonLoader/Utils.cs @@ -1,9 +1,11 @@ -using MelonLoader; +using Il2CppTMPro; +using MelonLoader; using PvZ_Fusion_Translator.AssetStore; using System.Diagnostics; using System.Text.RegularExpressions; using UnityEngine; using UnityEngine.Experimental.Rendering; +using UnityEngine.UI; namespace PvZ_Fusion_Translator { @@ -76,8 +78,38 @@ namespace PvZ_Fusion_Translator return Regex.Replace(text, @"]+>", ""); } - #if MULTI_LANGUAGE - internal static void ChangeLanguage(string language) + public static GameObject ConvertToTextMeshProUGUI(GameObject originalText, Transform parent, string name) + { + GameObject newObj = new GameObject(name); + newObj.transform.position = originalText.transform.position; + newObj.AddComponent(); + newObj.AddComponent(); + newObj.AddComponent(); + newObj.transform.SetParent(parent); + newObj.transform.localScale = Vector3.one; + + UnityEngine.Object.Destroy(originalText); + return newObj; + } + + public static void ConvertButtonText(Transform original, string name) + { + TMP_FontAsset fontAsset = FontStore.LoadTMPFont(Utils.Language.ToString()); + + Transform transform = original.FindChild(name); + Transform textTransform = transform.FindChild("text"); + string text = textTransform.GetComponent().text; + Color color = textTransform.GetComponent().color; + + TextMeshProUGUI newGoBackText = Utils.ConvertToTextMeshProUGUI(textTransform.gameObject, transform, "text2").GetComponent(); + newGoBackText.autoSizeTextContainer = true; + newGoBackText.text = StringStore.TranslateText(text, false); + newGoBackText.font = fontAsset; + newGoBackText.color = color; + } + +#if MULTI_LANGUAGE + internal static void ChangeLanguage(string language) { OldLanguage = Language;