コード例 #1
0
        /// <summary>
        /// Add an Item to the next available Slot.</summary>
        public void AddItem(SlottableItem item)
        {
            Slot slot = NextAvailableSlot();

            if (slot != null)
            {
                slot.Drop(item);
            }
        }
コード例 #2
0
 public void OnEndDrag(PointerEventData eventData)
 {
     if (!Slot.AllowsDrag)
     {
         return;
     }
     DraggedItem = null;
     _canvasGroup.blocksRaycasts = true;
     if (Slot == _startSlot)
     {
         Slot.Drop(this);
     }
 }
コード例 #3
0
        public void AddItem(SlottableItem item, string slotName = null)
        {
            Slot slot = null;

            if (slotName == null)
            {
                slot = NextAvailableSlot();
            }
            else
            {
                slot = SlotByName(slotName);
            }
            if (slot != null)
            {
                slot.Drop(item);
            }
        }
コード例 #4
0
 public void ResetSlots()
 {
     foreach (Slot slot in _slots)
     {
         if (slot.Item != null)
         {
             slot.Item.gameObject.SetActive(false);
             Items.Remove(slot.Item.Name.text);
             slot.Item.Amount = 0;
             slot.Item.Item   = null;
             SlottableItem item = slot.Item;
             slot.Clear();
             Slot target = NextAvailableSlot();
             if (target != null)
             {
                 target.Drop(item);
             }
         }
     }
 }