3 using System.Collections.Generic;
6 namespace HKI.Core.UI.Settings
11 [RequireComponent(typeof(TMP_Dropdown))]
15 [SerializeField] List<SystemLanguage> Languages =
new List<SystemLanguage>() { SystemLanguage.English };
19 TMP_Dropdown dropdown = null;
24 dropdown = GetComponent<TMP_Dropdown>();
32 List<TMP_Dropdown.OptionData> list =
new List<TMP_Dropdown.OptionData>();
33 for(
int i = 0; i < Languages.Count; i++)
34 list.Add(
new TMP_Dropdown.OptionData(Languages[i].ToString()));
36 dropdown.ClearOptions();
37 dropdown.AddOptions(list);
39 dropdown.value = Languages.FindIndex(x => x == Language.
Value);
41 if(dropdown.value < 0)
45 Debug.LogError(
"(UILanguageDropdown) Language value is null!");
52 Language.
SetValue = Languages[dropdown.value];
57 List<TMP_Dropdown.OptionData> list =
new List<TMP_Dropdown.OptionData>();
58 for (
int i = 0; i < Languages.Count; i++)
59 list.Add(
new TMP_Dropdown.OptionData(Languages[i].ToString()));
61 dropdown.ClearOptions();
62 dropdown.AddOptions(list);
64 dropdown.value = Languages.FindIndex(x => x == Language.
Value);
66 if (dropdown.value < 0)
Special Variable enables the use of the SystemLanguage data type as a variable of the settings system...
void SetLanguageToDropdownValue()
This MonoBehaviour fills and handles a dropdown (TMP_Dropdown) with language settings.