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

        onValueChanged.Invoke(currentIndex);
    }
        /// <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);
        }
Example #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));
 }
    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);
    }
Example #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);
            }
        }
Example #6
0
 void ExitSelection()
 {
     InSelection = false;
     onValueConfirmed.Invoke(currentIndex);
     elementVisibility.alpha = 0;
 }