ItemContainer - SocialPlay/CloudGoodsUnitySDK GitHub Wiki

ItemContainer is the main class used for cloud goods item containers. It handles all of the events call when adding, removing, and modifying items in the container.

Public Variables

public int ItemQuantityLimit - The int amount of the max number of items can be in the item quantity in this container

public bool IsItemQuantityLimited - True if the developer wants a quantity limit on items, false if the item quantity per stack can be unlimited.

public PersistantItemContainer - If set will enable the container to save and load items from the database

public List<ItemData> containerItems - All of the items that are stored in the item container

public List<IContainerRestrictions> containerAddRestrictions - A list of all the restrictions that are checdk when adding an item to the container

public List<IContainerRestrictions> containerRemoveRestrictions - A list of all the restrictions that are checdk when removing an item to the container

public IContainerAddAction containerAddAction - The logic that is used when adding an item to the itemContainer, if not set will automatically be set as a BasicAddAction

Public Events

public event Action<ItemData, bool> AddedItem - This event gets fired off when an item is attempting to get added to this container

public event Action<ItemData, bool> RemovedItem - This event gets fired off when an item is attempting to get removed from this container

public event Action<ItemData, bool> AddedItem - This event gets fired off when an item is attempting to get modified in this container

public event Action ClearItems - This event gets fired off when all the items have been cleared from the item container

Public Functions

public void Add - Adds an item to the container

public void Remove - Removes an item that is located in the container

public int Contains - Returns an int amount of the quantity of an item in the container

public void RefreshContainer - Loads all items of the container from the database

public void Clear - Clears all contents locally of the item container