Exemple #1
0
    public override void OnBeginDrag(PointerEventData kEvtData)
    {
        if (!emAble)
        {
            return;
        }
        if (Input.touchCount > 1 && !isDrag)
        {
            onlySinglePointer = false;
        }
        else
        {
            isDrag            = true;
            onlySinglePointer = true;
        }
        if (!onlySinglePointer)
        {
            return;
        }

        if (onBeginDrag != null)
        {
            if (mDragHelper == null)
            {
                mDragHelper = GetComponent <DragHelper>();
            }
            if (mDragHelper != null && mDragHelper.needAngle)
            {
                canDrag = false;
                if (mDragHelper.CheckAngleToDrag(kEvtData))
                {
                    canDrag = true;
                }
            }
            else
            {
                canDrag = true;
            }
            if (canDrag)
            {
                if (mDragHelper != null)
                {
                    mDragHelper.BeginDrag();
                }
                onBeginDrag(gameObject, kEvtData);
            }
            else
            {
                if (onNotDrag != null)
                {
                    onNotDrag(gameObject, kEvtData, false);
                }
                svobj = null;
                PassEvent(kEvtData, ExecuteEvents.beginDragHandler);
            }
        }
        else
        {
            svobj = null;
            PassEvent(kEvtData, ExecuteEvents.beginDragHandler);
        }
    }