Пример #1
0
        private void Update()
        {
            //if ( !Input.anyKey )
            //    return;

            //if ( Input.GetKeyDown( KeyCode.Escape ) )
            //{
            //    Hide();
            //}
            if (Input.GetKeyDown(KeyCode.Return))
            {
                if (HoveredItem != null)
                {
                    HoveredItem.Select();
                }

                Hide();
            }
            else if (Input.GetKey(KeyCode.DownArrow))
            {
                if (Time.time > LastDownTime + RepeatPeriod)
                {
                    if (HoveredItem != null)
                    {
                        HoveredItem.HoverNextVisibleItem();

                        EnsureHoveredItemIsVisible();
                    }

                    SearchInputField.MoveTextEnd(false);

                    LastDownTime = Time.time;

                    // Delay extra if first press
                    if (Input.GetKeyDown(KeyCode.DownArrow))
                    {
                        LastDownTime += RepeatDelay;
                    }
                }
            }
            else if (Input.GetKey(KeyCode.UpArrow))
            {
                if (Time.time > LastUpTime + RepeatPeriod)
                {
                    if (HoveredItem != null)
                    {
                        HoveredItem.HoverPreviousVisibleItem();

                        EnsureHoveredItemIsVisible();
                    }

                    SearchInputField.MoveTextEnd(false);

                    LastUpTime = Time.time;

                    if (Input.GetKeyDown(KeyCode.UpArrow))
                    {
                        LastUpTime += RepeatDelay;
                    }
                }
            }
        }
Пример #2
0
        public void HandleSearchGotFocus()
        {
            // Don't auto-select on focus... Necessary to allow text to be added nicely when focus is just switched to it.

            this.ExecuteAtEndOfFrame(() => SearchInputField.MoveTextEnd(false));
        }