docs.unity.cn
    Show / Hide Table of Contents

    Interface IInventoryDataLayer

    Contract for objects providing data to the IInventoryManager.

    Namespace: UnityEngine.GameFoundation
    Syntax
    public interface IInventoryDataLayer

    Methods

    CreateItem(String, String, Int64, Completer)

    Request to create a new item with the given key and id.

    Declaration
    void CreateItem(string key, string id, long quantity, Completer completer)
    Parameters
    Type Name Description
    String key

    Identifier of the definition used to create the item.

    String id

    Identifier to give to the created item.

    Int64 quantity

    Quantity of items if stackable, else 1 for non-stackable.

    Completer completer

    The handle to settle the promise with.

    CreateItemList(String, Completer)

    Request to create a new item list with the given id.

    Declaration
    void CreateItemList(string id, Completer completer)
    Parameters
    Type Name Description
    String id

    Identifier to give to the created item.

    Completer completer

    The handle to settle the promise with.

    CreateItemMap(String, Completer)

    Request to create a new item map with the given id.

    Declaration
    void CreateItemMap(string id, Completer completer)
    Parameters
    Type Name Description
    String id

    Identifier to give to the created item.

    Completer completer

    The handle to settle the promise with.

    DeleteItem(String, Completer)

    Request to delete the item matching the given id.

    Declaration
    void DeleteItem(string id, Completer completer)
    Parameters
    Type Name Description
    String id

    The identifier of the item we want to delete.

    Completer completer

    The handle to settle the promise with.

    DeleteItemList(String, Completer)

    Request to delete the item list matching the given id.

    Declaration
    void DeleteItemList(string id, Completer completer)
    Parameters
    Type Name Description
    String id

    The identifier of the item list we want to delete.

    Completer completer

    The handle to settle the promise with.

    DeleteItemMap(String, Completer)

    Request to delete the item map matching the given id.

    Declaration
    void DeleteItemMap(string id, Completer completer)
    Parameters
    Type Name Description
    String id

    The identifier of the item map we want to delete.

    Completer completer

    The handle to settle the promise with.

    GetData()

    Get InventoryManager's serializable data.

    Declaration
    InventoryManagerData GetData()
    Returns
    Type Description
    InventoryManagerData

    The player's data for the IInventoryManager.

    GetMutablePropertyValue(String, String)

    Get the mutable property with the given propertyKey of the item with the given itemId.

    Declaration
    Property GetMutablePropertyValue(string itemId, string propertyKey)
    Parameters
    Type Name Description
    String itemId

    The item's identifier.

    String propertyKey

    The mutable property's identifier.

    Returns
    Type Description
    Property

    The mutable property's value.

    Exceptions
    Type Condition
    ArgumentException

    If either itemId or propertyKey is null, empty or whitespace.

    InventoryItemNotFoundException

    If there is no item with the given itemId.

    PropertyNotFoundException

    If there is no mutable property with the given propertyKey on the item.

    ItemListAddItem(String, String, Completer)

    Request to add item to ItemList.

    Declaration
    void ItemListAddItem(string listId, string itemId, Completer completer)
    Parameters
    Type Name Description
    String listId

    id to add item to.

    String itemId

    id to add to list.

    Completer completer

    Completer for action.

    ItemListClear(String, Completer)

    Request to clear all items in ItemList.

    Declaration
    void ItemListClear(string listId, Completer completer)
    Parameters
    Type Name Description
    String listId

    id to target.

    Completer completer

    Completer for action.

    ItemListRemoveItem(String, String, Completer)

    Request to remove item from ItemList.

    Declaration
    void ItemListRemoveItem(string listId, string itemId, Completer completer)
    Parameters
    Type Name Description
    String listId

    id to remove item from.

    String itemId

    id to remove from list.

    Completer completer

    Completer for action.

    ItemListSwapIndexes(String, Int32, Int32, Completer)

    Request to swap items in ItemList.

    Declaration
    void ItemListSwapIndexes(string listId, int index0, int index1, Completer completer)
    Parameters
    Type Name Description
    String listId

    id to target.

    Int32 index0

    index of first item to swap.

    Int32 index1

    index of item to swap with.

    Completer completer

    Completer for action.

    ItemMapAddItem(String, String, String, Completer)

    Request to add item to ItemMap.

    Declaration
    void ItemMapAddItem(string mapId, string slot, string itemId, Completer completer)
    Parameters
    Type Name Description
    String mapId

    id to add item to.

    String slot

    slot to use for this item in the map.

    String itemId

    id to add to map.

    Completer completer

    Completer for action.

    ItemMapChangeSlot(String, String, String, Completer)

    Request to change item slots in ItemMap.

    Declaration
    void ItemMapChangeSlot(string mapId, string oldSlot, string newSlot, Completer completer)
    Parameters
    Type Name Description
    String mapId

    id to target.

    String oldSlot

    Old slot id of the item to swap.

    String newSlot

    New slot id of the item.

    Completer completer

    Completer for action.

    ItemMapClear(String, Completer)

    Request to clear all items in ItemMap.

    Declaration
    void ItemMapClear(string mapId, Completer completer)
    Parameters
    Type Name Description
    String mapId

    id to target.

    Completer completer

    Completer for action.

    ItemMapRemoveItem(String, String, Completer)

    Request to remove item from ItemMap.

    Declaration
    void ItemMapRemoveItem(string mapId, string slot, Completer completer)
    Parameters
    Type Name Description
    String mapId

    id to remove item from.

    String slot

    slot to remove from map.

    Completer completer

    Completer for action.

    ItemMapSwapSlots(String, String, String, Completer)

    Request to swap items in ItemMap.

    Declaration
    void ItemMapSwapSlots(string mapId, string slot0, string slot1, Completer completer)
    Parameters
    Type Name Description
    String mapId

    id to target.

    String slot0

    slot of first item to swap.

    String slot1

    slot of item to swap with.

    Completer completer

    Completer for action.

    SetMutablePropertyValue(String, String, Property, Completer)

    Request to update the mutable property with the given propertyKey of the item with the given itemId.

    Declaration
    void SetMutablePropertyValue(string itemId, string propertyKey, Property value, Completer completer)
    Parameters
    Type Name Description
    String itemId

    Item's id to update the mutable property of.

    String propertyKey

    Mutable property's key to update.

    Property value

    Value to set to the mutable property.

    Completer completer

    The handle to settle the promise with.

    SetQuantity(String, Int64, Completer)

    Request to set quantity of item matching the given id.

    Declaration
    void SetQuantity(string id, long quantity, Completer completer)
    Parameters
    Type Name Description
    String id

    The identifier of the item we want to delete.

    Int64 quantity

    New quantity of item specified.

    Completer completer

    The handle to settle the promise with.

    TryGetMutablePropertyValue(String, String, out Property)

    Get the mutable property with the given propertyKey of the item with the given itemId.

    Declaration
    bool TryGetMutablePropertyValue(string itemId, string propertyKey, out Property propertyValue)
    Parameters
    Type Name Description
    String itemId

    The item's identifier.

    String propertyKey

    The mutable property's identifier.

    Property propertyValue

    The mutable property's value found for the given identifiers.

    Returns
    Type Description
    Boolean

    True if a mutable property with the given propertyKey exists in the item with the given itemId; false otherwise.

    Back to top Copyright © 2020 Unity Technologies
    Generated by DocFX
    on 16 June 2021