Exemplo n.º 1
0
        public void OnDrop(PointerEventData eventData)
        {
            if (ItemObject.StartDragSlot == null)
            {
                return;
            }

            if (!ItemObject.StartDragSlot.Equals(this))
            {
                if (this.ItemObjectInSlot == null)
                {
                    if (this.TryInsertItem(ItemObject.DraggedItemObject.Item))
                    {
                        this.DropItemObject(ItemObject.DraggedItemObject);
                        ItemObject.StartDragSlot.GrabItemObject();

                        ItemObject.DragComplete();
                    }
                }
                else
                {
                    if (this.TryChangeItems(ItemObject.DraggedItemObject))
                    {
                        ItemObject tempItem = this.ItemObjectInSlot;

                        this.GrabItemObject();
                        this.DropItemObject(ItemObject.DraggedItemObject);
                        ItemObject.StartDragSlot.DropItemObject(tempItem);

                        ItemObject.DragComplete();
                    }
                }
            }
        }
Exemplo n.º 2
0
 public void OnDrop(PointerEventData eventData)
 {
     ItemObject.DraggedItemObject.Remove();
     ItemObject.StartDragSlot.GrabItemObject();
     ItemObject.DragComplete();
 }