/// <summary> /// On input field value changed /// </summary> /// <param name="currText">New text</param> void OnValueChanged(string currText) { text = currText; if (text == "") { SelectedOption = null; if (arrow == null) { isPanelActive = false; panel.gameObject.SetActive(isPanelActive); } else { RedrawPanel(); } } else { isPanelActive = true; panel.gameObject.SetActive(isPanelActive); if (OnOpenPanel != null) { OnOpenPanel(this); } RedrawPanel(); } }
/// <summary> /// What happens when an item in the list is selected /// </summary> /// <param name="item"></param> void OnItemClicked(string item) { SelectedOption = AvailableOptions.Find(s => s.Name == item); OnSelectionChanged.Invoke(item); if (!resetAfterSelect) { text = item; mainInput.text = item; } else { text = mainInput.text = ""; } isPanelActive = false; panel.gameObject.SetActive(false); }