예제 #1
0
    private void PlaceItem(Vector2Int item, Transform slot)
    {
        int       i  = slot.GetSiblingIndex();
        int       re = item.y;//inv.AddToSlotsAmount(inHand.x,inHand.y,i);
        Transform p  = slot.parent;
        int       o  = 0;

        if (p == slotsContainer)
        {
            re = inv.AddToSlotsAmount(item.x, item.y, i, out o);
        }
        else if (p == toolsContainer)
        {
            re = inv.AddToToolsAmount(item.x, item.y, i, out o);
        }
        else if (p == activeContainer)
        {
            re = inv.AddToActiveAmount(item.x, item.y, i, out o);
        }
        if (re != item.y)
        {
            if (re > 0)
            {
                uSlots();
            }
            else
            {
                if (p == slotsContainer)
                {
                    SetItem(inv.GetSlot(i), slotsContainer.GetChild(i));
                }
                else if (p == toolsContainer)
                {
                    uTools();
                }
                else if (p == activeContainer)
                {
                    uActive();
                }
            }
        }
        else
        {
            inv.AddToSlotsAmount(item.x, item.y, true);
            uSlots();
        }
    }