Start() protected method

Cache the transform.
protected Start ( ) : void
return void
Exemplo n.º 1
0
 // Token: 0x06003060 RID: 12384 RVA: 0x000E9780 File Offset: 0x000E7B80
 protected virtual void StartDragging()
 {
     if (!this.mDragging)
     {
         if (this.cloneOnDrag)
         {
             GameObject gameObject = NGUITools.AddChild(base.transform.parent.gameObject, base.gameObject);
             gameObject.transform.localPosition = base.transform.localPosition;
             gameObject.transform.localRotation = base.transform.localRotation;
             gameObject.transform.localScale    = base.transform.localScale;
             UIButtonColor component = gameObject.GetComponent <UIButtonColor>();
             if (component != null)
             {
                 component.defaultColor = base.GetComponent <UIButtonColor>().defaultColor;
             }
             UICamera.currentTouch.dragged = gameObject;
             UIDragDropItem component2 = gameObject.GetComponent <UIDragDropItem>();
             component2.mDragging = true;
             component2.Start();
             component2.OnDragDropStart();
         }
         else
         {
             this.mDragging = true;
             this.OnDragDropStart();
         }
     }
 }
Exemplo n.º 2
0
    /// <summary>
    /// Start the dragging operation.
    /// </summary>

    protected virtual void StartDragging()
    {
        if (!mDragging)
        {
            if (cloneOnDrag)
            {
                GameObject clone = NGUITools.AddChild(transform.parent.gameObject, gameObject);
                clone.transform.localPosition = transform.localPosition;
                clone.transform.localRotation = transform.localRotation;
                clone.transform.localScale    = transform.localScale;

                UIButtonColor bc = clone.GetComponent <UIButtonColor>();
                if (bc != null)
                {
                    bc.defaultColor = GetComponent <UIButtonColor>().defaultColor;
                }

                UICamera.currentTouch.dragged = clone;

                UIDragDropItem item = clone.GetComponent <UIDragDropItem>();
                item.mDragging = true;
                item.Start();
                item.OnDragDropStart();
            }
            else
            {
                mDragging = true;
                OnDragDropStart();
            }
        }
    }
Exemplo n.º 3
0
    /// <summary>
    /// Start the dragging operation.
    /// </summary>

    void OnDragStart()
    {
        if (!enabled || mTouchID != int.MinValue)
        {
            return;
        }

        // If we have a restriction, check to see if its condition has been met first
        if (restriction != Restriction.None)
        {
            if (restriction == Restriction.Horizontal)
            {
                Vector2 delta = UICamera.currentTouch.totalDelta;
                if (Mathf.Abs(delta.x) < Mathf.Abs(delta.y))
                {
                    return;
                }
            }
            else if (restriction == Restriction.Vertical)
            {
                Vector2 delta = UICamera.currentTouch.totalDelta;
                if (Mathf.Abs(delta.x) > Mathf.Abs(delta.y))
                {
                    return;
                }
            }
            else if (restriction == Restriction.PressAndHold)
            {
                if (mPressTime + pressAndHoldDelay > RealTime.time)
                {
                    return;
                }
            }
        }

        if (cloneOnDrag)
        {
            GameObject clone = NGUITools.AddChild(transform.parent.gameObject, gameObject);
            clone.transform.localPosition = transform.localPosition;
            clone.transform.localRotation = transform.localRotation;
            clone.transform.localScale    = transform.localScale;

            UIButtonColor bc = clone.GetComponent <UIButtonColor>();
            if (bc != null)
            {
                bc.defaultColor = GetComponent <UIButtonColor>().defaultColor;
            }

            UICamera.currentTouch.dragged = clone;

            UIDragDropItem item = clone.GetComponent <UIDragDropItem>();
            item.originalItem = this;
            item.Start();
            item.OnDragDropStart();
        }
        else
        {
            OnDragDropStart();
        }
    }
Exemplo n.º 4
0
 // Token: 0x06000C0F RID: 3087 RVA: 0x00068AE4 File Offset: 0x00066CE4
 public virtual void StartDragging()
 {
     if (!this.interactable)
     {
         return;
     }
     if (!this.mDragging)
     {
         if (this.cloneOnDrag)
         {
             this.mPressed = false;
             GameObject gameObject;
             if (this.cloneObject != null)
             {
                 gameObject = base.transform.parent.gameObject.BFCKNMFEBDM(this.cloneObject);
                 gameObject.transform.position = EMENMKHBPQE.DKIMLEKEFCB.point;
             }
             else
             {
                 gameObject = base.transform.parent.gameObject.BFCKNMFEBDM(base.gameObject);
                 gameObject.transform.localPosition = base.transform.localPosition;
             }
             gameObject.transform.localRotation = base.transform.localRotation;
             gameObject.transform.localScale    = base.transform.localScale;
             PBJKDKBOLHO component = gameObject.GetComponent <PBJKDKBOLHO>();
             if (component != null)
             {
                 component.IDEOONDHNEL = base.GetComponent <PBJKDKBOLHO>().IDEOONDHNEL;
             }
             if (this.mTouch != null && this.mTouch.KCICOJFDCPQ == base.gameObject)
             {
                 this.mTouch.OMQCQCBLQGJ = gameObject;
                 this.mTouch.KCICOJFDCPQ = gameObject;
                 this.mTouch.HKGQKLHJKMB = gameObject;
                 this.mTouch.CIDFMGENPFQ = gameObject;
             }
             UIDragDropItem component2 = gameObject.GetComponent <UIDragDropItem>();
             component2.mTouch    = this.mTouch;
             component2.mPressed  = true;
             component2.mDragging = true;
             component2.Start();
             component2.OnClone(base.gameObject);
             component2.GetClone(gameObject, base.gameObject);
             component2.OnDragDropStart();
             if (EMENMKHBPQE.JHEDGGMDIEE == null)
             {
                 EMENMKHBPQE.JHEDGGMDIEE = this.mTouch;
             }
             this.mTouch = null;
             EMENMKHBPQE.EHDBBNFQIBL(base.gameObject, "OnPress", false);
             EMENMKHBPQE.EHDBBNFQIBL(base.gameObject, "OnHover", false);
         }
         else
         {
             this.mDragging = true;
             this.OnDragDropStart();
         }
     }
 }
Exemplo n.º 5
0
    /// <summary>
    /// Start the dragging operation.
    /// </summary>

    protected virtual void StartDragging()
    {
        if (!interactable)
        {
            return;
        }

        if (!mDragging)
        {
            if (cloneOnDrag)
            {
                mPressed = false;
                GameObject clone = NGUITools.AddChild(transform.parent.gameObject, gameObject);
                clone.transform.localPosition = transform.localPosition;
                clone.transform.localRotation = transform.localRotation;
                clone.transform.localScale    = transform.localScale;

                UIButtonColor bc = clone.GetComponent <UIButtonColor>();
                if (bc != null)
                {
                    bc.defaultColor = GetComponent <UIButtonColor>().defaultColor;
                }

                if (mTouch != null && mTouch.pressed == gameObject)
                {
                    mTouch.current = clone;
                    mTouch.pressed = clone;
                    mTouch.dragged = clone;
                    mTouch.last    = clone;
                }

                UIDragDropItem item = clone.GetComponent <UIDragDropItem>();
                if (onDosomething != null)
                {
                    onDosomething(item);
                }
                item.mTouch    = mTouch;
                item.mPressed  = true;
                item.mDragging = true;
                item.Start();
                item.OnDragDropStart();

                if (UICamera.currentTouch == null)
                {
                    UICamera.currentTouch = mTouch;
                }

                mTouch = null;

                UICamera.Notify(gameObject, "OnPress", false);
                UICamera.Notify(gameObject, "OnHover", false);
            }
            else
            {
                mDragging = true;
                OnDragDropStart();
            }
        }
    }
Exemplo n.º 6
0
 private void OnDragStart()
 {
     if (!base.enabled || this.mTouchID != -2147483648)
     {
         return;
     }
     if (this.restriction != UIDragDropItem.Restriction.None)
     {
         if (this.restriction == UIDragDropItem.Restriction.Horizontal)
         {
             Vector2 totalDelta = UICamera.currentTouch.totalDelta;
             if (Mathf.Abs(totalDelta.x) < Mathf.Abs(totalDelta.y))
             {
                 return;
             }
         }
         else if (this.restriction == UIDragDropItem.Restriction.Vertical)
         {
             Vector2 totalDelta2 = UICamera.currentTouch.totalDelta;
             if (Mathf.Abs(totalDelta2.x) > Mathf.Abs(totalDelta2.y))
             {
                 return;
             }
         }
         else if (this.restriction == UIDragDropItem.Restriction.PressAndHold && this.mPressTime + 1f > RealTime.time)
         {
             return;
         }
     }
     if (this.cloneOnDrag)
     {
         GameObject gameObject = NGUITools.AddChild(base.transform.parent.gameObject, base.gameObject);
         gameObject.transform.localPosition = base.transform.localPosition;
         gameObject.transform.localRotation = base.transform.localRotation;
         gameObject.transform.localScale    = base.transform.localScale;
         UIButtonColor component = gameObject.GetComponent <UIButtonColor>();
         if (component != null)
         {
             component.defaultColor = base.GetComponent <UIButtonColor>().defaultColor;
         }
         UICamera.Notify(UICamera.currentTouch.pressed, "OnPress", false);
         UICamera.currentTouch.pressed = gameObject;
         UICamera.currentTouch.dragged = gameObject;
         UIDragDropItem component2 = gameObject.GetComponent <UIDragDropItem>();
         component2.Start();
         component2.OnDragDropStart();
     }
     else
     {
         this.OnDragDropStart();
     }
 }
Exemplo n.º 7
0
 private void OnDragStart()
 {
     if (!base.enabled || mTouchID != int.MinValue)
     {
         return;
     }
     if (restriction != 0)
     {
         if (restriction == Restriction.Horizontal)
         {
             Vector2 totalDelta = UICamera.currentTouch.totalDelta;
             if (Mathf.Abs(totalDelta.x) < Mathf.Abs(totalDelta.y))
             {
                 return;
             }
         }
         else if (restriction == Restriction.Vertical)
         {
             Vector2 totalDelta = UICamera.currentTouch.totalDelta;
             if (Mathf.Abs(totalDelta.x) > Mathf.Abs(totalDelta.y))
             {
                 return;
             }
         }
         else if (restriction == Restriction.PressAndHold && mPressTime + pressAndHoldDelay > RealTime.time)
         {
             return;
         }
     }
     if (cloneOnDrag)
     {
         GameObject gameObject = NGUITools.AddChild(base.transform.parent.gameObject, base.gameObject);
         gameObject.transform.localPosition = base.transform.localPosition;
         gameObject.transform.localRotation = base.transform.localRotation;
         gameObject.transform.localScale    = base.transform.localScale;
         UIButtonColor component = gameObject.GetComponent <UIButtonColor>();
         if (component != null)
         {
             component.defaultColor = GetComponent <UIButtonColor>().defaultColor;
         }
         UICamera.currentTouch.dragged = gameObject;
         UIDragDropItem component2 = gameObject.GetComponent <UIDragDropItem>();
         component2.Start();
         component2.OnDragDropStart();
     }
     else
     {
         OnDragDropStart();
     }
 }
Exemplo n.º 8
0
 public virtual void StartDragging()
 {
     if (!this.interactable)
     {
         return;
     }
     if (!this.mDragging)
     {
         if (this.cloneOnDrag)
         {
             this.mPressed = false;
             GameObject gameObject = base.transform.parent.gameObject.AddChild(base.gameObject);
             gameObject.transform.localPosition = base.transform.localPosition;
             gameObject.transform.localRotation = base.transform.localRotation;
             gameObject.transform.localScale    = base.transform.localScale;
             UIButtonColor component = gameObject.GetComponent <UIButtonColor>();
             if (component != null)
             {
                 component.defaultColor = base.GetComponent <UIButtonColor>().defaultColor;
             }
             if (this.mTouch != null && this.mTouch.pressed == base.gameObject)
             {
                 this.mTouch.current = gameObject;
                 this.mTouch.pressed = gameObject;
                 this.mTouch.dragged = gameObject;
                 this.mTouch.last    = gameObject;
             }
             UIDragDropItem component2 = gameObject.GetComponent <UIDragDropItem>();
             component2.mTouch    = this.mTouch;
             component2.mPressed  = true;
             component2.mDragging = true;
             component2.Start();
             component2.OnClone(base.gameObject);
             component2.OnDragDropStart();
             if (UICamera.currentTouch == null)
             {
                 UICamera.currentTouch = this.mTouch;
             }
             this.mTouch = null;
             UICamera.Notify(base.gameObject, "OnPress", false);
             UICamera.Notify(base.gameObject, "OnHover", false);
         }
         else
         {
             this.mDragging = true;
             this.OnDragDropStart();
         }
     }
 }
Exemplo n.º 9
0
 protected virtual void StartDragging()
 {
     if (!interactable || mDragging)
     {
         return;
     }
     if (cloneOnDrag)
     {
         mPressed = false;
         GameObject gameObject = NGUITools.AddChild(base.transform.parent.gameObject, base.gameObject);
         gameObject.transform.localPosition = base.transform.localPosition;
         gameObject.transform.localRotation = base.transform.localRotation;
         gameObject.transform.localScale    = base.transform.localScale;
         UIButtonColor component = gameObject.GetComponent <UIButtonColor>();
         if (component != null)
         {
             component.defaultColor = GetComponent <UIButtonColor>().defaultColor;
         }
         if (mTouch != null && mTouch.pressed == base.gameObject)
         {
             mTouch.current = gameObject;
             mTouch.pressed = gameObject;
             mTouch.dragged = gameObject;
             mTouch.last    = gameObject;
         }
         UIDragDropItem component2 = gameObject.GetComponent <UIDragDropItem>();
         component2.mTouch    = mTouch;
         component2.mPressed  = true;
         component2.mDragging = true;
         component2.Start();
         component2.OnDragDropStart();
         if (UICamera.currentTouch == null)
         {
             UICamera.currentTouch = mTouch;
         }
         mTouch = null;
         UICamera.Notify(base.gameObject, "OnPress", false);
         UICamera.Notify(base.gameObject, "OnHover", false);
     }
     else
     {
         mDragging = true;
         OnDragDropStart();
     }
 }
Exemplo n.º 10
0
 private void OnDragStart()
 {
     if (!base.enabled || this.mTouchID != -2147483648)
     {
         return;
     }
     if (this.restriction != UIDragDropItem.Restriction.None)
     {
         if (this.restriction == UIDragDropItem.Restriction.Horizontal)
         {
             Vector2 totalDelta = UICamera.currentTouch.totalDelta;
             if (Mathf.Abs(totalDelta.x) < Mathf.Abs(totalDelta.y))
             {
                 return;
             }
         }
         else if (this.restriction == UIDragDropItem.Restriction.Vertical)
         {
             Vector2 totalDelta2 = UICamera.currentTouch.totalDelta;
             if (Mathf.Abs(totalDelta2.x) > Mathf.Abs(totalDelta2.y))
             {
                 return;
             }
         }
         else if (this.restriction == UIDragDropItem.Restriction.PressAndHold && this.mPressTime + 1f > RealTime.time)
         {
             return;
         }
     }
     if (this.cloneOnDrag)
     {
         GameObject gameObject = NGUITools.AddChild(base.transform.parent.gameObject, base.gameObject);
         gameObject.transform.localPosition = base.transform.localPosition;
         gameObject.transform.localRotation = base.transform.localRotation;
         gameObject.transform.localScale    = base.transform.localScale;
         XUIDragDropItem xUIDragDropItem  = base.gameObject.GetComponent("XUIDragDropItem") as XUIDragDropItem;
         XUIDragDropItem xUIDragDropItem2 = gameObject.GetComponent("XUIDragDropItem") as XUIDragDropItem;
         if (xUIDragDropItem != null && xUIDragDropItem2 != null)
         {
             xUIDragDropItem2.m_OnFinishHandler = xUIDragDropItem.m_OnFinishHandler;
             xUIDragDropItem2.m_OnStartHandler  = xUIDragDropItem.m_OnStartHandler;
         }
         XUISprite xUISprite  = base.gameObject.GetComponent("XUISprite") as XUISprite;
         XUISprite xUISprite2 = gameObject.GetComponent("XUISprite") as XUISprite;
         if (xUISprite != null && xUISprite2 != null)
         {
             xUISprite2.ID = xUISprite.ID;
         }
         UIWidget[] componentsInChildren = gameObject.GetComponentsInChildren <UIWidget>();
         UIWidget[] array = componentsInChildren;
         for (int i = 0; i < array.Length; i++)
         {
             UIWidget uIWidget = array[i];
             uIWidget.depth += 200;
         }
         UIButtonColor component = gameObject.GetComponent <UIButtonColor>();
         if (component != null)
         {
             component.defaultColor = base.GetComponent <UIButtonColor>().defaultColor;
         }
         UICamera.currentTouch.dragged = gameObject;
         UIDragDropItem component2 = gameObject.GetComponent <UIDragDropItem>();
         component2.Start();
         component2.OnDragDropStart();
     }
     else
     {
         this.OnDragDropStart();
     }
 }
Exemplo n.º 11
0
 public virtual void StartDragging()
 {
     //IL_002a: Unknown result type (might be due to invalid IL or missing references)
     //IL_002f: Unknown result type (might be due to invalid IL or missing references)
     //IL_0034: Unknown result type (might be due to invalid IL or missing references)
     //IL_003a: Unknown result type (might be due to invalid IL or missing references)
     //IL_003f: Expected O, but got Unknown
     //IL_003f: Expected O, but got Unknown
     //IL_0046: Unknown result type (might be due to invalid IL or missing references)
     //IL_004c: Unknown result type (might be due to invalid IL or missing references)
     //IL_0051: Unknown result type (might be due to invalid IL or missing references)
     //IL_005c: Unknown result type (might be due to invalid IL or missing references)
     //IL_0062: Unknown result type (might be due to invalid IL or missing references)
     //IL_0067: Unknown result type (might be due to invalid IL or missing references)
     //IL_0072: Unknown result type (might be due to invalid IL or missing references)
     //IL_0078: Unknown result type (might be due to invalid IL or missing references)
     //IL_007d: Unknown result type (might be due to invalid IL or missing references)
     //IL_00a1: Unknown result type (might be due to invalid IL or missing references)
     //IL_00c2: Unknown result type (might be due to invalid IL or missing references)
     //IL_014b: Unknown result type (might be due to invalid IL or missing references)
     //IL_015b: Expected O, but got Unknown
     //IL_0161: Unknown result type (might be due to invalid IL or missing references)
     //IL_0171: Expected O, but got Unknown
     if (interactable && !mDragging)
     {
         if (cloneOnDrag)
         {
             mPressed = false;
             GameObject val = NGUITools.AddChild(this.get_transform().get_parent().get_gameObject(), this.get_gameObject());
             val.get_transform().set_localPosition(this.get_transform().get_localPosition());
             val.get_transform().set_localRotation(this.get_transform().get_localRotation());
             val.get_transform().set_localScale(this.get_transform().get_localScale());
             UIButtonColor component = val.GetComponent<UIButtonColor>();
             if (component != null)
             {
                 component.defaultColor = this.GetComponent<UIButtonColor>().defaultColor;
             }
             if (mTouch != null && mTouch.pressed == this.get_gameObject())
             {
                 mTouch.current = val;
                 mTouch.pressed = val;
                 mTouch.dragged = val;
                 mTouch.last = val;
             }
             UIDragDropItem component2 = val.GetComponent<UIDragDropItem>();
             component2.mTouch = mTouch;
             component2.mPressed = true;
             component2.mDragging = true;
             component2.Start();
             component2.OnDragDropStart();
             if (UICamera.currentTouch == null)
             {
                 UICamera.currentTouch = mTouch;
             }
             mTouch = null;
             UICamera.Notify(this.get_gameObject(), "OnPress", false);
             UICamera.Notify(this.get_gameObject(), "OnHover", false);
         }
         else
         {
             mDragging = true;
             OnDragDropStart();
         }
     }
 }
Exemplo n.º 12
0
    /// <summary>
    /// Start the dragging operation.
    /// </summary>

    public virtual void StartDragging()
    {
        if (!interactable)
        {
            return;
        }

        if (!mDragging)
        {
            if (cloneOnDrag)
            {
                mPressed = false;
                GameObject clone = transform.parent.gameObject.AddChild(gameObject);
                clone.transform.localPosition = transform.localPosition;
                clone.transform.localRotation = transform.localRotation;
                clone.transform.localScale    = transform.localScale;
                Transform cloneTF = clone.transform.FindRecursively("icon");
                if (cloneTF)
                {
                    UISprite cloneSprite = clone.GetComponent <UISprite>();
                    UISprite iconSprite  = cloneTF.GetComponent <UISprite>();
                    cloneSprite.depth = cloneSprite.depth + 2;
                    iconSprite.depth  = iconSprite.depth + 2;
                }
                UIButtonColor bc = clone.GetComponent <UIButtonColor>();
                if (bc != null)
                {
                    bc.defaultColor = GetComponent <UIButtonColor>().defaultColor;
                }

                if (mTouch != null && mTouch.pressed == gameObject)
                {
                    mTouch.current = clone;
                    mTouch.pressed = clone;
                    mTouch.dragged = clone;
                    mTouch.last    = clone;
                }

                UIDragDropItem item = clone.GetComponent <UIDragDropItem>();
                item.mTouch    = mTouch;
                item.mPressed  = true;
                item.mDragging = true;
                item.Start();
                item.OnClone(gameObject);
                item.OnDragDropStart();

                if (UICamera.currentTouch == null)
                {
                    UICamera.currentTouch = mTouch;
                }

                mTouch = null;

                UICamera.Notify(gameObject, "OnPress", false);
                UICamera.Notify(gameObject, "OnHover", false);
            }
            else
            {
                mDragging = true;
                OnDragDropStart();
            }
        }
    }
Exemplo n.º 13
0
    /// <summary>
    /// Start the dragging operation.
    /// </summary>

    public virtual void StartDragging()
    {
        if (!interactable)
        {
            return;
        }

        if (!mDragging)
        {
            if (cloneOnDrag)
            {
                mPressed = false;
                GameObject clone = transform.parent.gameObject.AddChild(gameObject);
                clone.transform.localPosition = transform.localPosition;
                clone.transform.localRotation = transform.localRotation;
                clone.transform.localScale    = transform.localScale;

                UIButtonColor bc = clone.GetComponent <UIButtonColor>();
                if (bc != null)
                {
                    bc.defaultColor = GetComponent <UIButtonColor>().defaultColor;
                }

                if (mTouch != null && mTouch.pressed == gameObject)
                {
                    mTouch.current = clone;
                    mTouch.pressed = clone;
                    mTouch.dragged = clone;
                    mTouch.last    = clone;
                }

                // OCTOBOX MODIFICATION
                // Remove anchoring from the cloned item or else item won't be draggable
                UIWidget widget = clone.GetComponent <UIWidget>();
                if (widget != null)
                {
                    widget.SetAnchor((GameObject)null);
                }


                UIDragDropItem item = clone.GetComponent <UIDragDropItem>();
                item.mTouch    = mTouch;
                item.mPressed  = true;
                item.mDragging = true;
                item.OnClonedFrom(this);                                 // OCTOBOX MODIFICATION: pass custom data to a cloned object.
                item.Start();
                item.OnClone(gameObject);
                item.OnDragDropStart();

                if (UICamera.currentTouch == null)
                {
                    UICamera.currentTouch = mTouch;
                }

                mTouch = null;

                UICamera.Notify(gameObject, "OnPress", false);
                UICamera.Notify(gameObject, "OnHover", false);
            }
            else
            {
                mDragging = true;
                OnDragDropStart();
            }
        }
    }