示例#1
0
    public void UseItem()
    {
        selectedSlot.item.Use();

        if (selectedSlot.item.isStackable)
        {
            selectedSlot.item.Count--;
            if (selectedSlot.item.Count < 1)
            {
                DeselectItem();
                itemDetailController.Close();
                RemoveItemFormiventory(selectedSlot.item);
                selectedSlot = null;
                //return;
            }
        }
        else
        {
            DeselectItem();
            itemDetailController.Close();
            RemoveItemFormiventory(selectedSlot.item);
            selectedSlot = null;
            //return;
        }

        //RefreshIvenetory();
        if (onInventoryChanged != null)
        {
            onInventoryChanged();
        }
    }