Beispiel #1
0
        public void OnDrop(DragData data)
        {
            var slot = data.DragTarget as Slot;

            if (slot)
            {
                var take = slot.Take(Volume);
                Put(take);
                slot.Put(take); // Put the rest back to source
            }
        }
Beispiel #2
0
        public void UpdateDragging(DragData data)
        {
            if (!DraggingIcon)
            {
                DraggingIcon = Utility.Instantiate(DragIconPrefab, gameObject);
            }
            Vector2 pos;

            RectTransformUtility.ScreenPointToLocalPointInRectangle(transform as RectTransform, Input.mousePosition, GetComponent <Canvas>().worldCamera, out pos);
            DraggingIcon.transform.position            = GetComponent <Canvas>().transform.TransformPoint(pos);
            DraggingIcon.GetComponent <Image>().sprite = data.DragIamge;
        }
Beispiel #3
0
        public bool Accept(DragData data)
        {
            UpdateItem();
            var items = data.Data as ItemWrapper;

            if (items == null)
            {
                return(false);
            }
            else if (Item.Item == null && ((data.Data as ItemWrapper).Item.Type | AcceptType) == AcceptType)
            {
                return(true);
            }
            else if (Item.Item == items.Item)
            {
                return(true);
            }
            return(false);
        }