Exemple #1
0
        private void CalibrationWindow_TapEvent(object sender)
        {
            // Remove the window event so we don't keep starting
            // when we touch the first cross hair
            TapEvent -= new OnTap(CalibrationWindow_TapEvent);

            Start();
        }
Exemple #2
0
    void CreateNote(OnTap e)
    {
        if (GameManager.instance.state != Enums.GAME_STATE.CREATE)
        {
            return;
        }

        Instantiate(_notePrefab, transform.position, Quaternion.identity);
    }
Exemple #3
0
 public void OnTapScreen(InputAction.CallbackContext context)
 {
     if (EventSystem.current.IsPointerOverGameObject())
     {
         return;
     }
     if (context.started)
     {
         OnTap?.Invoke(this, EventArgs.Empty);
     }
 }
Exemple #4
0
 private void Update()
 {
     if (Input.touchCount > 0)
     {
         Touch touch = Input.GetTouch(0);
         if (touch.phase == TouchPhase.Began)
         {
             OnTap?.Invoke(mainCamera.ScreenToWorldPoint(touch.position));
         }
     }
 }
 public override void DisposeModel()
 {
     base.DisposeModel();
     if (OnTap is Action <BinViewModel> )
     {
         Delegate[] clientList = OnTap.GetInvocationList();
         foreach (var d in clientList)
         {
             OnTap -= (d as Action <BinViewModel>);
         }
     }
 }
        private void AddBirdListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            string birdName = filteredMstrBirdList[e.Position].Name;    // Must use 'filtered Master' or picking the third item in the filtered list will actually add the third bird name in 'Master' list.

            if (wrkBirdList.Exists(x => x.Name == birdName))
            {
                string alert = "This bird already exists in your current list.";
                Toast.MakeText(this.Activity, alert, ToastLength.Short).Show();
            }
            else
            {
                OnTap.Invoke(this, new OnTapEventArgs(birdName));
                this.Dismiss();
            }
        }
Exemple #7
0
    private void FireTapEvent()
    {
        GameObject   hitObj = GetHitGameObject(startPos);
        TapEventArgs args   = new TapEventArgs(startPos, hitObj);

        OnTap?.Invoke(this, args);

        if (hitObj != null)
        {
            if (hitObj.TryGetComponent(out ITappable tappedObj))
            {
                tappedObj.OnTap();
            }
        }
    }
Exemple #8
0
        private void Update()
        {
            switch (tapped)
            {
            case false when Input.touchCount > 0:
                tapped = !tapped;
                OnTap?.Invoke();
                break;

            case true:
                MobileInput(out var moveDirection);
                movement.MoveDirection = moveDirection;
                break;
            }
        }
Exemple #9
0
    protected void LaunchCoroutineTap(OnTap pEvent)
    {
        _targetInteractable = null;
        _tapPosition        = pEvent.targetPos;

        if (_onUI || pEvent.playerType != playerType)
        {
            return;
        }

        if (GameManager.Instance.LoadedScene == SceneString.ZoomView)
        {
            LaunchTap();
        }
    }
Exemple #10
0
 /// <summary>
 /// Checks if player touched the game object check for shorter than <see cref="TOUCH_DRAG_DELAY"/> to trigger tap event,
 /// if user was touching the object for that amount of time and didn't move their finger for more than <see cref="TOUCH_DRAG_MAX_OFFSET"/> triggers drag and drop.
 /// </summary>
 void Update()
 {
     if (pointerDownCoroutine != null)
     {
         if (Input.touchCount > 0 && Vector2.Distance(Input.GetTouch(0).position, dragBeginPosition) > TOUCH_DRAG_MAX_OFFSET)
         {
             StopCoroutine(pointerDownCoroutine);
             pointerDownCoroutine = null;
         }
         else if (Input.touchCount == 0)
         {
             StopCoroutine(pointerDownCoroutine);
             pointerDownCoroutine = null;
             OnTap.Invoke();
         }
     }
 }
Exemple #11
0
        public override void DisposeModel()
        {
            Locations.Clear();
            Zones.Clear();
            BinTemplates.Clear();

            if (OnTap is Action <RackViewModel> )
            {
                Delegate[] clientList = OnTap.GetInvocationList();
                foreach (var d in clientList)
                {
                    OnTap -= (d as Action <RackViewModel>);
                }
            }
            BinsViewModel.DisposeModel();
            base.DisposeModel();
        }
Exemple #12
0
    private void FireTapEvent()
    {
        GameObject hitObj = GetHitInfo(startPoint);

        var args = new TapEventArgs(startPoint, hitObj);

        OnTap?.Invoke(this, args);

        if (hitObj is null)
        {
            return;
        }

        var tap = hitObj.GetComponent <ITapped>();

        tap.OnTap(args);
    }
Exemple #13
0
 void Tap()
 {
     if (tapsCount == 0)
     {
         OnTap?.Invoke();
         tapsCount++;
     }
     else if (tapsCount == 1)
     {
         OnTap2?.Invoke();
         tapsCount++;
     }
     else if (tapsCount == 2 && Player.Player.normalVector == Vector2.left)
     {
         OnTap3?.Invoke();
     }
 }
Exemple #14
0
    void UpdatePose(OnTap e)
    {
        if (GameManager.instance.state != Enums.GAME_STATE.GAME)
        {
            return;
        }

        if (e.isRight)
        {
            SetHandMode(Enums.TYPE_NOTE.RIGHT);
            _rightHandTimer = TIMER_RIGHT;
        }

        else
        {
            SetHandMode(Enums.TYPE_NOTE.LEFT);
            _leftHandTimer = TIMER_LEFT;
        }
    }
        public TopPanelItem(string title, View contentView = null, bool isSelected = false)
        {
            HorizontalOptions = LayoutOptions.FillAndExpand;
            Padding           = 8;

            titleLabel = new DefaultLabel {
                Text = title,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                FontAttributes    = FontAttributes.Bold,
                CustomFontSize    = NamedSize.Small
            };
            IsSelected  = isSelected;
            ContentView = contentView;

            GestureRecognizers.Add(new TapGestureRecognizer {
                Command = new Command(() => OnTap.Dispatch())
            });

            Content = titleLabel;
        }
Exemple #16
0
        private void DetectTapGestures()
        {
            TouchManipulationInfo[] infos = new TouchManipulationInfo[_touchDictionary.Count];
            _touchDictionary.Values.CopyTo(infos, 0);
            if (infos.Length != 1)
            {
                return;
            }
            SKPoint point = infos[0].PreviousPoint;

            if (infos[0].MoveCounter > MaxTapMoveCounter)
            {
                return;
            }
            var tapEventArgs = new TapEventArgs(point);

            var now         = DateTime.Now;
            var lastTapTime = LastTapTime;

            LastTapTime = now;

            OnTap?.Invoke(this, tapEventArgs);
            if (now - lastTapTime < DoubleTapDelay)
            {
                OnDoubleTap?.Invoke(this, tapEventArgs);
                LastDoubleTapTime = now;
                LastTapTime       = DateTime.MinValue; //Reset double tap timer
            }
            else
            {
                _timer = new Timer(_ =>
                {
                    if (DateTime.Now - LastDoubleTapTime < DoubleTapDelay)
                    {
                        return;
                    }
                    OnSingleTap?.Invoke(this, tapEventArgs);
                }, null, DoubleTapDelay.Milliseconds, Timeout.Infinite);
            }
        }
        private void HandleTapping()
        {
            Touch[] touches = Input.touches;
            for (int i = 0; i < touches.Length; i++)
            {
                if (touches[i].phase != TouchPhase.Ended)
                {
                    continue;
                }
                OnTap?.Invoke();

                if (!ShootGraphicsRays(Input.mousePosition))
                {
                    if (!ShootPhysicsRay(touches[i].position))
                    {
                        OnDeselect?.Invoke();
                    }
                }
            }

            if (touches.Length == 1)
            {
                if (touches[0].deltaPosition.magnitude > _DragThreshold)
                {
                    SetCurrentState(TouchInputState.DRAGGING);
                }
            }

            if (touches.Length == 2)
            {
                float delta = InputUtils.GetTouchDistanceDelta(touches[0], touches[1]);

                if (Mathf.Abs(delta) > _PinchThreshold)
                {
                    SetCurrentState(TouchInputState.PINCHING);
                }
            }
        }
        private void HandleDebugMouse()
        {
#if UNITY_EDITOR
            if (Input.GetMouseButtonDown(1))
            {
                _PreviousMousePosition = Input.mousePosition;
                OnDragStart?.Invoke();
            }

            if (Input.GetMouseButton(1))
            {
                Vector2 mousePos = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
                OnDragDelta?.Invoke((mousePos - _PreviousMousePosition) * 2);
                _PreviousMousePosition = Input.mousePosition;
            }

            if (Input.GetMouseButtonUp(1))
            {
                OnDragStop?.Invoke();
            }

            OnPinchDelta?.Invoke(Input.mouseScrollDelta.y * 45);

            if (Input.GetMouseButtonDown(0))
            {
                OnTap?.Invoke();

                if (!ShootGraphicsRays(Input.mousePosition))
                {
                    if (!ShootPhysicsRay(Input.mousePosition))
                    {
                        OnDeselect?.Invoke();
                    }
                }
            }
#endif
        }
Exemple #19
0
        /// <summary>
        /// Creates a new CalibrationWindow.
        /// </summary>
        /// <param name="autoStart">Whether or not to automatically begin calibration.</param>
        /// <param name="autoSave">Whether or not to save the calibration settings using Extended Weak Reference.</param>
        public CalibrationWindow(bool autoStart, bool autoSave)
        {
            _autoStart = autoStart;
            _autoSave  = autoSave;

            Settings = new CalibrationSettings();

            Name      = "calibrationWindow";
            Width     = Glide.LCD.Width;
            Height    = Glide.LCD.Height;
            BackColor = Colors.White;
            Graphics  = new Graphics(Width, Height);

            int yPos = (Height / 2) - 50;

            _text1           = new TextBlock("text1", 255, (Glide.LCD.Width - 300) / 2, yPos, 300, 50);
            _text1.Font      = FontManager.GetFont(FontManager.FontType.droid_reg12);
            _text1.TextAlign = HorizontalAlignment.Center;
            AddChild(_text1);

            yPos += 50 + 5;

            _startBtn           = new Button("startBtn", 255, (Width - 200) / 2, yPos, 122, 32);
            _startBtn.Text      = "Recalibrate";
            _startBtn.TapEvent += new OnTap(_startBtn_TapEvent);
            _startBtn.Visible   = false;
            AddChild(_startBtn);

            _exitBtn           = new Button("exitBtn", 255, _startBtn.X + _startBtn.Width + 10, yPos, 68, 32);
            _exitBtn.Text      = "Done";
            _exitBtn.TapEvent += new OnTap(_exitBtn_TapEvent);
            _exitBtn.Visible   = false;
            AddChild(_exitBtn);

            _canvas = new Canvas();
            AddChild(_canvas);

            if (_autoStart)
            {
                _text1.FontColor = Colors.Black;
                _text1.Text      = "Touch the crosshair location.";
                Start();
            }
            else
            {
                if (GlideTouch.Calibrated)
                {
                    _text1.FontColor = Colors.Red;
                    _text1.Text      = "Touch is already calibrated.";

                    _exitBtn.Visible  = true;
                    _startBtn.Visible = true;
                }
                else
                {
                    _text1.FontColor = Colors.Black;
                    _text1.Text      = "Touch the screen to start.";

                    TapEvent += new OnTap(CalibrationWindow_TapEvent);
                }
            }
        }
Exemple #20
0
 public void AddDefaultBlink()
 {
     SetBrightness(0.75f);
     onTap = DefaultBlink;
 }
Exemple #21
0
 public void Tap()
 {
     OnTap?.Invoke(_score);
     ReturnToPool();
 }
Exemple #22
0
 private void LeanTouch_OnFingerTap(LeanFinger finger)
 {
     OnTap?.Invoke(finger.GetWorldPosition(10f));
 }
Exemple #23
0
 public CTapHandler(GameObject go, OnTap listener)
 {
     m_gesture = new CGestureHandler(go);
     m_gesture.SetTappable();
     OnTapListeners = listener;
 }
Exemple #24
0
 private void Tap(InputAction.CallbackContext ctx)
 {
     OnTap?.Invoke();
 }
Exemple #25
0
        protected bool Init()
        {
            OnTouchBegan = (touch, cCEvent) =>
            {
                if (_isTouched)
                {
                    return(false);
                }

                _isTouched      = true;
                _touchStartTime = DateTime.Now;
                _touchStartPos  = touch.Location;
                _touchNowPos    = touch.Location;

                //                    this
                //                    CCScheduler
                //Director::getInstance()->getScheduler()->schedule(schedule_selector(EventListenerGesture::_updateInTouch), this, 0.05f, false);
                return(true);
            };
            this.
            OnTouchCancelled = (_touch, ccEvent) =>
            {
                _isTouched   = false;
                _gestureType = GestureType.NONE;
            };

            OnTouchMoved = (touch, ccEvent) =>
            {
                //if (_gestureType != GestureType.NONE)
                //{
                //    return;
                //}

                _touchNowPos = touch.Location;
                var xDiff          = _touchNowPos.X - _touchStartPos.X;
                var xDiffAbs       = Math.Abs((int)(xDiff));
                var yDiff          = _touchNowPos.Y - _touchStartPos.Y;
                var yDiffAbs       = Math.Abs((int)(yDiff));
                var swipeDirection = SwipeDirection.NONE;

                if (xDiffAbs >= yDiffAbs)
                {
                    if (xDiffAbs > _swipeThresholdDistance)
                    {
                        swipeDirection = xDiff >= 0 ? SwipeDirection.RIGHT : SwipeDirection.LEFT;
                    }
                }
                else
                {
                    if (yDiffAbs > _swipeThresholdDistance)
                    {
                        swipeDirection = yDiff >= 0 ? SwipeDirection.UP : SwipeDirection.DOWN;
                    }
                }

                if (swipeDirection != SwipeDirection.NONE)
                {
                    _gestureType = GestureType.SWIPE;
                    OnSwipeing?.Invoke(swipeDirection);
                }
                _swipeDirection = swipeDirection;
            };

            OnTouchEnded = (touch, ccEvent) =>
            {
                if (_gestureType == GestureType.SWIPE)
                {
                    OnSwipeEnded?.Invoke(_swipeDirection);
                    _swipeDirection = SwipeDirection.NONE;
                }
                else
                if (_gestureType == GestureType.NONE)
                {
                    OnTap?.Invoke(touch.Delta);
                }
                else if (_gestureType == GestureType.LONG_TAP)
                {
                    OnLongTapEnded.Invoke(touch.Delta);
                }

                //Director::getInstance()->getScheduler()->
                //    unschedule(schedule_selector(EventListenerGesture::_updateInTouch), this);
                _gestureType = GestureType.NONE;
                _isTouched   = false;
            };

            return(true);
        }
Exemple #26
0
 public void toggleUIStuff()
 {
     OnTap.toggleUIElements(false);
 }
Exemple #27
0
        public void Update(GameTime gameTime)
        {
            touchCollection = TouchPanel.GetState();
            while (TouchPanel.IsGestureAvailable)
            {
                gesture = TouchPanel.ReadGesture();
                switch (gesture.GestureType)
                {
                case GestureType.Flick:
                {
                    if (gesture.Delta.X > 0 && gesture.Delta.Y > 0)        //topright
                    {
                        if (gesture.Delta.X < gesture.Delta.Y)
                        {
                            OnFlickDown?.Invoke(gesture, null);
                        }
                        else
                        {
                            OnFlickRight?.Invoke(gesture, null);
                        }
                    }
                    else if (gesture.Delta.X > 0 && gesture.Delta.Y < 0)        //bottomright
                    {
                        if (gesture.Delta.X < -gesture.Delta.Y)
                        {
                            OnFlickUp?.Invoke(gesture, null);
                        }
                        else
                        {
                            OnFlickRight?.Invoke(gesture, null);
                        }
                    }
                    else if (gesture.Delta.X < 0 && gesture.Delta.Y < 0)        //bottomleft
                    {
                        if (-gesture.Delta.X < -gesture.Delta.Y)
                        {
                            OnFlickUp?.Invoke(gesture, null);
                        }
                        else
                        {
                            OnFlickLeft?.Invoke(gesture, null);
                        }
                    }
                    else if (gesture.Delta.X < 0 && gesture.Delta.Y > 0)        //topleft
                    {
                        if (-gesture.Delta.X < gesture.Delta.Y)
                        {
                            OnFlickDown?.Invoke(gesture, null);
                        }
                        else
                        {
                            OnFlickLeft?.Invoke(gesture, null);
                        }
                    }
                    break;
                }

                case GestureType.Tap:
                {
                    if (ScaledResolution != Vector2.Zero)
                    {
                        OnTap?.Invoke(new Vector2(gesture.Position.X / TouchPanel.DisplayWidth * ScaledResolution.X, gesture.Position.Y / TouchPanel.DisplayHeight * ScaledResolution.Y), null);
                    }

                    break;
                }
                }
            }
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                OnBackButtonClicked?.Invoke(this, null);
            }
        }
Exemple #28
0
        private void CalibrationWindow_TapEvent(object sender)
        {
            // Remove the window event so we don't keep starting
            // when we touch the first cross hair
            TapEvent -= new OnTap(CalibrationWindow_TapEvent);

            Start();
        }
        public override bool OnSingleTapUp(MotionEvent e)
        {
            OnTap?.Invoke(this, null);

            return(base.OnSingleTapUp(e));
        }
Exemple #30
0
        /// <summary>
        /// Creates a new CalibrationWindow.
        /// </summary>
        /// <param name="autoStart">Whether or not to automatically begin calibration.</param>
        /// <param name="autoSave">Whether or not to save the calibration settings using Extended Weak Reference.</param>
        public CalibrationWindow(bool autoStart, bool autoSave)
        {
            _autoStart = autoStart;
            _autoSave = autoSave;

            Settings = new CalibrationSettings();

            Name = "calibrationWindow";
            Width = Glide.LCD.Width;
            Height = Glide.LCD.Height;
            BackColor = Colors.White;
            Graphics = new Graphics(Width, Height);

            int yPos = (Height / 2) - 50;

            _text1 = new TextBlock("text1", 255, (Glide.LCD.Width - 300) / 2, yPos, 300, 50);
            _text1.Font = FontManager.GetFont(FontManager.FontType.droid_reg12);
            _text1.TextAlign = HorizontalAlignment.Center;
            AddChild(_text1);

            yPos += 50 + 5;

            _startBtn = new Button("startBtn", 255, (Width - 200) / 2, yPos, 122, 32);
            _startBtn.Text = "Recalibrate";
            _startBtn.TapEvent += new OnTap(_startBtn_TapEvent);
            _startBtn.Visible = false;
            AddChild(_startBtn);

            _exitBtn = new Button("exitBtn", 255, _startBtn.X + _startBtn.Width + 10, yPos, 68, 32);
            _exitBtn.Text = "Done";
            _exitBtn.TapEvent += new OnTap(_exitBtn_TapEvent);
            _exitBtn.Visible = false;
            AddChild(_exitBtn);

            _canvas = new Canvas();
            AddChild(_canvas);

            if (_autoStart)
            {
                _text1.FontColor = Colors.Black;
                _text1.Text = "Touch the crosshair location.";
                Start();
            }
            else
            {
                if (GlideTouch.Calibrated)
                {
                    _text1.FontColor = Colors.Red;
                    _text1.Text = "Touch is already calibrated.";

                    _exitBtn.Visible = true;
                    _startBtn.Visible = true;
                }
                else
                {
                    _text1.FontColor = Colors.Black;
                    _text1.Text = "Touch the screen to start.";

                    TapEvent += new OnTap(CalibrationWindow_TapEvent);
                }
            }
        }
Exemple #31
0
    public void DoUpdate()
    {
        if (Input.touchCount == 1)         // user is touching the screen with a single touch
        {
            var touch = Input.GetTouch(0); // get the touch
            switch (touch.phase)
            {
            //check for the first touch
            case TouchPhase.Began:
                _fp = touch.position;
                _lp = touch.position;
                break;

            // update the last position based on where they moved
            case TouchPhase.Moved:
                _lp = touch.position;
                break;

            //check if the finger is removed from the screen
            case TouchPhase.Ended:
            {
                _lp = touch.position;                         //last touch position. Ommitted if you use list

                //Check if drag distance is greater than 20% of the screen height
                if (Mathf.Abs(_lp.x - _fp.x) > _dragDistance || Mathf.Abs(_lp.y - _fp.y) > _dragDistance)
                {
                    //It's a drag
                    //check if the drag is vertical or horizontal
                    if (Mathf.Abs(_lp.x - _fp.x) > Mathf.Abs(_lp.y - _fp.y))
                    {
                        //If the horizontal movement is greater than the vertical movement...
                        if ((_lp.x > _fp.x))                                 //If the movement was to the right)
                        {
                            //Right swipe
                            OnSwipeRight?.Invoke();
                        }
                        else
                        {
                            OnSwipeLeft?.Invoke();
                            //Left swipe
                        }
                    }
                    else
                    {
                        //the vertical movement is greater than the horizontal movement
                        if (_lp.y > _fp.y)                                 //If the movement was up
                        {
                            //Up swipe
                            OnSwipeUP?.Invoke();
                        }
                        else
                        {
                            OnSwipeDown?.Invoke();
                            //Down swipe
                        }
                    }
                }
                else
                {
                    OnTap?.Invoke();
                    //It's a tap as the drag distance is less than 20% of the screen height
                    Debug.Log("Tap");
                }

                break;
            }
            }
        }
    }
Exemple #32
0
        private void UpdateTouches()
        {
            if (input == null || input.TouchCount() == 0)
            {
                return;
            }
            if (input.TouchCount() == 1)
            {
                TouchInfo touchInfo = input.GetTouch(0);
                if (currentTouch.GestureType == GestureType.None)
                {
                    actionStartTime = Time.realtimeSinceStartup;
                }
                touchInfo.StartTime = actionStartTime;
                if (touchInfo.Phase == TouchPhase.Began)
                {
                    Touch touch = new Touch
                    {
                        TouchInfo      = touchInfo,
                        GestureType    = GestureType.None,
                        SwipeDirection = SwipeDirection.None,
                        SwipeLength    = 0,
                        SwipeVector    = Vector2.zero
                    };
                    currentTouch = touch;
                    OnTouchStart?.Invoke(touch);
                }
                if (touchInfo.Phase == TouchPhase.Moved)
                {
                    OnTouch?.Invoke(new Touch
                    {
                        TouchInfo   = touchInfo,
                        GestureType = GestureType.None,
                    });
                    if (touchInfo.PositionDelta.magnitude >= settings.GetSwipeLengthInPixels())
                    {
                        Touch touch = new Touch
                        {
                            TouchInfo      = touchInfo,
                            GestureType    = GestureType.Swipe,
                            SwipeDirection = GetSwipeDirection(touchInfo.Position - touchInfo.PositionDelta, touchInfo.Position),
                            SwipeLength    = touchInfo.PositionDelta.magnitude,
                            SwipeVector    = touchInfo.PositionDelta
                        };
                        switch (currentTouch.GestureType)
                        {
                        case GestureType.None:
                            OnSwipeStart?.Invoke(touch);
                            break;

                        case GestureType.Swipe:
                            OnSwipe?.Invoke(touch);
                            break;
                        }
                        currentTouch = touch;
                        return;
                    }
                }

                if (touchInfo.Phase == TouchPhase.Stationary)
                {
                    OnTouch?.Invoke(new Touch
                    {
                        TouchInfo   = touchInfo,
                        GestureType = GestureType.None,
                    });
                    touchInfo.ActionTime = Time.realtimeSinceStartup - touchInfo.StartTime;
                    currentTouch         = new Touch
                    {
                        TouchInfo      = touchInfo,
                        GestureType    = GestureType.Tap,
                        SwipeDirection = SwipeDirection.None,
                        SwipeLength    = 0,
                        SwipeVector    = Vector2.zero
                    };
                }
                if (touchInfo.Phase == TouchPhase.Ended)
                {
                    OnTouchEnd?.Invoke(new Touch
                    {
                        TouchInfo   = touchInfo,
                        GestureType = GestureType.None,
                    });
                    switch (currentTouch.GestureType)
                    {
                    case GestureType.Swipe:
                        OnSwipeEnd?.Invoke(currentTouch);
                        break;

                    case GestureType.Tap when currentTouch.TouchInfo.ActionTime <= settings.TapTime:
                        OnTap?.Invoke(currentTouch);
                        break;
                    }
                }
            }
            if (input.TouchCount() == 2)
            {
                TouchInfo touch0 = input.GetTouch(0);
                TouchInfo touch1 = input.GetTouch(1);
                if (currentTouch.GestureType == GestureType.None)
                {
                    actionStartTime = Time.realtimeSinceStartup;
                }
                touch0.StartTime = actionStartTime;
                if (touch0.Phase == TouchPhase.Began || touch1.Phase == TouchPhase.Began)
                {
                    Pinch pinch = new Pinch
                    {
                        TouchInfos  = new [] { touch0, touch1 },
                        GestureType = GestureType.None,
                        PinchVector = touch0.Position - touch1.Position
                    };
                    currentPinch = pinch;
                    OnPinchStart?.Invoke(currentPinch);
                }
                if (touch0.Phase != TouchPhase.Stationary ||
                    touch0.Phase == TouchPhase.Moved ||
                    touch1.Phase != TouchPhase.Stationary ||
                    touch1.Phase == TouchPhase.Moved)
                {
                    Pinch pinch = new Pinch
                    {
                        TouchInfos  = new [] { touch0, touch1 },
                        GestureType = GestureType.Pinch,
                        PinchVector = touch0.Position - touch1.Position
                    };
                    currentPinch = pinch;
                    OnPinch?.Invoke(currentPinch);
                }
                if (touch0.Phase == TouchPhase.Ended || touch1.Phase == TouchPhase.Ended)
                {
                    Pinch pinch = new Pinch
                    {
                        TouchInfos  = new [] { touch0, touch1 },
                        GestureType = GestureType.Pinch,
                        PinchVector = touch0.Position - touch1.Position
                    };
                    currentPinch = pinch;
                    OnPinchEnd?.Invoke(currentPinch);
                }
            }
        }