11 [AddComponentMenu(
"HKI/UI/UIVarToggle")]
12 [RequireComponent(typeof(Toggle))]
13 [DisallowMultipleComponent]
17 [Header(
"General Properties")]
20 [SerializeField]
bool SetVarOnValueChangedCallback =
false;
21 [SerializeField]
bool SetVarOnDisable =
false;
27 [SerializeField] GameObject ValueTextGO = null;
39 Debug.LogError(
"(UIValueText)" + name +
" there isn't a variable attached to this value text!");
43 toggle = GetComponent<Toggle>();
45 toggle.onValueChanged.AddListener((value) => { OnValueChanged(); });
55 toggle.isOn = Variable.
Value;
60 Language.OnValueChanged += ChangeText;
62 Variable.OnValueChanged += OnExternalChange;
72 Language.OnValueChanged -= ChangeText;
74 Variable.OnValueChanged -= OnExternalChange;
92 toggle.isOn = Variable.
Value;
103 if(SetVarOnValueChangedCallback && Variable.
Value != toggle.isOn)
109 if(Variable != null && toggle.isOn != Variable.
Value)
110 toggle.isOn = Variable.
Value;
115 if (TrueTextLocalization != null && FalseTextLocalization != null)
116 valueText.
ChangeText(toggle.isOn ? TrueTextLocalization.
GetText(Language) : FalseTextLocalization.
GetText(Language));
This MonoBehaviour enables to use Unity UIToggle with a Boolean HKIVar value. It also can use an Unit...
void SetVarToToggleValue()
This ScriptableObject contains as a container for all text localization information.
string GetText(Language language)
This function returns the string in a specific language. If there is no localization element in the r...
void ChangeText(string text)
This class allows the use of the standard Unity UI Text component and the TextMeshPro component witho...
Special Variable enables the use of the SystemLanguage data type as a variable of the settings system...
Implementation of a boolean value as a HKIVar via HKIVarGeneric.