Exemplo n.º 1
0
 private bool CheckEnd(AnimalDragItem targetObj)
 {
     if (targetObj.Type == 1)
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 2
0
        protected override void StartDragging()
        {
            if (!CheckStart())
            {
                return;
            }
            if (!interactable)
            {
                return;
            }

            if (!mDragging)
            {
                mPressed = false;
                var clone    = NGUITools.AddChild(mTransform.parent.gameObject, Ico);
                var worldPos = UICamera.currentCamera.ScreenToWorldPoint(UICamera.lastTouchPosition);
                var localPos = mTransform.parent.InverseTransformPoint(worldPos);

                var cloneTrans = clone.transform;
                cloneTrans.localPosition = localPos;
                cloneTrans.localRotation = mTransform.localRotation;
                cloneTrans.localScale    = mTransform.localScale;

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

                AnimalDragItem item = null;
                item        = clone.GetComponent <AnimalDragItem>() ?? clone.AddComponent <AnimalDragItem>();
                item.mTouch = mTouch;
                if (item.ItemCell == null)
                {
                    item.ItemCell = item.gameObject.AddComponent <AnimalItemCell>();
                }
                if (ItemCell.ItemData == null)
                {
                    item.ItemCell.ItemData = ItemCell.ListItem.Item as ElfItemDataModel;
                }
                else
                {
                    item.ItemCell.ItemData = ItemCell.ItemData;
                }

                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);
            }
        }