예제 #1
0
 private void OnNavigationSubmit(NavigationSubmitEvent evt)
 {
     ToggleValue();
     evt.StopPropagation();
 }
예제 #2
0
        void Update()
        {
            if (focusedPanel == null)
            {
                return;
            }

            if (focusedPanel != null && !isAppFocused && ShouldIgnoreEventsOnAppNotFocused())
            {
                return;
            }

            if (sendIMGUIEvents)
            {
                while (Event.PopEvent(m_Event))
                {
                    if (m_Event.type == EventType.Repaint)
                    {
                        continue;
                    }

                    var panelPosition = Vector2.zero;
                    var panelDelta    = Vector2.zero;

                    if (ScreenToPanel(focusedPanelRenderer, m_Event.mousePosition, m_Event.delta, out panelPosition, out panelDelta))
                    {
                        m_Event.mousePosition = panelPosition;
                        m_Event.delta         = panelDelta;

                        using (EventBase evt = InternalBridge.CreateEvent(m_Event))
                        {
                            focusedPanel.visualTree.SendEvent(evt);
                        }
                    }
                }
            }

            if (sendInputEvents)
            {
                if (sendNavigationEvents)
                {
                    bool sendNavigationMove = ShouldSendMoveFromInput();

                    if (sendNavigationMove)
                    {
                        using (EventBase evt = NavigationMoveEvent.GetPooled(GetRawMoveVector()))
                        {
                            focusedPanel.visualTree.SendEvent(evt);
                        }
                    }

                    if (input.GetButtonDown(m_SubmitButton))
                    {
                        using (EventBase evt = NavigationSubmitEvent.GetPooled())
                        {
                            focusedPanel.visualTree.SendEvent(evt);
                        }
                    }

                    if (input.GetButtonDown(m_CancelButton))
                    {
                        using (EventBase evt = NavigationCancelEvent.GetPooled())
                        {
                            focusedPanel.visualTree.SendEvent(evt);
                        }
                    }
                }

                if (!ProcessTouchEvents() && input.mousePresent)
                {
                    ProcessMouseEvents();
                }
            }
        }