Beamable SDK
Public Member Functions | Public Attributes | Properties | List of all members
Beamable.Common.Api.Inventory.InventoryUpdateBuilder Class Reference

This type defines the Inventory feature's updates. More...

Inheritance diagram for Beamable.Common.Api.Inventory.InventoryUpdateBuilder:
Inheritance graph
[legend]
Collaboration diagram for Beamable.Common.Api.Inventory.InventoryUpdateBuilder:
Collaboration graph
[legend]

Public Member Functions

 InventoryUpdateBuilder (Dictionary< string, long > currencies, Dictionary< string, List< CurrencyProperty > > currencyProperties, List< ItemCreateRequest > newItems, List< ItemDeleteRequest > deleteItems, List< ItemUpdateRequest > updateItems)
 
InventoryUpdateBuilder ApplyVipBonus (bool apply)
 Mutate the InventoryUpdateBuilder's applyVipBonus field. When the vip bonus is enabled, any currencies configured with the CurrencyChange method will have vip bonus multipliers included in the reward. More...
 
InventoryUpdateBuilder CurrencyChange (string contentId, long amount)
 Add or remove currency from the player's inventory. Multiple calls to this method for the same currency will combine into one currency update. More...
 
InventoryUpdateBuilder SetCurrencyProperties (string contentId, List< CurrencyProperty > properties)
 Set the CurrencyProperty values for a currency. This will overwrite the previous currency properties. More...
 
InventoryUpdateBuilder AddItem (string contentId, Dictionary< string, string > properties=null, string requestId=null)
 Add an item instance to the inventory. More...
 
InventoryUpdateBuilder AddItem (ItemRef itemRef, Dictionary< string, string > properties=null)
 Add an item instance to the inventory. More...
 
InventoryUpdateBuilder DeleteItem (string contentId, long itemId)
 Remove a specific item instance from the inventory More...
 
InventoryUpdateBuilder DeleteItem< TContent > (long itemId)
 Remove a specific item instance from the inventory More...
 
InventoryUpdateBuilder DeleteItem< TContent > (InventoryObject< TContent > item)
 Remove a specific item instance from the inventory More...
 
InventoryUpdateBuilder UpdateItem (string contentId, long itemId, Dictionary< string, string > properties)
 Update the instance properties of a specific item More...
 
InventoryUpdateBuilder UpdateItem< TContent > (long itemId, Dictionary< string, string > properties)
 Update the instance properties of a specific item More...
 
InventoryUpdateBuilder UpdateItem< TContent > (InventoryObject< TContent > item)
 Update the instance properties of a specific item More...
 

Public Attributes

readonly SerializableDictionaryStringToLong currencies
 
readonly SerializedDictionaryStringToCurrencyPropertyList currencyProperties
 
readonly List< ItemCreateRequestnewItems
 
readonly List< ItemDeleteRequestdeleteItems
 
readonly List< ItemUpdateRequestupdateItems
 
bool? applyVipBonus
 

Properties

bool IsEmpty [get]
 Checks if the InventoryUpdateBuilder has any inventory updates. True if there are no updates, false otherwise.
 

Detailed Description

This type defines the Inventory feature's updates.

Related Links

img beamable-logo

Member Function Documentation

◆ AddItem() [1/2]

InventoryUpdateBuilder Beamable.Common.Api.Inventory.InventoryUpdateBuilder.AddItem ( ItemRef  itemRef,
Dictionary< string, string >  properties = null 
)

Add an item instance to the inventory.

Parameters
itemRefAn ItemRef for the item type
propertiesA set of instance level item properties
Returns
The mutated InventoryUpdateBuilder

◆ AddItem() [2/2]

InventoryUpdateBuilder Beamable.Common.Api.Inventory.InventoryUpdateBuilder.AddItem ( string  contentId,
Dictionary< string, string >  properties = null,
string  requestId = null 
)
inline

Add an item instance to the inventory.

Parameters
contentIdThe content ID for an item type
propertiesA set of instance level item properties
requestIdAn ID that symbolizes the addition of the item. By default, this will be set to a random GUID.
Returns
The mutated InventoryUpdateBuilder

◆ ApplyVipBonus()

InventoryUpdateBuilder Beamable.Common.Api.Inventory.InventoryUpdateBuilder.ApplyVipBonus ( bool  apply)
inline

Mutate the InventoryUpdateBuilder's applyVipBonus field. When the vip bonus is enabled, any currencies configured with the CurrencyChange method will have vip bonus multipliers included in the reward.

Parameters
applytrue to have currencies apply vip bonus, false otherwise
Returns
The mutated InventoryUpdateBuilder

◆ CurrencyChange()

InventoryUpdateBuilder Beamable.Common.Api.Inventory.InventoryUpdateBuilder.CurrencyChange ( string  contentId,
long  amount 
)
inline

Add or remove currency from the player's inventory. Multiple calls to this method for the same currency will combine into one currency update.

For example, if you changed up by 5, and then changed up again by 5, the final result would be 10

Parameters
contentIdThe content ID for a currency value
amountThe amount to change the given currency. Positive numbers add currency, and negative numbers subtract currency.
Returns
The mutated InventoryUpdateBuilder

◆ DeleteItem()

InventoryUpdateBuilder Beamable.Common.Api.Inventory.InventoryUpdateBuilder.DeleteItem ( string  contentId,
long  itemId 
)
inline

Remove a specific item instance from the inventory

Parameters
contentIdThe content ID for an item type
itemIdThe item instance ID
Returns
The mutated InventoryUpdateBuilder

◆ DeleteItem< TContent >() [1/2]

Remove a specific item instance from the inventory

Parameters
itemThe InventoryObject<TContent> to remove from the inventory
Template Parameters
TContentThe type of item to remove
Returns
The mutated InventoryUpdateBuilder
Type Constraints
TContent :ItemContent 
TContent :new() 

◆ DeleteItem< TContent >() [2/2]

Remove a specific item instance from the inventory

Parameters
itemIdThe item instance ID
Template Parameters
TContentThe type of item to remove
Returns
The mutated InventoryUpdateBuilder
Type Constraints
TContent :ItemContent 
TContent :new() 

◆ SetCurrencyProperties()

InventoryUpdateBuilder Beamable.Common.Api.Inventory.InventoryUpdateBuilder.SetCurrencyProperties ( string  contentId,
List< CurrencyProperty properties 
)
inline

Set the CurrencyProperty values for a currency. This will overwrite the previous currency properties.

Parameters
contentIdThe content ID for a currency value
propertiesA list of CurrencyProperty values
Returns
The mutated InventoryUpdateBuilder

◆ UpdateItem()

InventoryUpdateBuilder Beamable.Common.Api.Inventory.InventoryUpdateBuilder.UpdateItem ( string  contentId,
long  itemId,
Dictionary< string, string >  properties 
)
inline

Update the instance properties of a specific item

Parameters
contentIdThe content ID for an item type
itemIdThe item instance ID
propertiesThe new instance properties for the item. This will overwrite the existing properties.
Returns
The mutated InventoryUpdateBuilder

◆ UpdateItem< TContent >() [1/2]

Update the instance properties of a specific item

Parameters
itemThe InventoryObject<TContent> to remove from the inventory
Template Parameters
TContentThe type of item to remove
Returns
The mutated InventoryUpdateBuilder
Type Constraints
TContent :ItemContent 
TContent :new() 

◆ UpdateItem< TContent >() [2/2]

InventoryUpdateBuilder Beamable.Common.Api.Inventory.InventoryUpdateBuilder.UpdateItem< TContent > ( long  itemId,
Dictionary< string, string >  properties 
)
inline

Update the instance properties of a specific item

Parameters
itemIdThe item instance ID
propertiesThe new instance properties for the item. This will overwrite the existing properties.
Template Parameters
TContentThe type of item to remove
Returns
The mutated InventoryUpdateBuilder
Type Constraints
TContent :ItemContent 
TContent :new() 

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