Ejemplo n.º 1
0
 void onDblTouchBeginListener(Touch t1, Touch t2)
 {
     canvasCamera.getCoordinates(t1.position, ref startWorldPoint1, ref tmpIV2);
     canvasCamera.getCoordinates(t2.position, ref startWorldPoint2, ref tmpIV2);
     startScreenPosition1 = t1.position;
     startScreenPosition2 = t2.position;
     startCamSize         = canvasCamera.camera.orthographicSize;
 }
Ejemplo n.º 2
0
    void handleOneTouch(Touch t)
    {
        canvasCamera.getCoordinates(t.position, ref globalPosition, ref pixelPosition);

        switch (t.phase)
        {
        case (TouchPhase.Began):
            touchState = GlobalTouchState.ONE_FINGER_STATIONARY;
            if (isMouseWithinCameraRect())
            {
                if (CanvasController.events.onTouchStart != null)
                {
                    CanvasController.events.onTouchStart(pixelPosition, globalPosition);
                }
            }
            break;

        case (TouchPhase.Stationary):
        case (TouchPhase.Moved):
            if (touchState == GlobalTouchState.ONE_FINGER_STATIONARY)
            {
                if (isMouseWithinCameraRect())
                {
                    if (CanvasController.events.onTouchStart != null)
                    {
                        CanvasController.events.onTouchStart(pixelPosition, globalPosition);
                    }
                    lastPixelPosition = new IntVector2(pixelPosition);
                    lastWithinCamArea = true;
                }
            }

            if (isMouseWithinCameraRect())
            {
                if (lastWithinCamArea)
                {
                    if (CanvasController.events.onTouchOver != null)
                    {
                        CanvasController.events.onTouchOver(pixelPosition, globalPosition);
                    }
                }
                else
                {
                    if (CanvasController.events.onTouchStart != null)
                    {
                        CanvasController.events.onTouchStart(pixelPosition, globalPosition);
                    }
                    lastWithinCamArea = true;
                }
                lastPixelPosition = new IntVector2(pixelPosition);
            }
            else
            {
                if (lastWithinCamArea)
                {
                    finalizeTouch();
                }
            }
            touchState = GlobalTouchState.ONE_FINGER;
            break;

        case (TouchPhase.Canceled):
        case (TouchPhase.Ended):
            finalizeTouch();
            break;
        }
    }