Exemplo n.º 1
0
    private void OnClickBroadcastButtonPress()
    {
        associatedItemListing.Remove(1);

        this.UpdateDisplay();

        ItemEventArgs args = new ItemEventArgs
        {
            ItemToPass   = associatedItemListing.Item,
            AmountToPass = 1
        };

        if (associatedItemListing.IsEmpty)
        {
            FinalPossiblePress.BroadcastEvent(this, args);

            Destroy(gameObject);
        }

        InventoryButtonPressed.BroadcastEvent(this, args);
    }
Exemplo n.º 2
0
    public void RemoveFromInventory(int itemId, int amount = 1)
    {
        if (Owned(itemId))
        {
            ItemListing listing = inventoryListingsByItemId[itemId];

            listing.Remove(amount);

            bool remove = listing.IsEmpty;

            var adjustment = InventoryAdjustment.UPDATE;

            if (remove)
            {
                inventoryListingsByItemId.Remove(itemId);
                adjustment = InventoryAdjustment.REMOVE;
            }

            var adjustmentArgs = new InventoryAdjustmentEventArgs(listing, adjustment);

            InventoryAdjusted.BroadcastEvent(this, adjustmentArgs);
        }
    }