Beamable SDK
Public Member Functions | Properties | List of all members
Beamable.Player.PlayerInventory Class Reference

More...

Public Member Functions

 PlayerInventory (InventoryService inventoryApi, IPlatformService platformService, INotificationService notificationService, CoroutineService coroutineService, IDependencyProvider provider, CoreConfiguration config, IContentApi contentService, IConnectivityService connectivityService, ISdkEventService sdkEventService)
 
PlayerCurrency GetCurrency (CurrencyRef currencyRef)
 Get a player's currency data for a given type. More...
 
PlayerItemGroup GetItems (ItemRef itemRef=null)
 Get a category of PlayerItem for a given type. If you have subtypes of ItemContent, and you get an item group for a basetype of ItemContent, the resultant PlayerItemGroup will have all instances from all subclasses of the given type. More...
 
Promise Update (Action< InventoryUpdateBuilder > updateBuilder, string transaction=null)
 
Promise Update (InventoryUpdateBuilder updateBuilder, string transaction=null)
 Make an atomic update to the player's inventory state. If you are offline, then this function changes based on your CoreConfiguration.InventoryOfflineMode setting. More...
 
async Promise Refresh ()
 Refreshes all PlayerItemGroups that have been established using GetItems, and refreshes currencies Currencies More...
 

Properties

PlayerCurrencyGroup Currencies [get]
 

Detailed Description

The player's inventory can have Currencies, and items, which can be accessed via GetItems

Member Function Documentation

◆ GetCurrency()

PlayerCurrency Beamable.Player.PlayerInventory.GetCurrency ( CurrencyRef  currencyRef)

Get a player's currency data for a given type.

Parameters
currencyRefA CurrencyRef for the type of currency to get.
Returns
A PlayerCurrency object for the given currencyRef

◆ GetItems()

PlayerItemGroup Beamable.Player.PlayerInventory.GetItems ( ItemRef  itemRef = null)
inline

Get a category of PlayerItem for a given type. If you have subtypes of ItemContent, and you get an item group for a basetype of ItemContent, the resultant PlayerItemGroup will have all instances from all subclasses of the given type.

Parameters
itemRefAn ItemRef for the type of item to get.
Returns
a PlayerItemGroup object for the given itemRef

◆ Refresh()

async Promise Beamable.Player.PlayerInventory.Refresh ( )
inline

Refreshes all PlayerItemGroups that have been established using GetItems, and refreshes currencies Currencies

Exceptions
NotImplementedException

◆ Update() [1/2]

Promise Beamable.Player.PlayerInventory.Update ( Action< InventoryUpdateBuilder updateBuilder,
string  transaction = null 
)
inline

Parameters
updateBuilderAn action that gives you a InventoryUpdateBuilder to configure with actions to apply to the player's inventory
transactionAn optional transaction id for the operation.
Returns
A promise representing the success of the operation.

◆ Update() [2/2]

Promise Beamable.Player.PlayerInventory.Update ( InventoryUpdateBuilder  updateBuilder,
string  transaction = null 
)
inline

Make an atomic update to the player's inventory state. If you are offline, then this function changes based on your CoreConfiguration.InventoryOfflineMode setting.

Configure the InventoryUpdateBuilder with the modifications you'd like to make to the player's inventory.

Note that by default, you cannot update currency or items, because they can only be set from Beamable Microservices, or the Beamable Platform itself. However, you can mark individual CurrencyContent and ItemContent objects as editable by setting their CurrencyContent.clientPermission writeSelf property.

Parameters
updateBuilderA InventoryUpdateBuilder containing actions to apply to the player's inventory
transactionAn optional transaction id for the operation.
Returns
A promise representing the success of the operation.

The documentation for this class was generated from the following file: