示例#1
0
文件: Slot.cs 项目: hafewa/MAJIKA
        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
            }
        }
示例#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;
        }
示例#3
0
文件: Slot.cs 项目: hafewa/MAJIKA
        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);
        }