Exemplo n.º 1
0
    private void SwipeEnd(Vector2 startPos, Vector2 endPos, float timeStartSwipe, int index, bool isMouse)
    {
        if (onlyFireWhenLiftCursor)
        {
            if (!isMouse)
            {
                for (int i = 0; i < Input.touchCount; i++)
                {
                    Touch touch = Input.touches[i];
                    if (touch.fingerId == index)
                    {
                        return;
                    }
                }
            }
            else if (mouseIndex.Contains(index) || Time.realtimeSinceStartup - timeStartSwipe > maxSwipeDuration)
            {
                return;
            }
        }
        Vector2   dir = endPos - startPos;
        SwipeInfo sw  = new SwipeInfo(startPos, endPos, dir, timeStartSwipe, index, isMouse);

        IT_Gesture.SwipeEnd(sw);
        if (!(dir.magnitude < minDistance * IT_Gesture.GetDPIFactor()) && !(Time.time - lastSwipeTime < minDurationBetweenSwipe))
        {
            lastSwipeTime = Time.time;
            IT_Gesture.Swipe(sw);
        }
    }
Exemplo n.º 2
0
 //called when pinch is detected
 void OnPinch(PinchInfo pinfo)
 {
     if (!ImageTarget.gameObject.activeInHierarchy)
     {
         return;
     }
     zoomSpeed -= pinfo.magnitude * zoomSpeedModifier / IT_Gesture.GetDPIFactor();
 }
 //called when one finger drag are detected
 void OnDragging(DragInfo dragInfo)
 {
     //apply the DPI scaling
     dragInfo.delta /= IT_Gesture.GetDPIFactor();
     //vertical movement is corresponded to rotation in x-axis
     orbitSpeedX = -dragInfo.delta.y * rotXSpeedModifier;
     //horizontal movement is corresponded to rotation in y-axis
     orbitSpeedY = dragInfo.delta.x * rotYSpeedModifier;
 }
Exemplo n.º 4
0
    void SwipeEnd(Vector2 startPos, Vector2 endPos, float timeStartSwipe, int index, bool isMouse)
    {
        if (onlyFireWhenLiftCursor)
        {
            if (!isMouse)
            {
                for (int i = 0; i < Input.touchCount; i++)
                {
                    Touch touch = Input.touches[i];
                    if (touch.fingerId == index)
                    {
                        return;
                    }
                }
            }
            else
            {
                if (mouseIndex.Contains(index))
                {
                    //Debug.Log("mouse still down");
                    return;
                }
                if (Time.realtimeSinceStartup - timeStartSwipe > maxSwipeDuration)
                {
                    //Debug.Log("too long   "+(Time.realtimeSinceStartup-timeStartSwipe));
                    return;
                }
            }
        }



        Vector2   swipeDir = endPos - startPos;
        SwipeInfo sw       = new SwipeInfo(startPos, endPos, swipeDir, timeStartSwipe, index, isMouse);

        IT_Gesture.SwipeEnd(sw);

        if ((swipeDir).magnitude < minDistance * IT_Gesture.GetDPIFactor())
        {
            //GameMessage.DisplayMessage("too short");
            return;
        }

        if (Time.time - lastSwipeTime < minDurationBetweenSwipe)
        {
            return;
        }
        lastSwipeTime = Time.time;

        IT_Gesture.Swipe(sw);

        //GameMessage.DisplayMessage("swiped");
    }
Exemplo n.º 5
0
 //called when one finger drag are detected
 void OnDragging(DragInfo dragInfo)
 {
     if (!ImageTarget.gameObject.activeInHierarchy)
     {
         return;
     }
     //apply the DPI scaling
     dragInfo.delta /= IT_Gesture.GetDPIFactor();
     //vertical movement is corresponded to rotation in x-axis
     panSpeedY = dragInfo.delta.y * PanxSpeedModifier;
     //horizontal movement is corresponded to rotation in y-axis
     panSpeedX = dragInfo.delta.x * PanySpeedModifier;
 }
Exemplo n.º 6
0
 public Vector2 GetMoveDirection(Vector2 delta)
 {
     //x方向
     if (Mathf.Abs(delta.x) > Mathf.Abs(delta.y))
     {
         delta *= IT_Gesture.GetDPIFactor();
         return(new Vector2(GetSignFromFrontMode() * delta.x, 0));
     }
     //y方向
     else
     {
         delta *= IT_Gesture.GetDPIFactor();
         return(new Vector3(0, GetSignFromFrontMode() * delta.y));
     }
 }
Exemplo n.º 7
0
    void OnSwipe(SwipeInfo sw)
    {
        Debug.Log("swipe");

        //position the projectile object at the start point of the swipe
        Vector3 p = Camera.main.ScreenToWorldPoint(new Vector3(sw.startPoint.x, sw.startPoint.y, 35));

        projectileObject.position = p;

        //clear the projectile current velocity before apply a new force in the swipe direction, take account of the swipe speed
        body.velocity = new Vector3(0, 0, 0);
        float speed = Mathf.Min(sw.speed * 0.0035f / IT_Gesture.GetDPIFactor(), 15);

        //apply the DPI scaling
        sw.direction /= IT_Gesture.GetDPIFactor();
        body.AddForce(new Vector3(sw.direction.x, 0, sw.direction.y) * speed);

        //show the swipe info
        string labelText = "Swipe Detected, ";

        if (sw.isMouse)
        {
            labelText += "mouse " + sw.index.ToString() + "\n\n";
        }
        else
        {
            labelText += "finger " + sw.index.ToString() + "\n\n";
        }

        //labelText+="\n\n";
        labelText += "direction: " + sw.direction + "\n";
        labelText += "angle: " + sw.angle.ToString("f1") + "\n";
        labelText += "speed: " + sw.speed.ToString("f1") + "\n";
        label.text = labelText;

        //if the label is previous cleared, re-initiate the coroutine to clear it
        if (labelTimer < 0)
        {
            StartCoroutine(ClearLabel());
        }
        //else just extend the timer
        else
        {
            labelTimer = 5;
        }

        StartCoroutine(ShowSwipeIndicator(sw));
    }
Exemplo n.º 8
0
    private IEnumerator MouseRoutine(int index)
    {
        mouseIndex.Add(index);
        bool    dragStarted = false;
        Vector2 startPos    = Input.mousePosition;
        Vector2 lastPos     = startPos;
        float   timeStart   = float.PositiveInfinity;

        while (mouseIndex.Contains(index))
        {
            Vector2 curPos = Input.mousePosition;
            if (!dragStarted)
            {
                if (Vector3.Distance(curPos, startPos) > (float)minDragDistance * IT_Gesture.GetDPIFactor())
                {
                    dragStarted = true;
                    Vector2  delta2    = curPos - startPos;
                    DragInfo dragInfo3 = new DragInfo(curPos, delta2, 1, index, im: true);
                    IT_Gesture.DraggingStart(dragInfo3);
                    timeStart = Time.realtimeSinceStartup;
                }
            }
            else if (curPos != lastPos)
            {
                Vector2  delta     = curPos - lastPos;
                DragInfo dragInfo2 = new DragInfo(curPos, delta, 1, index, im: true);
                IT_Gesture.Dragging(dragInfo2);
            }
            else if (fireOnDraggingWhenNotMoving)
            {
                DragInfo dragInfo = new DragInfo(curPos, Vector2.zero, 1, index, im: true);
                IT_Gesture.Dragging(dragInfo);
            }
            lastPos = curPos;
            yield return(null);
        }
        if (dragStarted)
        {
            bool isFlick = false;
            if (Time.realtimeSinceStartup - timeStart < flickTimeRange)
            {
                isFlick = true;
            }
            Vector2  delta3    = lastPos - startPos;
            DragInfo dragInfo4 = new DragInfo(lastPos, delta3, 1, index, isFlick, im: true);
            IT_Gesture.DraggingEnd(dragInfo4);
        }
    }
Exemplo n.º 9
0
    //when a valide swipe is confirm
    void OnSwipe(SwipeInfo sw)
    {
        Ray        ray = Camera.main.ScreenPointToRay(sw.startPoint);
        RaycastHit hit;

        //use raycast at the cursor position to detect the object
        if (Physics.Raycast(ray, out hit, Mathf.Infinity))
        {
            //only if the swipe is started from the source(turret) location
            if (hit.transform == source)
            {
                //instatiate a new shootObject
                GameObject shootObjInstance = (GameObject)Instantiate(shootObject, source.TransformPoint(new Vector3(0, 0.5f, 0.5f)), Quaternion.identity);

                //if using siwpe magnitude as force determining factor
                if (forceFactor == 0)
                {
                    //apply the DPI scaling
                    sw.direction /= IT_Gesture.GetDPIFactor();
                    //calculate the force, clamp the value between 50 and 2200 so that it's not too slow or too fast that the shootObject is not visible
                    float force = Mathf.Clamp(sw.direction.magnitude * forceModifier * 1.5f / IT_Gesture.GetDPIFactor(), 50, 2200);
                    //normalize the direction
                    sw.direction.Normalize();
                    //apply the force according to the direction
                    Rigidbody rigidbody = shootObjInstance.GetComponent <Rigidbody>();
                    rigidbody.AddForce(new Vector3(sw.direction.x, sw.direction.y, 0) * force);
                }
                //if using siwpe speed as force determining factor
                else if (forceFactor == 1)
                {
                    //apply the DPI scaling
                    sw.direction /= IT_Gesture.GetDPIFactor();
                    //calculate the force, clamp the value between 50 and 2200 so that it's not too slow or too fast that the shootObject is not visible
                    float force = Mathf.Clamp(sw.speed * forceModifier * 1f / IT_Gesture.GetDPIFactor(), 50, 2200);
                    //normalize the direction
                    sw.direction.Normalize();
                    //apply the force according to the direction
                    Rigidbody rigidbody = shootObjInstance.GetComponent <Rigidbody>();
                    rigidbody.AddForce(new Vector3(sw.direction.x, sw.direction.y, 0) * force);
                }

                //make sure the shootObject is destroy after 3 second
                Destroy(shootObjInstance, 3);
            }
        }
    }
Exemplo n.º 10
0
    //called when a dual finger or a right mouse drag is detected
    void OnMFDragging(DragInfo dragInfo)
    {
        //apply the DPI scaling
        dragInfo.delta /= IT_Gesture.GetDPIFactor();

        //make a new direction, pointing horizontally at the direction of the camera y-rotation
        Quaternion direction = Quaternion.Euler(0, transform.parent.rotation.eulerAngles.y, 0);

        //calculate forward movement based on vertical input
        Vector3 moveDirZ = transform.parent.InverseTransformDirection(direction * Vector3.forward * -dragInfo.delta.y);
        //calculate sideway movement base on horizontal input
        Vector3 moveDirX = transform.parent.InverseTransformDirection(direction * Vector3.right * -dragInfo.delta.x);

        //move the cmera
        transform.parent.Translate(moveDirZ * panSpeedModifier * Time.deltaTime);
        transform.parent.Translate(moveDirX * panSpeedModifier * Time.deltaTime);
    }
Exemplo n.º 11
0
        //ドラッグでカメラ移動
        void OnDraggingInActionModeForCameraMove(DragInfo dragInfo)
        {
            if (nowCameraState != CameraState.Back)
            {
                return;
            }
            if (activeCharacter.IsNowAction() == true)
            {
                return;
            }
            var delta = dragInfo.delta * IT_Gesture.GetDPIFactor();

            transform.position -= new Vector3(GetSignFromFrontMode() * delta.x, 0, GetSignFromFrontMode() * delta.y);
            ClampOnFromFront();
            isMoved = true;
            MoveCamera();
        }
Exemplo n.º 12
0
 //called when one finger drag are detected
 void OnDragging(DragInfo dragInfo)
 {
     //if the drag is perform using mouse2, use it as a two finger drag
     if (dragInfo.isMouse && dragInfo.index == 1)
     {
         OnMFDragging(dragInfo);
     }
     //else perform normal orbiting
     else
     {
         //apply the DPI scaling
         dragInfo.delta /= IT_Gesture.GetDPIFactor();
         //vertical movement is corresponded to rotation in x-axis
         orbitSpeedX = -dragInfo.delta.y * rotXSpeedModifier;
         //horizontal movement is corresponded to rotation in y-axis
         orbitSpeedY = dragInfo.delta.x * rotYSpeedModifier;
     }
 }
Exemplo n.º 13
0
    //rotate the object instead

    /*
     * void Update(){
     *      Vector3 orbitS=new Vector3(orbitSpeed.y, -orbitSpeed.x, 0);
     *      transform.Rotate(orbitS, Space.World);
     *
     *      //slow down all the speed
     *      orbitSpeed*=(1-Time.deltaTime*3);
     *      rotateSpeed*=(1-Time.deltaTime*4f);
     *      zoomSpeed*=(1-Time.deltaTime*4);
     * }
     */

    void OnDragging(DragInfo dragInfo)
    {
        orbitSpeed = dragInfo.delta * orbitSpeedModifier / IT_Gesture.GetDPIFactor();
    }
Exemplo n.º 14
0
 void OnRotate(RotateInfo rinfo)
 {
     rotateSpeed = Mathf.Lerp(rotateSpeed, rinfo.magnitude * rotateSpeedModifier / IT_Gesture.GetDPIFactor(), 0.75f);
 }
Exemplo n.º 15
0
    void CheckFingerGroup(Touch touch)
    {
        //Debug.Log("Checking "+Time.realtimeSinceStartup);
        bool match = false;

        //foreach(FingerGroup group in fingerGroup){
        for (int i = 0; i < fingerGroup.Count; i++)
        {
            FingerGroup group = fingerGroup[i];
            if (Time.realtimeSinceStartup - group.triggerTime < shortTapTime / 2)
            {
                bool  inRange = true;
                float dist    = 0;
                //foreach(int index in group.indexes){
                for (int j = 0; j < group.indexes.Count; j++)
                {
                    int index = group.indexes[j];
                    dist = Vector2.Distance(IT_Gesture.GetTouch(index).position, touch.position);
                    if (Vector2.Distance(IT_Gesture.GetTouch(index).position, touch.position) > maxFingerGroupDist * IT_Gesture.GetDPIFactor())
                    {
                        inRange = false;
                    }
                }
                if (inRange)
                {
                    group.indexes.Add(touch.fingerId);
                    group.positions.Add(touch.position);
                    match = true;
                    break;
                }
            }
        }

        if (!match)
        {
            fingerGroup.Add(new FingerGroup(Time.realtimeSinceStartup, touch.fingerId, touch.position));
            StartCoroutine(fingerGroup[fingerGroup.Count - 1].Routine(this));
        }
    }
Exemplo n.º 16
0
    IEnumerator FingerRoutine(int index)
    {
        fingerIndex.Add(index);

        //init tap variables
        Touch   touch     = IT_Gesture.GetTouch(index);
        float   startTime = Time.realtimeSinceStartup;
        Vector2 startPos  = touch.position;
        Vector2 lastPos   = startPos;
        bool    longTap   = false;

        //init charge variables
        _ChargeState chargeState     = _ChargeState.Clear;
        int          chargeDir       = 1;
        int          chargeConst     = 0;
        float        startTimeCharge = Time.realtimeSinceStartup;
        Vector2      startPosCharge  = touch.position;

        //yield return null;

        bool inGroup = false;

        while (true)
        {
            touch = IT_Gesture.GetTouch(index);
            if (touch.position == Vector2.zero)
            {
                break;
            }

            Vector2 curPos = touch.position;

            if (Time.realtimeSinceStartup - startTimeCharge > minChargeTime && chargeState == _ChargeState.Clear)
            {
                chargeState = _ChargeState.Charging;
                float       chargedValue = Mathf.Clamp(chargeConst + chargeDir * ((Time.realtimeSinceStartup - startTimeCharge) / maxChargeTime), 0, 1);
                ChargedInfo cInfo        = new ChargedInfo(curPos, chargedValue, index, false);
                IT_Gesture.ChargeStart(cInfo);

                startPosCharge = curPos;
            }
            else if (chargeState == _ChargeState.Charging)
            {
                if (Vector3.Distance(curPos, startPosCharge) > tapPosDeviation)
                {
                    chargeState = _ChargeState.Clear;
                    float       chargedValue = Mathf.Clamp(chargeConst + chargeDir * ((Time.realtimeSinceStartup - startTimeCharge) / maxChargeTime), 0, 1);
                    ChargedInfo cInfo        = new ChargedInfo(lastPos, chargedValue, index, false);
                    IT_Gesture.ChargeEnd(cInfo);
                }
                else
                {
                    float       chargedValue = Mathf.Clamp(chargeConst + chargeDir * ((Time.realtimeSinceStartup - startTimeCharge) / maxChargeTime), 0, 1);
                    ChargedInfo cInfo        = new ChargedInfo(curPos, chargedValue, index, false);

                    if (chargeMode == _ChargeMode.PingPong)
                    {
                        if (chargedValue == 1 || chargedValue == 0)
                        {
                            chargeDir *= -1;
                            if (chargeDir == 1)
                            {
                                chargeConst = 0;
                            }
                            else if (chargeDir == -1)
                            {
                                chargeConst = 1;
                            }
                            startTimeCharge = Time.realtimeSinceStartup;
                        }

                        IT_Gesture.Charging(cInfo);
                    }
                    else
                    {
                        if (chargedValue < 1.0f)
                        {
                            IT_Gesture.Charging(cInfo);
                        }
                        else
                        {
                            cInfo.percent = 1.0f;

                            if (chargeMode == _ChargeMode.Once)
                            {
                                chargeState = _ChargeState.Charged;
                                IT_Gesture.ChargeEnd(cInfo);
                                startTimeCharge = Mathf.Infinity;
                                chargedValue    = 0;
                            }
                            else if (chargeMode == _ChargeMode.Clamp)
                            {
                                chargeState = _ChargeState.Charged;
                                IT_Gesture.Charging(cInfo);
                            }
                            else if (chargeMode == _ChargeMode.Loop)
                            {
                                chargeState = _ChargeState.Clear;
                                IT_Gesture.ChargeEnd(cInfo);
                                startTimeCharge = Time.realtimeSinceStartup;
                            }
                        }
                    }
                }
            }

            if (!longTap && Time.realtimeSinceStartup - startTime > longTapTime && Vector2.Distance(lastPos, startPos) < maxTapDisplacementAllowance * IT_Gesture.GetDPIFactor())
            {
                //new Tap(multiTapMFTouch[index].count, fCount, posL)
                //IT_Gesture.LongTap(new Tap(multiTapMFTouch[index].count, fCount, posL));
                IT_Gesture.LongTap(new Tap(curPos, 1, index, false));
                //IT_Gesture.LongTap(startPos);
                longTap = true;
            }

            lastPos = curPos;

            if (!inGroup)
            {
                inGroup = IndexInFingerGroup(index);
            }

            yield return(null);
        }

        //check for shortTap
        if (!inGroup)
        {
            if (Time.realtimeSinceStartup - startTime <= shortTapTime && Vector2.Distance(lastPos, startPos) < maxTapDisplacementAllowance * IT_Gesture.GetDPIFactor())
            {
                CheckMultiTapTouch(index, startPos, lastPos);
            }
        }

        //check for charge
        if (chargeState == _ChargeState.Charging || (chargeState == _ChargeState.Charged && chargeMode != _ChargeMode.Once))
        {
            float       chargedValue = Mathf.Clamp(chargeConst + chargeDir * ((Time.realtimeSinceStartup - startTimeCharge) / maxChargeTime), 0, 1);
            ChargedInfo cInfo        = new ChargedInfo(lastPos, chargedValue, index, false);
            IT_Gesture.ChargeEnd(cInfo);
        }

        fingerIndex.Remove(index);
    }
Exemplo n.º 17
0
    IEnumerator MouseRoutine(int index)
    {
        mouseIndex.Add(index);

        //init tap variables
        float   startTime = Time.realtimeSinceStartup;
        Vector2 startPos  = Input.mousePosition;
        Vector2 lastPos   = startPos;
        bool    longTap   = false;

        //init charge variables
        _ChargeState chargeState     = _ChargeState.Clear;
        int          chargeDir       = 1;
        float        chargeConst     = 0;
        float        startTimeCharge = Time.realtimeSinceStartup;
        Vector2      startPosCharge  = Input.mousePosition;

        yield return(null);

        while (mouseIndex.Contains(index))
        {
            Vector2 curPos = Input.mousePosition;

            if (Time.realtimeSinceStartup - startTimeCharge > minChargeTime && chargeState == _ChargeState.Clear)
            {
                chargeState = _ChargeState.Charging;
                float       chargedValue = Mathf.Clamp(chargeConst + chargeDir * ((Time.realtimeSinceStartup - startTimeCharge) / maxChargeTime), 0, 1);
                ChargedInfo cInfo        = new ChargedInfo(curPos, chargedValue, index, true);
                IT_Gesture.ChargeStart(cInfo);

                startPosCharge = curPos;
            }
            else if (chargeState == _ChargeState.Charging)
            {
                if (Vector3.Distance(curPos, startPosCharge) > tapPosDeviation)
                {
                    chargeState = _ChargeState.Clear;
                    float       chargedValue = Mathf.Clamp(chargeConst + chargeDir * ((Time.realtimeSinceStartup - startTimeCharge) / maxChargeTime), 0, 1);
                    ChargedInfo cInfo        = new ChargedInfo(lastPos, chargedValue, index, true);
                    IT_Gesture.ChargeEnd(cInfo);
                }
                else
                {
                    float       chargedValue = Mathf.Clamp(chargeConst + chargeDir * ((Time.realtimeSinceStartup - startTimeCharge) / maxChargeTime), 0, 1);
                    ChargedInfo cInfo        = new ChargedInfo(curPos, chargedValue, index, true);

                    if (chargeMode == _ChargeMode.PingPong)
                    {
                        if (chargedValue == 1 || chargedValue == 0)
                        {
                            chargeDir *= -1;
                            if (chargeDir == 1)
                            {
                                chargeConst = 0;
                            }
                            else if (chargeDir == -1)
                            {
                                chargeConst = 1;
                            }
                            startTimeCharge = Time.realtimeSinceStartup;
                        }
                        IT_Gesture.Charging(cInfo);
                    }
                    else
                    {
                        if (chargedValue < 1.0f)
                        {
                            IT_Gesture.Charging(cInfo);
                        }
                        else
                        {
                            cInfo.percent = 1.0f;

                            if (chargeMode == _ChargeMode.Once)
                            {
                                chargeState = _ChargeState.Charged;
                                IT_Gesture.ChargeEnd(cInfo);
                                startTimeCharge = Mathf.Infinity;
                                chargedValue    = 0;
                            }
                            else if (chargeMode == _ChargeMode.Clamp)
                            {
                                chargeState = _ChargeState.Charged;
                                IT_Gesture.Charging(cInfo);
                            }
                            else if (chargeMode == _ChargeMode.Loop)
                            {
                                chargeState = _ChargeState.Clear;
                                IT_Gesture.ChargeEnd(cInfo);
                                startTimeCharge = Time.realtimeSinceStartup;
                            }
                        }
                    }
                }
            }

            if (!longTap && Time.realtimeSinceStartup - startTime > longTapTime && Vector2.Distance(lastPos, startPos) < maxTapDisplacementAllowance * IT_Gesture.GetDPIFactor())
            {
                IT_Gesture.LongTap(new Tap(curPos, 1, index, true));
                longTap = true;
            }

            lastPos = curPos;

            yield return(null);
        }

        //check for shortTap
        if (Time.realtimeSinceStartup - startTime <= shortTapTime && Vector2.Distance(lastPos, startPos) < maxTapDisplacementAllowance * IT_Gesture.GetDPIFactor())
        {
            //IT_Gesture.ShortTap(startPos);
            CheckMultiTapMouse(index, startPos, lastPos);
        }

        //check for charge
        if (chargeState == _ChargeState.Charging || (chargeState == _ChargeState.Charged && chargeMode != _ChargeMode.Once))
        {
            float       chargedValue = Mathf.Clamp(chargeConst + chargeDir * ((Time.realtimeSinceStartup - startTimeCharge) / maxChargeTime), 0, 1);
            ChargedInfo cInfo        = new ChargedInfo(lastPos, chargedValue, index, true);
            IT_Gesture.ChargeEnd(cInfo);
        }
    }
Exemplo n.º 18
0
    void CheckMultiTapTouch(int index, Vector2 startPos, Vector2 lastPos)
    {
        if (index >= multiTapTouch.Length)
        {
            return;
        }

        if (multiTapTouch[index].lastTapTime > Time.realtimeSinceStartup - multiTapInterval)
        {
            if (Vector2.Distance(startPos, multiTapTouch[index].lastPos) < multiTapPosSpacing * IT_Gesture.GetDPIFactor())
            {
                multiTapTouch[index].count      += 1;
                multiTapTouch[index].lastPos     = startPos;
                multiTapTouch[index].lastTapTime = Time.realtimeSinceStartup;

                IT_Gesture.MultiTap(new Tap(startPos, lastPos, multiTapTouch[index].count, index, false));

                if (multiTapTouch[index].count >= maxMultiTapCount)
                {
                    multiTapTouch[index].count = 0;
                }
            }
            else
            {
                multiTapTouch[index].count       = 1;
                multiTapTouch[index].lastPos     = startPos;
                multiTapTouch[index].lastTapTime = Time.realtimeSinceStartup;

                IT_Gesture.MultiTap(new Tap(startPos, lastPos, 1, index, false));
            }
        }
        else
        {
            multiTapTouch[index].count       = 1;
            multiTapTouch[index].lastPos     = startPos;
            multiTapTouch[index].lastTapTime = Time.realtimeSinceStartup;

            IT_Gesture.MultiTap(new Tap(startPos, lastPos, 1, index, false));
        }
    }
Exemplo n.º 19
0
    public void CheckMultiTapMFTouch(int fCount, Vector2[] posL, int[] indexes)
    {
        Vector2 pos = Vector2.zero;

        //foreach(Vector2 p in posL){
        //	pos+=p;
        //}
        for (int i = 0; i < posL.Length; i++)
        {
            pos += posL[i];
        }
        pos /= posL.Length;

        int  index = 0;
        bool match = false;

        //foreach(MultiTapTracker multiTap in multiTapMFTouch){
        for (int i = 0; i < multiTapMFTouch.Length; i++)
        {
            MultiTapTracker multiTap = multiTapMFTouch[i];
            if (multiTap.fingerCount == fCount)
            {
                if (Vector2.Distance(pos, multiTap.lastPos) < multiTapPosSpacing * IT_Gesture.GetDPIFactor())
                {
                    match = true;
                    break;
                }
            }
            index += 1;
        }

        if (!match)
        {
            index = 0;
            //foreach(MultiTapTracker multiTap in multiTapMFTouch){
            for (int i = 0; i < multiTapMFTouch.Length; i++)
            {
                MultiTapTracker multiTap = multiTapMFTouch[i];
                if (multiTap.lastPos == Vector2.zero && multiTap.count == 0)
                {
                    break;
                }
                index += 1;
            }
        }

        if (multiTapMFTouch[index].lastTapTime > Time.realtimeSinceStartup - multiTapInterval)
        {
            multiTapMFTouch[index].count      += 1;
            multiTapMFTouch[index].lastPos     = pos;
            multiTapMFTouch[index].fingerCount = fCount;
            multiTapMFTouch[index].lastTapTime = Time.realtimeSinceStartup;

            IT_Gesture.MultiTap(new Tap(multiTapMFTouch[index].count, fCount, posL, indexes));

            if (multiTapMFTouch[index].count >= maxMultiTapCount)
            {
                multiTapMFTouch[index].count = 0;
            }
        }
        else
        {
            multiTapMFTouch[index].count       = 1;
            multiTapMFTouch[index].lastPos     = pos;
            multiTapMFTouch[index].fingerCount = fCount;
            multiTapMFTouch[index].lastTapTime = Time.realtimeSinceStartup;

            IT_Gesture.MultiTap(new Tap(multiTapMFTouch[index].count, fCount, posL, indexes));
        }
    }
Exemplo n.º 20
0
    private IEnumerator MultiDragRoutine(int count)
    {
        if (count <= 1)
        {
            yield break;
        }
        bool    dragStarted = false;
        Vector2 startPos2   = Vector2.zero;

        for (int k = 0; k < Input.touchCount; k++)
        {
            startPos2 += Input.touches[k].position;
        }
        startPos2 /= Input.touchCount;
        Vector2 lastPos   = startPos2;
        float   timeStart = float.PositiveInfinity;

        while (Input.touchCount == count)
        {
            Vector2   curPos2 = Vector2.zero;
            Vector2[] allPos  = new Vector2[count];
            bool      moving  = true;
            for (int j = 0; j < count; j++)
            {
                Touch touch = Input.touches[j];
                curPos2  += touch.position;
                allPos[j] = touch.position;
                if (touch.phase != TouchPhase.Moved)
                {
                    moving = false;
                }
            }
            curPos2 /= count;
            bool sync = true;
            if (moving)
            {
                for (int i = 0; i < count - 1; i++)
                {
                    Vector2 v3 = Input.touches[i].deltaPosition.normalized;
                    Vector2 v2 = Input.touches[i + 1].deltaPosition.normalized;
                    if (Vector2.Dot(v3, v2) < 0.85f)
                    {
                        sync = false;
                    }
                }
            }
            if (moving && sync)
            {
                if (!dragStarted)
                {
                    if (Vector2.Distance(curPos2, startPos2) > (float)minDragDistance * IT_Gesture.GetDPIFactor())
                    {
                        dragStarted = true;
                        Vector2  delta2    = curPos2 - startPos2;
                        DragInfo dragInfo3 = new DragInfo(curPos2, delta2, count);
                        IT_Gesture.DraggingStart(dragInfo3);
                        timeStart = Time.realtimeSinceStartup;
                    }
                }
                else if (curPos2 != lastPos)
                {
                    Vector2  delta     = curPos2 - lastPos;
                    DragInfo dragInfo2 = new DragInfo(curPos2, delta, count);
                    IT_Gesture.Dragging(dragInfo2);
                }
            }
            else if (dragStarted && fireOnDraggingWhenNotMoving)
            {
                DragInfo dragInfo = new DragInfo(curPos2, Vector2.zero, count);
                IT_Gesture.Dragging(dragInfo);
            }
            lastPos = curPos2;
            yield return(null);
        }
        if (dragStarted)
        {
            bool isFlick = false;
            if (Time.realtimeSinceStartup - timeStart < flickTimeRange)
            {
                isFlick = true;
            }
            Vector2  delta3    = lastPos - startPos2;
            DragInfo dragInfo4 = new DragInfo(lastPos, delta3, count, isFlick);
            IT_Gesture.DraggingEnd(dragInfo4);
        }
    }
Exemplo n.º 21
0
 private void CheckMultiTapMouse(int index, Vector2 startPos, Vector2 lastPos)
 {
     if (multiTapMouse[index].lastTapTime > Time.realtimeSinceStartup - multiTapInterval)
     {
         if (Vector2.Distance(startPos, multiTapMouse[index].lastPos) < multiTapPosSpacing * IT_Gesture.GetDPIFactor())
         {
             multiTapMouse[index].count++;
             multiTapMouse[index].lastPos     = startPos;
             multiTapMouse[index].lastTapTime = Time.realtimeSinceStartup;
             IT_Gesture.MultiTap(new Tap(startPos, lastPos, multiTapMouse[index].count, index, im: true));
             if (multiTapMouse[index].count >= maxMultiTapCount)
             {
                 multiTapMouse[index].count = 0;
             }
         }
         else
         {
             multiTapMouse[index].count       = 1;
             multiTapMouse[index].lastPos     = startPos;
             multiTapMouse[index].lastTapTime = Time.realtimeSinceStartup;
             IT_Gesture.MultiTap(new Tap(startPos, lastPos, 1, index, im: true));
         }
     }
     else
     {
         multiTapMouse[index].count       = 1;
         multiTapMouse[index].lastPos     = startPos;
         multiTapMouse[index].lastTapTime = Time.realtimeSinceStartup;
         IT_Gesture.MultiTap(new Tap(startPos, lastPos, 1, index, im: true));
     }
 }
Exemplo n.º 22
0
    public void CheckMultiTapMFTouch(int fCount, Vector2[] posL, int[] indexes)
    {
        Vector2 a = Vector2.zero;

        for (int i = 0; i < posL.Length; i++)
        {
            a += posL[i];
        }
        a /= posL.Length;
        int  num  = 0;
        bool flag = false;

        for (int j = 0; j < multiTapMFTouch.Length; j++)
        {
            MultiTapTracker multiTapTracker = multiTapMFTouch[j];
            if (multiTapTracker.fingerCount == fCount && Vector2.Distance(a, multiTapTracker.lastPos) < multiTapPosSpacing * IT_Gesture.GetDPIFactor())
            {
                flag = true;
                break;
            }
            num++;
        }
        if (!flag)
        {
            num = 0;
            for (int k = 0; k < multiTapMFTouch.Length; k++)
            {
                MultiTapTracker multiTapTracker2 = multiTapMFTouch[k];
                if (multiTapTracker2.lastPos == Vector2.zero && multiTapTracker2.count == 0)
                {
                    break;
                }
                num++;
            }
        }
        if (multiTapMFTouch[num].lastTapTime > Time.realtimeSinceStartup - multiTapInterval)
        {
            multiTapMFTouch[num].count++;
            multiTapMFTouch[num].lastPos     = a;
            multiTapMFTouch[num].fingerCount = fCount;
            multiTapMFTouch[num].lastTapTime = Time.realtimeSinceStartup;
            IT_Gesture.MultiTap(new Tap(multiTapMFTouch[num].count, fCount, posL, indexes));
            if (multiTapMFTouch[num].count >= maxMultiTapCount)
            {
                multiTapMFTouch[num].count = 0;
            }
        }
        else
        {
            multiTapMFTouch[num].count       = 1;
            multiTapMFTouch[num].lastPos     = a;
            multiTapMFTouch[num].fingerCount = fCount;
            multiTapMFTouch[num].lastTapTime = Time.realtimeSinceStartup;
            IT_Gesture.MultiTap(new Tap(multiTapMFTouch[num].count, fCount, posL, indexes));
        }
    }
Exemplo n.º 23
0
 //called when pinch is detected
 void OnPinch(PinchInfo pinfo)
 {
     zoomSpeed -= pinfo.magnitude * zoomSpeedModifier / IT_Gesture.GetDPIFactor();
 }
Exemplo n.º 24
0
    private void CheckFingerGroup(Touch touch)
    {
        bool flag = false;

        for (int i = 0; i < this.fingerGroup.Count; i++)
        {
            FingerGroup fingerGroup = this.fingerGroup[i];
            if (!(Time.realtimeSinceStartup - fingerGroup.triggerTime < shortTapTime / 2f))
            {
                continue;
            }
            bool flag2 = true;
            for (int j = 0; j < fingerGroup.indexes.Count; j++)
            {
                int iD = fingerGroup.indexes[j];
                if (Vector2.Distance(IT_Gesture.GetTouch(iD).position, touch.position) > maxFingerGroupDist * IT_Gesture.GetDPIFactor())
                {
                    flag2 = false;
                }
            }
            if (flag2)
            {
                fingerGroup.indexes.Add(touch.fingerId);
                fingerGroup.positions.Add(touch.position);
                flag = true;
                break;
            }
        }
        if (!flag)
        {
            this.fingerGroup.Add(new FingerGroup(Time.realtimeSinceStartup, touch.fingerId, touch.position));
            StartCoroutine(this.fingerGroup[this.fingerGroup.Count - 1].Routine(this));
        }
    }
Exemplo n.º 25
0
    private IEnumerator MouseRoutine(int index)
    {
        mouseIndex.Add(index);
        float        startTime       = Time.realtimeSinceStartup;
        Vector2      startPos        = Input.mousePosition;
        Vector2      lastPos         = startPos;
        bool         longTap         = false;
        _ChargeState chargeState     = _ChargeState.Clear;
        int          chargeDir       = 1;
        float        chargeConst     = 0f;
        float        startTimeCharge = Time.realtimeSinceStartup;
        Vector2      startPosCharge  = Input.mousePosition;

        yield return(null);

        while (mouseIndex.Contains(index))
        {
            Vector2 curPos = Input.mousePosition;
            if (Time.realtimeSinceStartup - startTimeCharge > minChargeTime && chargeState == _ChargeState.Clear)
            {
                chargeState = _ChargeState.Charging;
                float       chargedValue3 = Mathf.Clamp(chargeConst + (float)chargeDir * ((Time.realtimeSinceStartup - startTimeCharge) / maxChargeTime), 0f, 1f);
                ChargedInfo cInfo3        = new ChargedInfo(curPos, chargedValue3, index, im: true);
                IT_Gesture.ChargeStart(cInfo3);
                startPosCharge = curPos;
            }
            else if (chargeState == _ChargeState.Charging)
            {
                if (Vector3.Distance(curPos, startPosCharge) > tapPosDeviation)
                {
                    chargeState = _ChargeState.Clear;
                    float       chargedValue2 = Mathf.Clamp(chargeConst + (float)chargeDir * ((Time.realtimeSinceStartup - startTimeCharge) / maxChargeTime), 0f, 1f);
                    ChargedInfo cInfo2        = new ChargedInfo(lastPos, chargedValue2, index, im: true);
                    IT_Gesture.ChargeEnd(cInfo2);
                }
                else
                {
                    float       chargedValue = Mathf.Clamp(chargeConst + (float)chargeDir * ((Time.realtimeSinceStartup - startTimeCharge) / maxChargeTime), 0f, 1f);
                    ChargedInfo cInfo        = new ChargedInfo(curPos, chargedValue, index, im: true);
                    if (chargeMode == _ChargeMode.PingPong)
                    {
                        if (chargedValue == 1f || chargedValue == 0f)
                        {
                            chargeDir *= -1;
                            switch (chargeDir)
                            {
                            case 1:
                                chargeConst = 0f;
                                break;

                            case -1:
                                chargeConst = 1f;
                                break;
                            }
                            startTimeCharge = Time.realtimeSinceStartup;
                        }
                        IT_Gesture.Charging(cInfo);
                    }
                    else if (chargedValue < 1f)
                    {
                        IT_Gesture.Charging(cInfo);
                    }
                    else
                    {
                        cInfo.percent = 1f;
                        if (chargeMode == _ChargeMode.Once)
                        {
                            chargeState = _ChargeState.Charged;
                            IT_Gesture.ChargeEnd(cInfo);
                            startTimeCharge = float.PositiveInfinity;
                        }
                        else if (chargeMode == _ChargeMode.Clamp)
                        {
                            chargeState = _ChargeState.Charged;
                            IT_Gesture.Charging(cInfo);
                        }
                        else if (chargeMode == _ChargeMode.Loop)
                        {
                            chargeState = _ChargeState.Clear;
                            IT_Gesture.ChargeEnd(cInfo);
                            startTimeCharge = Time.realtimeSinceStartup;
                        }
                    }
                }
            }
            if (!longTap && Time.realtimeSinceStartup - startTime > longTapTime && Vector2.Distance(lastPos, startPos) < (float)maxTapDisplacementAllowance * IT_Gesture.GetDPIFactor())
            {
                IT_Gesture.LongTap(new Tap(curPos, 1, index, im: true));
                longTap = true;
            }
            lastPos = curPos;
            yield return(null);
        }
        if (Time.realtimeSinceStartup - startTime <= shortTapTime && Vector2.Distance(lastPos, startPos) < (float)maxTapDisplacementAllowance * IT_Gesture.GetDPIFactor())
        {
            CheckMultiTapMouse(index, startPos, lastPos);
        }
        switch (chargeState)
        {
        default:
            yield break;

        case _ChargeState.Charged:
            if (chargeMode == _ChargeMode.Once)
            {
                yield break;
            }
            break;

        case _ChargeState.Charging:
            break;
        }
        float       chargedValue4 = Mathf.Clamp(chargeConst + (float)chargeDir * ((Time.realtimeSinceStartup - startTimeCharge) / maxChargeTime), 0f, 1f);
        ChargedInfo cInfo4        = new ChargedInfo(lastPos, chargedValue4, index, im: true);

        IT_Gesture.ChargeEnd(cInfo4);
    }
Exemplo n.º 26
0
    private IEnumerator FingerRoutine(int index)
    {
        fingerIndex.Add(index);
        Touch        touch2          = IT_Gesture.GetTouch(index);
        float        startTime       = Time.realtimeSinceStartup;
        Vector2      startPos        = touch2.position;
        Vector2      lastPos         = startPos;
        bool         longTap         = false;
        _ChargeState chargeState     = _ChargeState.Clear;
        int          chargeDir       = 1;
        int          chargeConst     = 0;
        float        startTimeCharge = Time.realtimeSinceStartup;
        Vector2      startPosCharge  = touch2.position;

        while (true)
        {
            touch2 = IT_Gesture.GetTouch(index);
            if (touch2.position == Vector2.zero)
            {
                break;
            }
            Vector2 curPos = touch2.position;
            if (Time.realtimeSinceStartup - startTimeCharge > minChargeTime && chargeState == _ChargeState.Clear)
            {
                chargeState = _ChargeState.Charging;
                float       chargedValue3 = Mathf.Clamp((float)chargeConst + (float)chargeDir * ((Time.realtimeSinceStartup - startTimeCharge) / maxChargeTime), 0f, 1f);
                ChargedInfo cInfo3        = new ChargedInfo(curPos, chargedValue3, index, im: false);
                IT_Gesture.ChargeStart(cInfo3);
                startPosCharge = curPos;
            }
            else if (chargeState == _ChargeState.Charging)
            {
                if (Vector3.Distance(curPos, startPosCharge) > tapPosDeviation)
                {
                    chargeState = _ChargeState.Clear;
                    float       chargedValue2 = Mathf.Clamp((float)chargeConst + (float)chargeDir * ((Time.realtimeSinceStartup - startTimeCharge) / maxChargeTime), 0f, 1f);
                    ChargedInfo cInfo2        = new ChargedInfo(lastPos, chargedValue2, index, im: false);
                    IT_Gesture.ChargeEnd(cInfo2);
                }
                else
                {
                    float       chargedValue = Mathf.Clamp((float)chargeConst + (float)chargeDir * ((Time.realtimeSinceStartup - startTimeCharge) / maxChargeTime), 0f, 1f);
                    ChargedInfo cInfo        = new ChargedInfo(curPos, chargedValue, index, im: false);
                    if (chargeMode == _ChargeMode.PingPong)
                    {
                        if (chargedValue == 1f || chargedValue == 0f)
                        {
                            chargeDir *= -1;
                            switch (chargeDir)
                            {
                            case 1:
                                chargeConst = 0;
                                break;

                            case -1:
                                chargeConst = 1;
                                break;
                            }
                            startTimeCharge = Time.realtimeSinceStartup;
                        }
                        IT_Gesture.Charging(cInfo);
                    }
                    else if (chargedValue < 1f)
                    {
                        IT_Gesture.Charging(cInfo);
                    }
                    else
                    {
                        cInfo.percent = 1f;
                        if (chargeMode == _ChargeMode.Once)
                        {
                            chargeState = _ChargeState.Charged;
                            IT_Gesture.ChargeEnd(cInfo);
                            startTimeCharge = float.PositiveInfinity;
                        }
                        else if (chargeMode == _ChargeMode.Clamp)
                        {
                            chargeState = _ChargeState.Charged;
                            IT_Gesture.Charging(cInfo);
                        }
                        else if (chargeMode == _ChargeMode.Loop)
                        {
                            chargeState = _ChargeState.Clear;
                            IT_Gesture.ChargeEnd(cInfo);
                            startTimeCharge = Time.realtimeSinceStartup;
                        }
                    }
                }
            }
            if (!longTap && Time.realtimeSinceStartup - startTime > longTapTime && Vector2.Distance(lastPos, startPos) < (float)maxTapDisplacementAllowance * IT_Gesture.GetDPIFactor())
            {
                IT_Gesture.LongTap(new Tap(curPos, 1, index, im: false));
                longTap = true;
            }
            lastPos = curPos;
            yield return(null);
        }
        if (Time.realtimeSinceStartup - startTime <= shortTapTime && Vector2.Distance(lastPos, startPos) < (float)maxTapDisplacementAllowance * IT_Gesture.GetDPIFactor())
        {
            CheckMultiTapTouch(index, startPos, lastPos);
        }
        if (chargeState == _ChargeState.Charging || (chargeState == _ChargeState.Charged && chargeMode != 0))
        {
            float       chargedValue4 = Mathf.Clamp((float)chargeConst + (float)chargeDir * ((Time.realtimeSinceStartup - startTimeCharge) / maxChargeTime), 0f, 1f);
            ChargedInfo cInfo4        = new ChargedInfo(lastPos, chargedValue4, index, im: false);
            IT_Gesture.ChargeEnd(cInfo4);
        }
        fingerIndex.Remove(index);
    }
Exemplo n.º 27
0
    private IEnumerator TouchRoutine(int index)
    {
        fingerIndex.Add(index);
        bool    dragStarted = false;
        Vector2 startPos    = IT_Gesture.GetTouch(index).position;
        Vector2 lastPos     = startPos;
        float   timeStart   = float.PositiveInfinity;

        while ((enableMultiDrag && Input.touchCount > 0) || (!enableMultiDrag && Input.touchCount == 1))
        {
            Touch touch = IT_Gesture.GetTouch(index);
            if (touch.position == Vector2.zero)
            {
                break;
            }
            Vector2 curPos = touch.position;
            if (touch.phase == TouchPhase.Moved)
            {
                if (!dragStarted)
                {
                    if (Vector3.Distance(curPos, startPos) > (float)minDragDistance * IT_Gesture.GetDPIFactor())
                    {
                        dragStarted = true;
                        Vector2  delta3    = curPos - startPos;
                        DragInfo dragInfo4 = new DragInfo(curPos, delta3, 1, index, im: false);
                        IT_Gesture.DraggingStart(dragInfo4);
                        timeStart = Time.realtimeSinceStartup;
                    }
                }
                else if (curPos != lastPos)
                {
                    Vector2  delta2    = curPos - lastPos;
                    DragInfo dragInfo3 = new DragInfo(curPos, delta2, 1, index, im: false);
                    IT_Gesture.Dragging(dragInfo3);
                }
                lastPos = curPos;
            }
            else if (dragStarted && fireOnDraggingWhenNotMoving)
            {
                DragInfo dragInfo2 = new DragInfo(curPos, Vector2.zero, 1, index, im: false);
                IT_Gesture.Dragging(dragInfo2);
            }
            yield return(null);
        }
        if (dragStarted)
        {
            bool isFlick = false;
            if (Time.realtimeSinceStartup - timeStart < flickTimeRange)
            {
                isFlick = true;
            }
            Vector2  delta    = lastPos - startPos;
            DragInfo dragInfo = new DragInfo(lastPos, delta, 1, index, isFlick, im: false);
            IT_Gesture.DraggingEnd(dragInfo);
        }
        fingerIndex.Remove(index);
    }
Exemplo n.º 28
0
    IEnumerator MultiDragRoutine(int count)
    {
        if (count <= 1)
        {
            yield break;
        }

        bool dragStarted = false;

        Vector2 startPos = Vector2.zero;

        for (int i = 0; i < Input.touchCount; i++)
        {
            startPos += Input.touches[i].position;
        }
        startPos /= Input.touchCount;
        Vector2 lastPos = startPos;

        float timeStart = Mathf.Infinity;

                #if UNITY_ANDROID
        Vector2[] lastPoss = new Vector2[count];
        for (int i = 0; i < count; i++)
        {
            lastPoss[i] = Input.touches[i].position;
        }
                #endif

        while (Input.touchCount == count)
        {
            Vector2   curPos = Vector2.zero;
            Vector2[] allPos = new Vector2[count];
            bool      moving = true;
            for (int i = 0; i < count; i++)
            {
                Touch touch = Input.touches[i];
                curPos   += touch.position;
                allPos[i] = touch.position;
                if (touch.phase != TouchPhase.Moved)
                {
                    moving = false;
                }
            }
            curPos /= count;

            bool sync = true;
            if (moving)
            {
                for (int i = 0; i < count - 1; i++)
                {
                                        #if UNITY_ANDROID
                    Vector2 v1 = (Input.touches[i].position + lastPoss[i]).normalized;
                    Vector2 v2 = (Input.touches[i + 1].position + lastPoss[i + 1]).normalized;
                                        #else
                    Vector2 v1 = Input.touches[i].deltaPosition.normalized;
                    Vector2 v2 = Input.touches[i + 1].deltaPosition.normalized;
                                        #endif
                    if (Vector2.Dot(v1, v2) < 0.85f)
                    {
                        sync = false;
                    }
                }
            }

            if (moving && sync)
            {
                if (!dragStarted)
                {
                    if (Vector2.Distance(curPos, startPos) > minDragDistance * IT_Gesture.GetDPIFactor())
                    {
                        dragStarted = true;
                        Vector2  delta    = curPos - startPos;
                        DragInfo dragInfo = new DragInfo(curPos, delta, count);
                        IT_Gesture.DraggingStart(dragInfo);

                        timeStart = Time.realtimeSinceStartup;
                    }
                }
                else
                {
                    if (curPos != lastPos)
                    {
                        Vector2  delta    = curPos - lastPos;
                        DragInfo dragInfo = new DragInfo(curPos, delta, count);
                        IT_Gesture.Dragging(dragInfo);
                    }
                }
            }
            else if (dragStarted && fireOnDraggingWhenNotMoving)
            {
                DragInfo dragInfo = new DragInfo(curPos, Vector2.zero, count);
                IT_Gesture.Dragging(dragInfo);
            }

            lastPos = curPos;
                        #if UNITY_ANDROID
            for (int i = 0; i < count; i++)
            {
                lastPoss[i] = Input.touches[i].position;
            }
                        #endif

            yield return(null);
        }

        if (dragStarted)
        {
            bool isFlick = false;
            if (Time.realtimeSinceStartup - timeStart < 0.5f)
            {
                isFlick = true;
            }

            Vector2  delta    = lastPos - startPos;
            DragInfo dragInfo = new DragInfo(lastPos, delta, count, isFlick);
            IT_Gesture.DraggingEnd(dragInfo);
        }
    }