Exemplo n.º 1
0
    public void SetItem(ItemStack itemStack, bool isSelected, ItemEventChannelSo selectItemEvent)
    {
        UnhoverItem();

        currentItem = itemStack;

        imgSelected.gameObject.SetActive(isSelected);

        itemPreviewImage.sprite   = itemStack.Item.PreviewImage;
        itemTitle.StringReference = itemStack.Item.Name;
        itemCount.text            = itemStack.Amount.ToString();
        bgImage.color             = itemStack.Item.ItemType.TypeColor;

        itemButton.onClick.RemoveAllListeners();

        itemButton.onClick.AddListener(() =>
        {
            SelectItem();
            UnhoverItem();
            selectItemEvent.RaiseEvent(currentItem.Item);
        });
    }