Exemplo n.º 1
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;
    }
Exemplo n.º 2
0
 private void SelectNextMixingSlot()
 {
     if (!slot0.HasItem())
     {
         EventSystem.current.SetSelectedGameObject(slot0.gameObject);
     }
     else if (!slot1.HasItem())
     {
         EventSystem.current.SetSelectedGameObject(slot1.gameObject);
     }
     else if (!slot2.HasItem())
     {
         EventSystem.current.SetSelectedGameObject(slot2.gameObject);
     }
     else
     {
         EventSystem.current.SetSelectedGameObject(mixButton.gameObject);
     }
 }