From cf58771365b5953c6eac548b172aae880d1f0acd Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Sun, 19 May 2024 17:03:57 +0800 Subject: * rename --- .../Decompile/I2.Loc/LocalizeDropdown.cs | 100 --------------------- 1 file changed, 100 deletions(-) delete mode 100644 Thronefall_1_57/Decompile/I2.Loc/LocalizeDropdown.cs (limited to 'Thronefall_1_57/Decompile/I2.Loc/LocalizeDropdown.cs') diff --git a/Thronefall_1_57/Decompile/I2.Loc/LocalizeDropdown.cs b/Thronefall_1_57/Decompile/I2.Loc/LocalizeDropdown.cs deleted file mode 100644 index 57fd328..0000000 --- a/Thronefall_1_57/Decompile/I2.Loc/LocalizeDropdown.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System.Collections.Generic; -using TMPro; -using UnityEngine; -using UnityEngine.UI; - -namespace I2.Loc; - -[AddComponentMenu("I2/Localization/Localize Dropdown")] -public class LocalizeDropdown : MonoBehaviour -{ - public List _Terms = new List(); - - public void Start() - { - LocalizationManager.OnLocalizeEvent += OnLocalize; - OnLocalize(); - } - - public void OnDestroy() - { - LocalizationManager.OnLocalizeEvent -= OnLocalize; - } - - private void OnEnable() - { - if (_Terms.Count == 0) - { - FillValues(); - } - OnLocalize(); - } - - public void OnLocalize() - { - if (base.enabled && !(base.gameObject == null) && base.gameObject.activeInHierarchy && !string.IsNullOrEmpty(LocalizationManager.CurrentLanguage)) - { - UpdateLocalization(); - } - } - - private void FillValues() - { - Dropdown component = GetComponent(); - if (component == null && I2Utils.IsPlaying()) - { - FillValuesTMPro(); - return; - } - foreach (Dropdown.OptionData option in component.options) - { - _Terms.Add(option.text); - } - } - - public void UpdateLocalization() - { - Dropdown component = GetComponent(); - if (component == null) - { - UpdateLocalizationTMPro(); - return; - } - component.options.Clear(); - foreach (string term in _Terms) - { - string text = TextTranslator.Translate(term); - component.options.Add(new Dropdown.OptionData(text)); - } - component.RefreshShownValue(); - } - - public void UpdateLocalizationTMPro() - { - TMP_Dropdown component = GetComponent(); - if (component == null) - { - return; - } - component.options.Clear(); - foreach (string term in _Terms) - { - string text = TextTranslator.Translate(term); - component.options.Add(new TMP_Dropdown.OptionData(text)); - } - component.RefreshShownValue(); - } - - private void FillValuesTMPro() - { - TMP_Dropdown component = GetComponent(); - if (component == null) - { - return; - } - foreach (TMP_Dropdown.OptionData option in component.options) - { - _Terms.Add(option.text); - } - } -} -- cgit v1.1-26-g67d0