Beispiel #1
0
        void OnDeselectCallback(int index, ListViewItem item)
        {
            OnDeselectString.Invoke(index, strings[index]);

            if (item != null)
            {
                DefaultColoring(item as ListViewStringComponent);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Selects the item.
        /// </summary>
        /// <param name="index">Index.</param>
        /// <param name="text">Text.</param>
        protected virtual void SelectItem(int index, string text)
        {
            InputValue = text;

            HideList();

            if ((EventSystem.current != null) && (!EventSystem.current.alreadySelecting))
            {
                EventSystem.current.SetSelectedGameObject(toggleButton.gameObject);
            }

            OnSelect.Invoke(index, text);
        }
Beispiel #3
0
        /// <summary>
        /// Raises the deselect callback event.
        /// </summary>
        /// <param name="index">Index.</param>
        /// <param name="item">Item.</param>
        void OnDeselectCallback(int index, ListViewItem item)
        {
            if (SelectedItemsCache != null)
            {
                SelectedItemsCache.Remove(DataSource[index]);
            }

            OnDeselectString.Invoke(index, DataSource[index]);

            if (item != null)
            {
                DefaultColoring(item as ListViewStringComponent);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Start this instance.
        /// </summary>
        public void Start()
        {
            if (isStartedCombobox)
            {
                return;
            }
            isStartedCombobox = true;

            input = GetComponent <InputField>();
            input.onEndEdit.AddListener(InputItem);
            Editable = editable;

            ToggleButton = toggleButton;

            ListView = listView;

            if (listView != null)
            {
                listView.OnSelectString.RemoveListener(SelectItem);

                listView.OnSelectString.AddListener((index, item) => OnSelect.Invoke(index, item));

                listView.gameObject.SetActive(true);
                listView.Start();
                if ((listView.SelectedIndex == -1) && (listView.Strings.Count > 0))
                {
                    listView.SelectedIndex = 0;
                }
                if (listView.SelectedIndex != -1)
                {
                    input.text = listView.Strings[listView.SelectedIndex];
                }
                listView.gameObject.SetActive(false);
                listView.OnSelectString.AddListener(SelectItem);
            }
        }