示例#1
0
        public override void OnMove(AxisEventData eventData)
        {
            if (!IsActive() || !IsInteractable())
            {
                base.OnMove(eventData);
                return;
            }

            switch (eventData.moveDir)
            {
            case MoveDirection.Left:
                if (axis == Axis.Horizontal && FindSelectableOnLeft() == null)
                {
                    Set(reverseValue ? value + stepSize : value - stepSize);
                }
                else
                {
                    base.OnMove(eventData);
                }
                break;

            case MoveDirection.Right:
                if (axis == Axis.Horizontal && FindSelectableOnRight() == null)
                {
                    Set(reverseValue ? value - stepSize : value + stepSize);
                }
                else
                {
                    base.OnMove(eventData);
                }
                break;

            case MoveDirection.Up:
                if (axis == Axis.Vertical && FindSelectableOnUp() == null)
                {
                    Set(reverseValue ? value - stepSize : value + stepSize);
                }
                else
                {
                    base.OnMove(eventData);
                }
                break;

            case MoveDirection.Down:
                if (axis == Axis.Vertical && FindSelectableOnDown() == null)
                {
                    Set(reverseValue ? value + stepSize : value - stepSize);
                }
                else
                {
                    base.OnMove(eventData);
                }
                break;
            }
        }
示例#2
0
        protected virtual AxisEventData GetAxisEventData(float x, float y, float moveDeadZone)
        {
            if (m_AxisEventData == null)
            {
                m_AxisEventData = new AxisEventData(eventSystem);
            }

            m_AxisEventData.Reset();
            m_AxisEventData.moveVector = new Vector2(x, y);
            m_AxisEventData.moveDir    = DetermineMoveDirection(x, y, moveDeadZone);
            return(m_AxisEventData);
        }
示例#3
0
        public virtual void OnMove(AxisEventData eventData)
        {
            switch (eventData.moveDir)
            {
            case MoveDirection.Right:
                Navigate(eventData, FindSelectableOnRight());
                break;

            case MoveDirection.Up:
                Navigate(eventData, FindSelectableOnUp());
                break;

            case MoveDirection.Left:
                Navigate(eventData, FindSelectableOnLeft());
                break;

            case MoveDirection.Down:
                Navigate(eventData, FindSelectableOnDown());
                break;
            }
        }
示例#4
0
 public virtual void OnMove(AxisEventData eventData)
 {
     Execute(EventTriggerType.Move, eventData);
 }