public void RaiseSourceUp(IInputSource source, uint sourceId, InteractionSourcePressInfo pressType, object[] tags = null)
        {
            // Create input event
            inputEventData.Initialize(source, sourceId, tags, pressType);

            // Pass handler through HandleEvent to perform modal/fallback logic
            HandleEvent(inputEventData, OnSourceUpEventHandler);

            // UI events
            IPointingSource pointingSource;

            FocusManager.Instance.TryGetPointingSource(inputEventData, out pointingSource);
            PointerInputEventData pointerInputEventData = FocusManager.Instance.GetSpecificPointerEventData(pointingSource);

            if (pointerInputEventData != null && pressType == InteractionSourcePressInfo.Select)
            {
                pointerInputEventData.InputSource = source;
                pointerInputEventData.SourceId    = sourceId;

                if (pointerInputEventData.selectedObject != null)
                {
                    ExecuteEvents.ExecuteHierarchy(pointerInputEventData.selectedObject, pointerInputEventData, ExecuteEvents.pointerUpHandler);
                    ExecuteEvents.ExecuteHierarchy(pointerInputEventData.selectedObject, pointerInputEventData, ExecuteEvents.pointerClickHandler);
                }

                pointerInputEventData.Clear();
            }
        }
Exemplo n.º 2
0
        public void RaiseSourceDown(IInputSource source, uint sourceId, InteractionSourcePressInfo pressType, object[] tags = null)
        {
            // Create input event
            inputEventData.Initialize(source, sourceId, tags, pressType);

            // Pass handler through HandleEvent to perform modal/fallback logic
            HandleEvent(inputEventData, OnSourceDownEventHandler);

            // UI events
            IPointingSource pointingSource;

            FocusManager.Instance.TryGetPointingSource(inputEventData, out pointingSource);
            PointerInputEventData pointerInputEventData = FocusManager.Instance.GetSpecificPointerEventData(pointingSource);

            if (pointerInputEventData != null && pressType == InteractionSourcePressInfo.Select)
            {
                pointerInputEventData.InputSource = source;
                pointerInputEventData.SourceId    = sourceId;
                pointerInputEventData.pointerId   = (int)sourceId;

                pointerInputEventData.eligibleForClick    = true;
                pointerInputEventData.delta               = Vector2.zero;
                pointerInputEventData.dragging            = false;
                pointerInputEventData.useDragThreshold    = true;
                pointerInputEventData.pressPosition       = pointerInputEventData.position;
                pointerInputEventData.pointerPressRaycast = pointerInputEventData.pointerCurrentRaycast;

                ExecuteEvents.ExecuteHierarchy(inputEventData.selectedObject, pointerInputEventData, ExecuteEvents.pointerDownHandler);
            }
        }
Exemplo n.º 3
0
        public void RaiseSourceDown(IInputSource source, uint sourceId, InteractionSourcePressInfo pressType, object[] tags = null)
        {
            // Create input event
            inputEventData.Initialize(source, sourceId, tags, pressType);

            // Pass handler through HandleEvent to perform modal/fallback logic
            HandleEvent(inputEventData, OnSourceDownEventHandler);

            // UI events
            if (ShouldSendUnityUiEvents && pressType == InteractionSourcePressInfo.Select)
            {
                PointerInputEventData pointerInputEventData = FocusManager.Instance.GetPointerEventData();
                pointerInputEventData.InputSource = source;
                pointerInputEventData.SourceId    = sourceId;

                pointerInputEventData.eligibleForClick    = true;
                pointerInputEventData.delta               = Vector2.zero;
                pointerInputEventData.dragging            = false;
                pointerInputEventData.useDragThreshold    = true;
                pointerInputEventData.pressPosition       = pointerInputEventData.position;
                pointerInputEventData.pointerPressRaycast = pointerInputEventData.pointerCurrentRaycast;

                HandleEvent(pointerInputEventData, ExecuteEvents.pointerDownHandler);
            }
        }
Exemplo n.º 4
0
        public void RaiseInputPositionChanged(IInputSource source, uint sourceId, InteractionSourcePressInfo pressType, Vector2 position, object[] tags = null)
        {
            // Create input event
            inputPositionEventData.Initialize(source, sourceId, tags, pressType, position);

            // Pass handler through HandleEvent to perform modal/fallback logic
            HandleEvent(inputPositionEventData, OnInputPositionChangedEventHandler);
        }
Exemplo n.º 5
0
        public void RaiseInputClicked(IInputSource source, uint sourceId, InteractionSourcePressInfo pressType, int tapCount, object[] tags = null)
        {
            // Create input event
            sourceClickedEventData.Initialize(source, sourceId, tags, pressType, tapCount);

            // Pass handler through HandleEvent to perform modal/fallback logic
            HandleEvent(sourceClickedEventData, OnInputClickedEventHandler);

            // NOTE: In Unity UI, a "click" happens on every pointer up, so we have RaiseSourceUp call the pointerClickHandler.
        }
Exemplo n.º 6
0
        public void RaiseSourceUp(IInputSource source, uint sourceId, InteractionSourcePressInfo pressType, object[] tags = null)
        {
            // Create input event
            inputEventData.Initialize(source, sourceId, tags, pressType);

            // Pass handler through HandleEvent to perform modal/fallback logic
            HandleEvent(inputEventData, OnSourceUpEventHandler);

            // UI events
            if (ShouldSendUnityUiEvents && pressType == InteractionSourcePressInfo.Select)
            {
                PointerInputEventData pointerInputEventData = FocusManager.Instance.GetPointerEventData();
                pointerInputEventData.InputSource = source;
                pointerInputEventData.SourceId    = sourceId;

                HandleEvent(pointerInputEventData, ExecuteEvents.pointerUpHandler);
                HandleEvent(pointerInputEventData, ExecuteEvents.pointerClickHandler);
            }
        }
Exemplo n.º 7
0
        public void RaiseInputClicked(IInputSource source, uint sourceId, InteractionSourcePressInfo pressType, int tapCount, object[] tags = null)
        {
            // Create input event
            sourceClickedEventData.Initialize(source, sourceId, tags, pressType, tapCount);

            // Pass handler through HandleEvent to perform modal/fallback logic
            HandleEvent(sourceClickedEventData, OnInputClickedEventHandler);

            if (tapCount == 1)
            {
                try { AfterGestureRecognition.Instance.ExtraTapped(); }
                catch { Debug.Log("Add AfterGestureRecognition script if you want to use Extra Actions"); }
            }
            else if (tapCount == 2)
            {
                try { AfterGestureRecognition.Instance.DoubleTapped(); }
                catch { Debug.Log("Add AfterGestureRecognition script if you want to use Extra Actions"); }
            }
            // NOTE: In Unity UI, a "click" happens on every pointer up, so we have RaiseSourceUp call the pointerClickHandler.
        }
Exemplo n.º 8
0
 public void Initialize(IInputSource inputSource, uint sourceId, object tag, InteractionSourcePressInfo pressType, int tapCount)
 {
     Initialize(inputSource, sourceId, tag, pressType);
     TapCount = tapCount;
 }
Exemplo n.º 9
0
 public void Initialize(IInputSource inputSource, uint sourceId, object tag, InteractionSourcePressInfo pressType, Vector2 position)
 {
     Initialize(inputSource, sourceId, tag, pressType);
     Position = position;
 }
 public void Initialize(IInputSource inputSource, uint sourceId, object tag, InteractionSourcePressInfo pressType)
 {
     BaseInitialize(inputSource, sourceId, tag);
     PressType = pressType;
 }