public void Select(UIBtnDropdown btn) { SetValues(btn.text.text, btn.value); m_LastBtnSelected = (RectTransform)btn.gameObject.transform; HideContent(); if (m_onChangeObj != null && value.Length > 0) m_onChangeObj.SendMessage(m_onChangeStr, value, SendMessageOptions.RequireReceiver); }
public void Select(UIBtnDropdown btn) { SetValues(btn.text.text, btn.value); m_LastBtnSelected = (RectTransform)btn.gameObject.transform; HideContent(); if (m_onChangeObj != null && value.Length > 0) { m_onChangeObj.SendMessage(m_onChangeStr, value, SendMessageOptions.RequireReceiver); } }
public void AddOption(string name, string value) { GameObject btn = Instantiate(BtnDropdownPrefab) as GameObject; btn.transform.SetParent(content); btn.transform.localScale = new Vector3(1, 1, 1); // Select first element added if (content.childCount == 1) { m_LastBtnSelected = (RectTransform)btn.transform; } UIBtnDropdown button = btn.GetComponent <UIBtnDropdown>(); button.dropdown = this; button.text.text = name; button.value = value; }