コード例 #1
0
    void Start()
    {
        NInputLayer.OnPressDown            += ReceivePressDown;
        NInputLayer.OnPressUp              += ReceivePressUp;
        NInputLayer.OnStationaryPressBegin += ReceiveStationaryPressBegin;
        NInputLayer.OnStationaryPress      += ReceiveStationaryPress;
        NInputLayer.OnStationaryPressEnd   += ReceiveStationaryPressEnd;
        NInputLayer.OnPressMoveBegin       += ReceivePressMoveBegin;
        NInputLayer.OnPressMove            += ReceivePressMove;
        NInputLayer.OnPressMoveEnd         += ReceivePressMoveEnd;
        NInputLayer.OnLongPress            += ReceiveLongPress;
        NInputLayer.OnPressDragBegin       += ReceivePressDragBegin;
        NInputLayer.OnPressDragMove        += ReceivePressDragMove;
        NInputLayer.OnPressDragEnd         += ReceivePressDragEnd;
        NInputLayer.OnShortPress           += ReceiveShortPress;
        NInputLayer.OnDoublePress          += ReceiveDoublePress;
        NInputLayer.OnSwipe              += ReceivePressScreenSwipe;
        NInputLayer.OnPinchBegin         += ReceivePinchBegin;
        NInputLayer.OnPinchMove          += ReceivePinchMove;
        NInputLayer.OnPinchEnd           += ReceivePinchEnd;
        NInputLayer.OnRotationBegin      += ReceiveRotationBegin;
        NInputLayer.OnRotationMove       += ReceiveRotationMove;
        NInputLayer.OnRotationEnd        += ReceiveRotationEnd;
        NInputLayer.OnTwoFingerDragBegin += ReceiveTwoFingerDragBegin;
        NInputLayer.OnTwoFingerDragMove  += ReceiveTwoFingerDragMove;
        NInputLayer.OnTwoFingerDragEnd   += ReceiveTwoFingerDragEnd;
        NInputLayer.OnTwoFingerPress     += ReceiveTwoFingerPress;
        NInputLayer.OnTwoFingerSwipe     += ReceiveTwoFingerSwipe;
        NInputLayer.OnTwoFingerLongPress += ReceiveTwoFingerLongPress;

        // Actual tests
        FingerGestures.TestOnFingerDown(0, Vector2.zero);
        if (!pressDown)
        {
            Debug.LogError("TestOnFingerDown FAILED!");
        }

        FingerGestures.TestOnFingerUp(0, Vector2.zero, 0f);
        if (!pressUp)
        {
            Debug.LogError("TestOnFingerUp FAILED!");
        }

        FingerGestures.TestOnFingerStationaryBegin(0, Vector2.zero);
        if (!stationaryPressBegin)
        {
            Debug.LogError("TestOnFingerStationaryBegin FAILED!");
        }

        FingerGestures.TestOnFingerStationary(0, Vector2.zero, 0f);
        if (!stationaryPress)
        {
            Debug.LogError("TestOnFingerStationary FAILED!");
        }

        FingerGestures.TestOnFingerStationaryEnd(0, Vector2.zero, 0f);
        if (!stationaryPressEnd)
        {
            Debug.LogError("TestOnFingerStationaryEnd FAILED!");
        }

        FingerGestures.TestOnFingerMoveBegin(0, Vector2.zero);
        if (!pressMoveBegin)
        {
            Debug.LogError("TestOnFingerMoveBegin FAILED!");
        }

        FingerGestures.TestOnFingerMove(0, Vector2.zero);
        if (!pressMove)
        {
            Debug.LogError("TestOnFingerMove FAILED!");
        }

        FingerGestures.TestOnFingerMoveEnd(0, Vector2.zero);
        if (!pressMoveEnd)
        {
            Debug.LogError("TestOnFingerMoveEnd FAILED!");
        }

        FingerGestures.TestOnFingerLongPress(0, Vector2.zero);
        if (!longPress)
        {
            Debug.LogError("TestOnFingerLongPress FAILED!");
        }

        FingerGestures.TestOnFingerDragBegin(0, Vector2.zero, Vector2.zero);
        if (!pressDragBegin)
        {
            Debug.LogError("TestOnFingerDragBegin FAILED!");
        }

        FingerGestures.TestOnFingerDragMove(0, Vector2.zero, Vector2.zero);
        if (!pressDragMove)
        {
            Debug.LogError("TestOnFingerDragMove FAILED!");
        }

        FingerGestures.TestOnFingerDragEnd(0, Vector2.zero);
        if (!pressDragEnd)
        {
            Debug.LogError("TestOnFingerDragEnd FAILED!");
        }

        FingerGestures.TestOnFingerPress(0, Vector2.zero);
        if (!shortPress)
        {
            Debug.LogError("TestOnFingerPress FAILED!");
        }

        FingerGestures.TestOnFingerDoublePress(0, Vector2.zero);
        if (!doublePress)
        {
            Debug.LogError("TestOnFingerDoublePress FAILED!");
        }

        FingerGestures.TestOnFingerSwipe(0, Vector2.zero, FingerGestures.SwipeDirection.None, 0f);
        if (!pressScreenSwipe)
        {
            Debug.LogError("TestOnFingerSwipe FAILED!");
        }

        FingerGestures.TestOnPinchBegin(Vector2.zero, Vector2.zero);
        if (!pinchBegin)
        {
            Debug.LogError("TestOnPinchBegin FAILED!");
        }

        FingerGestures.TestOnPinchMove(Vector2.zero, Vector2.zero, 0f);
        if (!pinchMove)
        {
            Debug.LogError("TestOnPinchMove FAILED!");
        }

        FingerGestures.TestOnPinchEnd(Vector2.zero, Vector2.zero);
        if (!pinchEnd)
        {
            Debug.LogError("TestOnPinchEnd FAILED!");
        }

        FingerGestures.TestOnRotationBegin(Vector2.zero, Vector2.zero);
        if (!rotationBegin)
        {
            Debug.LogError("TestOnRotationBegin FAILED!");
        }

        FingerGestures.TestOnRotationMove(Vector2.zero, Vector2.zero, 0f);
        if (!rotationMove)
        {
            Debug.LogError("TestOnRotationMove FAILED!");
        }

        FingerGestures.TestOnRotationEnd(Vector2.zero, Vector2.zero, 0f);
        if (!rotationEnd)
        {
            Debug.LogError("TestOnRotationEnd FAILED!");
        }

        FingerGestures.TestOnTwoFingerDragBegin(Vector2.zero, Vector2.zero);
        if (!twoFingerDragBegin)
        {
            Debug.LogError("TestOnTwoFingerDragBegin FAILED!");
        }

        FingerGestures.TestOnTwoFingerDragMove(Vector2.zero, Vector2.zero);
        if (!twoFingerDragMove)
        {
            Debug.LogError("TestOnTwoFingerDragMove FAILED!");
        }

        FingerGestures.TestOnTwoFingerDragEnd(Vector2.zero);
        if (!twoFingerDragEnd)
        {
            Debug.LogError("TestOnTwoFingerDragEnd FAILED!");
        }

        FingerGestures.TestOnTwoFingerPress(Vector2.zero);
        if (!twoFingerPress)
        {
            Debug.LogError("TestOnTwoFingerPress FAILED!");
        }

        FingerGestures.TestOnTwoFingerSwipe(Vector2.zero, FingerGestures.SwipeDirection.None, 0f);
        if (!twoFingerSwipe)
        {
            Debug.LogError("TestOnTwoFingerSwipe FAILED!");
        }

        FingerGestures.TestOnTwoFingerLongPress(Vector2.zero);
        if (!twoFingerLongPress)
        {
            Debug.LogError("TestOnTwoFingerLongPress FAILED!");
        }

        Debug.Log("ALL TESTS PASSED");
    }