protected virtual void OnDragDropStart()
 {
     //IL_00a0: Unknown result type (might be due to invalid IL or missing references)
     //IL_00a5: Expected O, but got Unknown
     //IL_0103: Unknown result type (might be due to invalid IL or missing references)
     //IL_0108: Unknown result type (might be due to invalid IL or missing references)
     //IL_011b: Unknown result type (might be due to invalid IL or missing references)
     //IL_0156: Unknown result type (might be due to invalid IL or missing references)
     //IL_015b: Expected O, but got Unknown
     if (!draggedItems.Contains(this))
     {
         draggedItems.Add(this);
     }
     if (mDragScrollView != null)
     {
         mDragScrollView.set_enabled(false);
     }
     if (mButton != null)
     {
         mButton.isEnabled = false;
     }
     else if (mCollider != null)
     {
         mCollider.set_enabled(false);
     }
     else if (mCollider2D != null)
     {
         mCollider2D.set_enabled(false);
     }
     mParent = mTrans.get_parent();
     mRoot = NGUITools.FindInParents<UIRoot>(mParent);
     mGrid = NGUITools.FindInParents<UIGrid>(mParent);
     mTable = NGUITools.FindInParents<UITable>(mParent);
     if (UIDragDropRoot.root != null)
     {
         mTrans.set_parent(UIDragDropRoot.root);
     }
     Vector3 localPosition = mTrans.get_localPosition();
     localPosition.z = 0f;
     mTrans.set_localPosition(localPosition);
     TweenPosition component = this.GetComponent<TweenPosition>();
     if (component != null)
     {
         component.set_enabled(false);
     }
     SpringPosition component2 = this.GetComponent<SpringPosition>();
     if (component2 != null)
     {
         component2.set_enabled(false);
     }
     NGUITools.MarkParentAsChanged(this.get_gameObject());
     if (mTable != null)
     {
         mTable.repositionNow = true;
     }
     if (mGrid != null)
     {
         mGrid.repositionNow = true;
     }
 }
 public void Press(bool isPressed)
 {
     //IL_0032: Unknown result type (might be due to invalid IL or missing references)
     //IL_0037: Unknown result type (might be due to invalid IL or missing references)
     //IL_003d: Unknown result type (might be due to invalid IL or missing references)
     //IL_0042: Unknown result type (might be due to invalid IL or missing references)
     if (isPressed)
     {
         mDragStarted = false;
     }
     if (rootForBounds != null)
     {
         mPressed = isPressed;
         if (isPressed)
         {
             mBounds   = NGUIMath.CalculateAbsoluteWidgetBounds(rootForBounds);
             mMomentum = Vector2.get_zero();
             mScroll   = 0f;
             SpringPosition component = this.GetComponent <SpringPosition>();
             if (component != null)
             {
                 component.set_enabled(false);
             }
         }
         else if (dragEffect == UIDragObject.DragEffect.MomentumAndSpring)
         {
             ConstrainToBounds(false);
         }
     }
 }
 public void Press(bool isPressed)
 {
     if (isPressed)
     {
         this.mDragStarted = false;
     }
     if (this.rootForBounds != null)
     {
         this.mPressed = isPressed;
         if (isPressed)
         {
             this.mBounds   = NGUIMath.CalculateAbsoluteWidgetBounds(this.rootForBounds);
             this.mMomentum = Vector2.get_zero();
             this.mScroll   = 0f;
             SpringPosition component = base.GetComponent <SpringPosition>();
             if (component != null)
             {
                 component.set_enabled(false);
             }
         }
         else if (this.dragEffect == UIDragObject.DragEffect.MomentumAndSpring)
         {
             this.ConstrainToBounds(false);
         }
     }
 }
Ejemplo n.º 4
0
    public void CancelSpring()
    {
        SpringPosition component = target.GetComponent <SpringPosition>();

        if (component != null)
        {
            component.set_enabled(false);
        }
    }
Ejemplo n.º 5
0
    protected virtual void OnDragDropStart()
    {
        if (this.mDragScrollView != null)
        {
            this.mDragScrollView.set_enabled(false);
        }
        if (this.mButton != null)
        {
            this.mButton.isEnabled = false;
        }
        else if (this.mCollider != null)
        {
            this.mCollider.set_enabled(false);
        }
        else if (this.mCollider2D != null)
        {
            this.mCollider2D.set_enabled(false);
        }
        this.mParent = this.mTrans.get_parent();
        this.mRoot   = NGUITools.FindInParents <UIRoot>(this.mParent);
        this.mGrid   = NGUITools.FindInParents <UIGrid>(this.mParent);
        this.mTable  = NGUITools.FindInParents <UITable>(this.mParent);
        if (UIDragDropRoot.root != null)
        {
            this.mTrans.set_parent(UIDragDropRoot.root);
        }
        Vector3 localPosition = this.mTrans.get_localPosition();

        localPosition.z = 0f;
        this.mTrans.set_localPosition(localPosition);
        TweenPosition component = base.GetComponent <TweenPosition>();

        if (component != null)
        {
            component.set_enabled(false);
        }
        SpringPosition component2 = base.GetComponent <SpringPosition>();

        if (component2 != null)
        {
            component2.set_enabled(false);
        }
        NGUITools.MarkParentAsChanged(base.get_gameObject());
        if (this.mTable != null)
        {
            this.mTable.repositionNow = true;
        }
        if (this.mGrid != null)
        {
            this.mGrid.repositionNow = true;
        }
    }
    private void Update()
    {
        //IL_003d: Unknown result type (might be due to invalid IL or missing references)
        //IL_0043: Unknown result type (might be due to invalid IL or missing references)
        //IL_0054: Unknown result type (might be due to invalid IL or missing references)
        //IL_0059: Unknown result type (might be due to invalid IL or missing references)
        //IL_005e: Unknown result type (might be due to invalid IL or missing references)
        //IL_009b: Unknown result type (might be due to invalid IL or missing references)
        //IL_00ac: Unknown result type (might be due to invalid IL or missing references)
        //IL_00b1: Unknown result type (might be due to invalid IL or missing references)
        //IL_00b6: Unknown result type (might be due to invalid IL or missing references)
        //IL_00c7: Unknown result type (might be due to invalid IL or missing references)
        //IL_00cc: Unknown result type (might be due to invalid IL or missing references)
        //IL_0117: Unknown result type (might be due to invalid IL or missing references)
        float deltaTime = RealTime.deltaTime;

        if (mPressed)
        {
            SpringPosition component = this.GetComponent <SpringPosition>();
            if (component != null)
            {
                component.set_enabled(false);
            }
            mScroll = 0f;
        }
        else
        {
            mMomentum += scale * (mScroll * 20f);
            mScroll    = NGUIMath.SpringLerp(mScroll, 0f, 20f, deltaTime);
            if (mMomentum.get_magnitude() > 0.01f)
            {
                Transform obj = mTrans;
                obj.set_localPosition(obj.get_localPosition() + Vector2.op_Implicit(NGUIMath.SpringDampen(ref mMomentum, 9f, deltaTime)));
                mBounds = NGUIMath.CalculateAbsoluteWidgetBounds(rootForBounds);
                if (!ConstrainToBounds(dragEffect == UIDragObject.DragEffect.None))
                {
                    SpringPosition component2 = this.GetComponent <SpringPosition>();
                    if (component2 != null)
                    {
                        component2.set_enabled(false);
                    }
                }
                return;
            }
            mScroll = 0f;
        }
        NGUIMath.SpringDampen(ref mMomentum, 9f, deltaTime);
    }
    public static SpringPosition Begin(GameObject go, Vector3 pos, float strength)
    {
        SpringPosition springPosition = go.GetComponent <SpringPosition>();

        if (springPosition == null)
        {
            springPosition = go.AddComponent <SpringPosition>();
        }
        springPosition.target     = pos;
        springPosition.strength   = strength;
        springPosition.onFinished = null;
        if (!springPosition.get_enabled())
        {
            springPosition.mThreshold = 0f;
            springPosition.set_enabled(true);
        }
        return(springPosition);
    }
    public bool ConstrainTargetToBounds(Transform target, ref Bounds targetBounds, bool immediate)
    {
        Vector3 vector  = targetBounds.get_min();
        Vector3 vector2 = targetBounds.get_max();
        float   num     = 1f;

        if (this.mClipping == UIDrawCall.Clipping.None)
        {
            UIRoot root = base.root;
            if (root != null)
            {
                num = root.pixelSizeAdjustment;
            }
        }
        if (num != 1f)
        {
            vector  /= num;
            vector2 /= num;
        }
        Vector3 vector3 = this.CalculateConstrainOffset(vector, vector2) * num;

        if (vector3.get_sqrMagnitude() > 0f)
        {
            if (immediate)
            {
                target.set_localPosition(target.get_localPosition() + vector3);
                targetBounds.set_center(targetBounds.get_center() + vector3);
                SpringPosition component = target.GetComponent <SpringPosition>();
                if (component != null)
                {
                    component.set_enabled(false);
                }
            }
            else
            {
                SpringPosition springPosition = SpringPosition.Begin(target.get_gameObject(), target.get_localPosition() + vector3, 13f);
                springPosition.ignoreTimeScale = true;
                springPosition.worldSpace      = false;
            }
            return(true);
        }
        return(false);
    }
    public static SpringPosition Begin(GameObject go, Vector3 pos, float strength)
    {
        //IL_001b: Unknown result type (might be due to invalid IL or missing references)
        //IL_001c: Unknown result type (might be due to invalid IL or missing references)
        SpringPosition springPosition = go.GetComponent <SpringPosition>();

        if (springPosition == null)
        {
            springPosition = go.AddComponent <SpringPosition>();
        }
        springPosition.target     = pos;
        springPosition.strength   = strength;
        springPosition.onFinished = null;
        if (!springPosition.get_enabled())
        {
            springPosition.mThreshold = 0f;
            springPosition.set_enabled(true);
        }
        return(springPosition);
    }
    private void Update()
    {
        float deltaTime = RealTime.deltaTime;

        if (this.mPressed)
        {
            SpringPosition component = base.GetComponent <SpringPosition>();
            if (component != null)
            {
                component.set_enabled(false);
            }
            this.mScroll = 0f;
        }
        else
        {
            this.mMomentum += this.scale * (this.mScroll * 20f);
            this.mScroll    = NGUIMath.SpringLerp(this.mScroll, 0f, 20f, deltaTime);
            if (this.mMomentum.get_magnitude() > 0.01f)
            {
                Transform expr_9A = this.mTrans;
                expr_9A.set_localPosition(expr_9A.get_localPosition() + NGUIMath.SpringDampen(ref this.mMomentum, 9f, deltaTime));
                this.mBounds = NGUIMath.CalculateAbsoluteWidgetBounds(this.rootForBounds);
                if (!this.ConstrainToBounds(this.dragEffect == UIDragObject.DragEffect.None))
                {
                    SpringPosition component2 = base.GetComponent <SpringPosition>();
                    if (component2 != null)
                    {
                        component2.set_enabled(false);
                    }
                }
                return;
            }
            this.mScroll = 0f;
        }
        NGUIMath.SpringDampen(ref this.mMomentum, 9f, deltaTime);
    }