예제 #1
0
    void EnterSelection()
    {
        InSelection             = true;
        relativeInputPosition   = Vector3.zero;
        elementVisibility.alpha = 1;

        onValueChanged.Invoke(currentIndex);
    }
예제 #2
0
        /// <summary>
        /// Event handler for an item being selected within the ListBox
        /// </summary>
        /// <param name="index">The index of the selected item</param>
        private void OnItemSelected(int index)
        {
            ClearItem(index);
            _selectedIndex = index;
            SetItem(index);

            onValueChanged.Invoke(index);
        }
예제 #3
0
 public void setSelected(DOption option)
 {
     Debug.Log("set selected option:" + option.text);
     if (this.selectedOption == option)
     {
         return;
     }
     this.selectedOption = option;
     RefreshShownValue();
     onValueChanged.Invoke(options.IndexOf(option));
 }
예제 #4
0
    private Text CreateNewItem(int index)
    {
        var textItem = Instantiate <Text>(prefab);

        textItem.transform.SetParent(transform, false);
        var entry = new EventTrigger.Entry();

        entry.eventID = EventTriggerType.PointerClick;
        entry.callback.AddListener((x) => callback.Invoke(index));
        textItem.GetComponent <EventTrigger>().triggers.Add(entry);
        return(textItem);
    }
예제 #5
0
        void Set(int value, bool sendCallback = true)
        {
            if (Application.isPlaying && (value == m_Value || OptionsCount == 0))
            {
                return;
            }

            m_Value = Mathf.Clamp(value, 0, OptionsCount - 1);
            RefreshShownValue();

            if (sendCallback)
            {
                // Notify all listeners
                UISystemProfilerApi.AddMarker("Dropdown.value", this);
                m_OnValueChanged.Invoke(m_Value);
            }
        }
예제 #6
0
 void ExitSelection()
 {
     InSelection = false;
     onValueConfirmed.Invoke(currentIndex);
     elementVisibility.alpha = 0;
 }