示例#1
0
    public void Hide()
    {
        List <Item> items = GetItemsInSlots();

        for (int i = 0; i < items.Count; i++)
        {
            Inventory.AddItem(items[i].Id);
        }

        if (currentSelectedSlot != null)
        {
            currentSelectedSlot.RestoreDefaultSprite();
        }

        currentSelectedSlot = null;

        slot0.SelectItem(null);
        slot1.SelectItem(null);
        slot2.SelectItem(null);
        ClearResultSlot();

        inventoryPanel.Hide();
        gameObject.SetActive(false);

        if (!GameTimer.timeReached)
        {
            CharacterController2D.EnableMovement();
            interactionController.EnableInteracting();
        }
    }
示例#2
0
    public void OnItemSelected(Item item)
    {
        ClearResultSlot();

        if (currentSelectedSlot != null)
        {
            currentSelectedSlot.RestoreDefaultSprite();

            if (item != null)
            {
                if (currentSelectedSlot.HasItem())
                {
                    Inventory.AddItem(currentSelectedSlot.GetItem().Id);
                }

                currentSelectedSlot.SelectItem(item);
                SelectNextMixingSlot();
                Inventory.RemoveItem(item.Id);
                inventoryPanel.Refresh();
            }
            else
            {
                EventSystem.current.SetSelectedGameObject(currentSelectedSlot.gameObject);
            }
        }

        currentSelectedSlot = null;
    }