docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class Wallet

    Static helper class for dealing with the Wallet inventory.
    Many methods are simply shortcuts for 'InventoryManager.wallet.xxx'.

    Inheritance
    object
    Wallet
    Namespace: UnityEngine.GameFoundation
    Assembly: solution.dll
    Syntax
    public static class Wallet

    Properties

    Name Description
    definition

    The InventoryDefinition of this Wallet. Determines the default InventoryItems and quantities.

    definitionHash

    Helper property for easily accessing the Wallet's InventoryDefinition Hash.

    definitionId

    Helper property for easily accessing the Id of the Wallet's InventoryDefinition.

    onItemAdded

    This is a callback that will be invoked whenever an InventoryItem is added to the Wallet.

    onItemQuantityChanged

    Callback for when an InventoryItem quantity has changed.

    onItemQuantityOverflow

    Callback for when an InventoryItem quantity has gone above its minimum.

    onItemRemoved

    This is a callback that will be invoked whenever an InventoryItem is removed from the Wallet.

    Methods

    Name Description
    AddItem(int, int)

    Adds more of the specified InventoryItemDefinition by Hash. Returns the new (or existing) InventoryItem. Returns the new InventoryItem when the InventoryItem didn't already exist in the Wallet and returns an existing reference when to the InventoryItem when the InventoryItem was already in the Wallet.

    AddItem(string, int)

    Adds a new entry of the specified InventoryItemDefinition by Id. Returns the new or existing InventoryItem. Returns the new InventoryItem when the InventoryItem didn't already exist in the Wallet and returns an existing InventoryItem when the InventoryItem was already in the Wallet.

    AddItem(InventoryItemDefinition, int)

    Adds more of the specified InventoryItemDefinition. Returns the new (or existing) InventoryItem. Returns the new InventoryItem when the InventoryItem didn't already exist in the Wallet and returns an existing reference when to the InventoryItem when the InventoryItem was already in the Wallet.

    ContainsItem(int)

    Returns whether or not an InventoryItem exists within the Wallet.

    ContainsItem(string)

    Returns whether or not an InventoryItem exists within the Wallet.

    ContainsItem(InventoryItemDefinition)

    Returns whether or not an InventoryItem exists within the Wallet for specified InventoryItemDefinition.

    GetItem(int)

    Gets an InventoryItem by InventoryItemDefinition Hash if it is contained within, otherwise returns null.

    GetItem(string)

    Gets an InventoryItem by InventoryItemDefinition reference if it is contained within, otherwise returns null.

    GetItems()

    Returns an array of all items within the wallet.

    GetItems(List<InventoryItem>)

    Fills the given list with all items found in the wallet.

    GetItemsByCategory(int)

    This will return an array of all InventoryItems that have the given Category by CategoryDefinition id hash.

    GetItemsByCategory(int, List<InventoryItem>)

    Fills the given list with items with the given category hash.

    GetItemsByCategory(string)

    Returns all an array of items in the wallet with the given category id.

    GetItemsByCategory(string, List<InventoryItem>)

    Fills the given list with items with the given category id.

    GetItemsByCategory(CategoryDefinition)

    This will return all InventoryItems that have the given Category through an array.

    GetItemsByCategory(CategoryDefinition, List<InventoryItem>)

    Fills the given list with items with the given category.

    GetQuantity(int)

    Gets the Quantity of an InventoryItem by its InventoryItemDefinition hash

    GetQuantity(string)

    Gets the Quantity of an InventoryItem by its InventoryItemDefinition id

    GetQuantity(InventoryItem)

    Gets the Quantity of an InventoryItem by its reference

    RemoveAll()

    Removes all InventoryItems from the Wallet.

    RemoveItem(int)

    Removes an entry of the specified InventoryItemefinition by Hash.

    RemoveItem(string)

    Removes an entry of the specified InventoryItem by InventoryItemDefintion id.

    RemoveItemsByCategory(int)

    This will remove all InventoryItems that have the given Category by CategoryDefinition Hash.

    RemoveItemsByCategory(string)

    This will remove all InventoryItems that have the given Category by CategoryDefinition Id.

    RemoveItemsByCategory(CategoryDefinition)

    This will remove all InventoryItems that have the given Category.

    Reset()

    Resets the contents of the Wallet.

    SetQuantity(int, int)

    Sets the quantity of the InventoryItem within this Wallet of the specified InventoryItemDefinition by Hash

    SetQuantity(string, int)

    Sets the quantity of an InventoryItem by InventoryItemDefinition Id.

    SetQuantity(InventoryItem, int)

    Sets the quantity of an InventoryItem.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)