Esempio n. 1
0
    public void DeselectItem(bool returnToInventory = true)
    {
        PartyMember    member      = partyPanel.LookUpSelectedPartyMember();
        HashSet <Item> playerItems = new HashSet <Item>();
        List <Item>    items       = new List <Item>();

        if (member != null)
        {
            foreach (Item item in member.GetEquipment())
            {
                items.Add(item);
            }
            playerItems = FindObjectOfType <CraftingInventory>().playerItems;
        }

        if (selectedItem != null && IsAnItemSelected())
        {
            Inventory inventoryToUse = PerformSelectCorrectInventory(selectedItem.item);
            if (returnToInventory && !items.Contains(selectedItem.item))
            {
                inventoryToUse.GiveItem(selectedItem.item.id);
            }
            selectedItem.DirectlyNullifyItem();
        }
    }
Esempio n. 2
0
    public void PutItemBackBeforeSave()
    {
        PartyMember member = partyPanel.LookUpSelectedPartyMember();

        if (IsAnItemSelected())
        {
            GiveItem(selectedItem.item);

            if (member != null)
            {
                int i = 0;
                foreach (Item item in member.GetEquipment())
                {
                    if (item != null && item == selectedItem.item)
                    {
                        member.equipment[i] = null;
                        break;
                    }
                    i++;
                }
            }
        }
        selectedItem.DirectlyNullifyItem();
    }