コード例 #1
0
    private void UpdateDragging()
    {
        float dragDistance = (_mouseStatus.GetMousePos() - _mouseStatus.GetMouseLastPos()).x;

        MovePanel(dragDistance);

        if (_mouseStatus.GetMouseJustUp(MouseStatus.KEY.LEFT))
        {
            _touchEndTime = TimeHelper.GetCurrentRealTimestamp();
            _touchEndPos  = _mouseStatus.GetMousePos();

            float dragTime = (float)(_touchEndTime - _touchBeganTime) / 1000.0f;
            if (dragTime < 0.5f)
            {
                CreateEasingData(dragTime);
                TimerEx.Init("MouseControl", dragTime, EasingFinish);

                _state = STATE.EASING;
            }
            else
            {
                _state = STATE.IDLE;
            }
            return;
        }
    }
コード例 #2
0
ファイル: MouseControl.cs プロジェクト: fchsg/UnityBattleTank
    private void UpdateDragging()
    {
        Vector3 dragDistance = new Vector3((_mouseStatus.GetMousePos() - _mouseStatus.GetMouseLastPos()).x, 0, 0);

        _game.mapCamera.cManualMove.UpdateMovePos(dragDistance);

        if (_mouseStatus.GetMouseJustUp(MouseStatus.KEY.LEFT))
        {
            _touchEndTime = TimeHelper.GetCurrentRealTimestamp();
            _touchEndPos  = _mouseStatus.GetMousePos();

            float dragTime = (float)(_touchEndTime - _touchBeganTime) / 1000.0f;
            if (dragTime < 0.5f)
            {
                dragDistance = new Vector3((_touchBeganPos - _touchEndPos).x, 0, 0);
                _game.mapCamera.cManualMove.UpdateEasingPos(dragTime, dragDistance);
                TimerEx.Init("MouseControl", dragTime, EasingFinish);

                _state = STATE.EASING;
            }
            else
            {
                _state = STATE.IDLE;
            }

            return;
        }
    }