Exemple #1
0
    public void OnPointerUp(PointerEventData eventData)
    {
        if (pointId == eventData.pointerId)
        {
            isOnDrag   = false;
            isOnTouch  = false;
            tmpAxis    = Vector2.zero;
            OldTmpAxis = Vector2.zero;

            axisX.axisState = ETCAxis.AxisState.None;
            axisY.axisState = ETCAxis.AxisState.None;

            if (!axisX.isEnertia && !axisY.isEnertia)
            {
                axisX.ResetAxis();
                axisY.ResetAxis();
                onMoveEnd.Invoke();
            }

            onTouchUp.Invoke();


            if (previousDargObject)
            {
                ExecuteEvents.Execute <IPointerUpHandler>(previousDargObject, eventData, ExecuteEvents.pointerUpHandler);
                previousDargObject = null;
            }

            pointId = -1;
        }
    }
    public void OnPointerUp(PointerEventData eventData)
    {
        isOnDrag               = false;
        isOnTouch              = false;
        thumbPosition          = Vector2.zero;
        thumb.anchoredPosition = Vector2.zero;

        axisX.axisState = ETCAxis.AxisState.None;
        axisY.axisState = ETCAxis.AxisState.None;

        if (!axisX.isEnertia && !axisY.isEnertia)
        {
            //Debug.LogWarningFormat("onMoveEnd====>{0}==>{1}", eventData.position.ToString(), eventData.pressPosition.ToString());
            axisX.ResetAxis();
            axisY.ResetAxis();
            tmpAxis    = Vector2.zero;
            OldTmpAxis = Vector2.zero;
            onMoveEnd.Invoke(eventData.position);
        }

        if (joystickType == JoystickType.Dynamic)
        {
            visible        = false;
            isDynamicActif = false;
        }

        onTouchUp.Invoke();
    }
Exemple #3
0
    public void OnPointerUp(PointerEventData eventData)
    {
        if (pointId == eventData.pointerId)
        {
            isOnTouch = false;
            isOnDrag  = false;

            tmpAxis    = Vector2.zero;
            OldTmpAxis = Vector2.zero;

            axisX.axisState = ETCAxis.AxisState.None;
            axisY.axisState = ETCAxis.AxisState.None;

            if (!axisX.isEnertia && !axisY.isEnertia)
            {
                axisX.ResetAxis();
                axisY.ResetAxis();
                onMoveEnd.Invoke();
            }

            pointId = -1;

            onTouchUp.Invoke();
        }
    }
    public void OnPointerUp(PointerEventData eventData)
    {
        isOnDrag               = false;
        isOnTouch              = false;
        thumbPosition          = Vector2.zero;
        thumb.anchoredPosition = Vector2.zero;

        axisX.axisState = ETCAxis.AxisState.None;
        axisY.axisState = ETCAxis.AxisState.None;

        if (!axisX.isEnertia && !axisY.isEnertia)
        {
            axisX.ResetAxis();
            axisY.ResetAxis();
            tmpAxis    = Vector2.zero;
            OldTmpAxis = Vector2.zero;
            onMoveEnd.Invoke();
        }

        if (joystickType == JoystickType.Dynamic)
        {
            visible        = false;
            isDynamicActif = false;
        }

        onTouchUp.Invoke();
    }
Exemple #5
0
    public void OnPointerUp(PointerEventData eventData)
    {
        isOnTouch = false;
        isOnDrag  = false;

        tmpAxis    = Vector2.zero;
        OldTmpAxis = Vector2.zero;

        removeId(eventData.pointerId);

        if (touchIds.Count > 0)
        {
            GetTouchDirectionDown(touchIds[touchIds.Count - 1].point, eventData.pressEventCamera);
        }

        GetTouchDirectionUp(eventData.position, eventData.pressEventCamera);

        if (touchIds.Count == 0)
        {
            axisX.axisState = ETCAxis.AxisState.None;
            axisY.axisState = ETCAxis.AxisState.None;

            if (!axisX.isEnertia && !axisY.isEnertia)
            {
                axisX.ResetAxis();
                axisY.ResetAxis();
                onMoveEnd.Invoke();
            }
        }

        onTouchUp.Invoke();
    }
    private void OnUp(bool real = true)
    {
        isOnDrag  = false;
        isOnTouch = false;

        if (isNoReturnThumb)
        {
            noReturnPosition = thumb.position;
            noReturnOffset   = thumbPosition;
        }

        if (!isNoReturnThumb)
        {
            thumbPosition          = Vector2.zero;
            thumb.anchoredPosition = Vector2.zero;

            axisX.axisState = ETCAxis.AxisState.None;
            axisY.axisState = ETCAxis.AxisState.None;
        }

        if (!axisX.isEnertia && !axisY.isEnertia)
        {
            axisX.ResetAxis();
            axisY.ResetAxis();
            tmpAxis    = Vector2.zero;
            OldTmpAxis = Vector2.zero;
            if (real)
            {
                anima.Idleanima();
                onMoveEnd.Invoke();
            }
        }

        if (joystickType == JoystickType.Dynamic)
        {
            visible        = false;
            isDynamicActif = false;
        }

        pointId = -1;

        if (real)
        {
            if (isQStick)
            {
                anima.Qanima();
            }
            onTouchUp.Invoke();
        }
    }
Exemple #7
0
    void Update()
    {
        var oldAxis = tmpAxis;

        tmpAxis = thumbPosition / GetRadius();
        if (!tmpAxis.x.RoundEquals(0) || !tmpAxis.y.RoundEquals(0))
        {
            if (oldAxis == Vector2.zero)
            {
                OnMoveStart.Invoke();
            }
            OnMove.Invoke(tmpAxis);
        }
        else if (tmpAxis.x.RoundEquals(0) && tmpAxis.y.RoundEquals(0) && oldAxis != Vector2.zero)
        {
            OnMoveEnd.Invoke();
        }
    }