コード例 #1
0
    public void CraftBtnClicked()
    {
        CraftingSlot selectedSlot = craftsHandler.GetSlotSelected();

        foreach (Item s in selectedSlot.GetRecipe())
        {
            Item removedItem = inventoryManager.GetItem(s);
            inventoryManager.RemoveItem(removedItem);
        }
        inventoryManager.AddItem(selectedSlot.GetItem());
        craftButton.interactable = false;
        if (selectedSlot.GetItem().IsSameAs(Resources.Load <Gear>("Items/Gear/Radio")))
        {
            pop.PopMessage(PopupSystem.Popup.Radio);
        }
        UpdateCraftable();
    }
コード例 #2
0
    public void SlotSelected()
    {
        CraftingSlot selectedSlot = craftsHandler.GetSlotSelected();
        Item         selectedItem = selectedSlot.GetItem();

        descBackground.SetActive(true);
        nameText.SetText(selectedItem.name);
        descriptionText.SetText(selectedItem.GetDescription());
        itemPreview.sprite = selectedItem.GetSprite();
        if (selectedSlot.GetIsCraftable())
        {
            craftButton.interactable = true;
        }
        else
        {
            craftButton.interactable = false;
        }
        numbersHandler.Show(selectedSlot);
    }