예제 #1
0
    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);
    }
예제 #2
0
    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);
        }
    }
예제 #3
0
    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;
    }