示例#1
0
        /// <summary>
        /// Handle on focus exit events from IPointerSpecificFocusable.
        /// </summary>
        public void OnFocusExit(PointerSpecificEventData eventData)
        {
            if (!isDisabled)
            {
                // If we require gaze, we should always reset the state and send a canceled if currently pressed.
                if (RequireGaze)
                {
                    if (ButtonState == ButtonStateEnum.Pressed)
                    {
                        DoButtonCanceled();
                    }

                    OnStateChange(handVisible ? ButtonStateEnum.Interactive : ButtonStateEnum.Observation);
                }
                // If we don't require gaze, we should only reset if we aren't currently in a pressed state.
                else if (ButtonState != ButtonStateEnum.Pressed)
                {
                    OnStateChange(handVisible ? ButtonStateEnum.Interactive : ButtonStateEnum.Observation);
                }

                focused = false;

                eventData.Use();
            }
        }
示例#2
0
        /// <summary>
        /// FocusManager SendMessage("FocusEnter") receiver.
        /// </summary>
        public void OnFocusEnter(PointerSpecificEventData eventData)
        {
            if (!m_disabled)
            {
                ButtonStateEnum newState = _bHandVisible ? ButtonStateEnum.Targeted : ButtonStateEnum.ObservationTargeted;
                this.OnStateChange(newState);

                _bFocused = true;
                eventData.Use();
            }
        }
示例#3
0
        /// <summary>
        /// Handle on focus enter events from IPointerSpecificFocusable.
        /// </summary>
        public void OnFocusEnter(PointerSpecificEventData eventData)
        {
            if (!isDisabled)
            {
                if (ButtonState != ButtonStateEnum.Pressed)
                {
                    OnStateChange(handVisible ? ButtonStateEnum.Targeted : ButtonStateEnum.ObservationTargeted);
                }

                focused = true;

                eventData.Use();
            }
        }
示例#4
0
        /// <summary>
        /// FocusManager SendMessage("FocusExit") receiver.
        /// </summary>
        public void OnFocusExit(PointerSpecificEventData eventData)
        {
            if (!m_disabled)  // && FocusManager.Instance.IsFocused(this))
            {
                if (ButtonState == ButtonStateEnum.Pressed)
                {
                    DoButtonCanceled();
                }

                ButtonStateEnum newState = _bHandVisible ? ButtonStateEnum.Interactive : ButtonStateEnum.Observation;

                if (RequireGaze || ButtonState != ButtonStateEnum.Pressed)
                {
                    this.OnStateChange(newState);
                }

                _bFocused = false;
                eventData.Use();
            }
        }