public static Component SetText(GameObject go, string value) { //Show.Log("setting "+go.name+" to \""+value+"\""); UiText uit = go.GetComponentInChildren <UiText>(); if (uit != null) { uit.setText.Invoke(value); return(uit); } TMPro.TMP_InputField tif = go.GetComponentInChildren <TMPro.TMP_InputField>(); if (tif != null) { tif.text = value; return(tif); } TMPro.TMP_Text tmp = go.GetComponentInChildren <TMPro.TMP_Text>(); if (tmp != null) { tmp.text = value; return(tmp); } InputField inf = go.GetComponentInChildren <InputField>(); if (inf != null) { inf.text = value; return(inf); } Text txt = go.GetComponentInChildren <Text>(); if (txt != null) { txt.text = value; return(txt); } return(null); }
public static Component GetTextComponent(GameObject go) { UiText uit = go.GetComponentInChildren <UiText>(); if (uit != null) { return(uit); } TMPro.TMP_InputField tif = go.GetComponentInChildren <TMPro.TMP_InputField>(); if (tif != null) { return(tif); } TMPro.TMP_Text tmp = go.GetComponentInChildren <TMPro.TMP_Text>(); if (tmp != null) { return(tmp); } InputField inf = go.GetComponentInChildren <InputField>(); if (inf != null) { return(inf); } Text txt = go.GetComponentInChildren <Text>(); if (txt != null) { return(txt); } return(null); }
public static string GetText(GameObject go) { UiText uit = go.GetComponentInChildren <UiText>(); if (uit != null && uit.getText != null) { return(uit.getText.Invoke()); } TMPro.TMP_InputField tif = go.GetComponentInChildren <TMPro.TMP_InputField>(); if (tif != null) { return(tif.text); } TMPro.TMP_Text tmp = go.GetComponentInChildren <TMPro.TMP_Text>(); if (tmp != null) { return(tmp.text); } InputField inf = go.GetComponentInChildren <InputField>(); if (inf != null) { return(inf.text); } Text txt = go.GetComponentInChildren <Text>(); if (txt != null) { return(txt.text); } return(null); }
public void HandleDropdown_OnSelection(int index) { TMP_Dropdown dd = GetComponent <TMP_Dropdown>(); UiText onSelection = GetComponent <UiText>(); if (onSelection != null) { HandleDropdown(index, dd, onSelection.OnSetText); } lastValue = index; }
public static void UiTextUpdate(TMP_Dropdown dd) { UiText onSelection = dd.GetComponent <UiText>(); if (onSelection == null) { return; } UnityEvent_string setText = onSelection.setText; HandleDropdown(dd.value, dd, setText); }
public static Component SetCustomValue(GameObject go, string value) { DropDownEvent dde = go.GetComponentInChildren <DropDownEvent>(); if (dde != null) { dde.initializeUiTextToDropdown = false; } TMP_Dropdown dd = go.GetComponentInChildren <TMP_Dropdown>(); if (dd != null) { dd.SetValueWithoutNotify(0); } return(UiText.SetText(go, value)); }
public void DoActivateTrigger() { //Debug.Log("doactivate " + this); if (uiToControlVisibility) { uiToControlVisibility.SetActive(!uiToControlVisibility.activeSelf); if (hideThisWhenUiVisible) { gameObject.SetActive(!uiToControlVisibility.activeSelf); } } if (!string.IsNullOrEmpty(alternateText)) { string temp = UiText.GetText(gameObject); UiText.SetText(gameObject, alternateText); alternateText = temp; } }
void Start() { if (initOptionsOnStart) { PopulateDropdown(); } if (initializeUiTextToDropdown) { UiText onSelection = GetComponent <UiText>(); if (onSelection != null && onSelection.OnSetText.GetPersistentEventCount() > 0) { TMP_Dropdown dd = GetComponent <TMP_Dropdown>(); Show.Log("??start at " + dd.value); BindDropdownAction(dd, this, HandleDropdown_OnSelection); Show.Log("start at " + dd.value); HandleDropdown_OnSelection(dd.value); } } }