Exemplo n.º 1
0
 /// <summary>
 /// Removes the items form the crafting grid one an item has been removed from the crafting result slot, Called via the <see cref="craftingResultRemoved"/> <see cref="delegate"/> from <see cref="InventorySlot.OnPointerClick(UnityEngine.EventSystems.PointerEventData)"/>
 /// </summary>
 public void CraftedItemRemoved()
 {
     if (items.itemsInInventory[9] != null)
     {
         QuestEvents.CallItemCraftedEvent(items.itemsInInventory[9].GetHashCode());
         for (int i = 0; i < 9; i++)
         {
             if (items.itemsInInventory[i] != null)
             {
                 items.itemsInInventory[i].itemStackCount -= 1;
             }
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Gives extra functionality to the base slot
        /// </summary>
        /// <param name="eventData"></param>
        public override void OnPointerClick(PointerEventData eventData)
        {
            //* recored what item was in the slot before it is moved
            Item before = item;

            base.OnPointerClick(eventData);

            //* if the item is different now then the crafting result must have been removed so call the event
            if (before != item && before != null)
            {
                ((CraftingTableInventory)myInventory).craftingResultRemoved.Invoke();
            }

            if (before is Bee b)
            {
                QuestEvents.CallBeeCraftedEvent(b.normalBee?.pSpecies ?? b.queenBee.queen.pSpecies);
            }
            else
            {
                QuestEvents.CallItemCraftedEvent(before.GetHashCode());
            }
        }