Inventory

Retrieving User’s purchased Items

For this, you need to add an InventoryModule in Initialisation. Refer Initialise the RGN SDK.
RGNCoreBuilder.AddModule(new InventoryModule());

API call:

InventoryModule inventoryModule = RGNCoreBuilder.I.GetModule<InventoryModule>();
RGNUserGameItems userGameItems = await inventoryModule.GetUserItems();
Above function retrieves List of ids that user already purchased. (Id can be mapped with Constant Items’s Id Get Virtual Items
For sample implementation, refer to the InventoryTestPopUp Panel in our demo scene. Greyed Item is not owned by the user.

Equip an Item

This will be used as a current selected Item for game play.
Similar to buying an Item, It requires Id that the user wants to equip. It can equip multiple Items. In response it will retrieve all equipped items.

API call:

InventoryModule inventoryModule = RGNCoreBuilder.I.GetModule<InventoryModule>();
RGNEquipItemResult equipItemResult = await inventoryModule.EquipItem(itemId);

Retrieve all equipped items

API call:

InventoryModule inventoryModule = RGNCoreBuilder.I.GetModule<InventoryModule>();
RGNUserEquippedGameItems userEquippedGameItems = await inventoryModule.GetUserEquippedItems();

Upgrade a User Purchased Item.

This will be used to add booster in any purchased items.
Similar to buying an Item, It requires an Id that the user wants to add an Upgrade, a custom upgradeId, upgradeLevel and upgrade Cost.

API call:

InventoryModule inventoryModule = RGNCoreBuilder.I.GetModule<InventoryModule>();
// Required Parameter
// inventoryModule.UpgradeGameItem(itemId,upgradeId,upgradeLevel,upgradePrice);
RGNUpgradeGameItemResult result = await inventoryModule.UpgradeGameItem("Car01", "boost", 25, new RGNCurrency()
{
name = "coin",
quantity = 15
});

Details:

  • itemId : Item’s unique id.
  • upgradeId : uniqueId for each upgrade Type.
  • upgradeLevel : Level to be upgraded. (You need to increment level and send the level that you want to save)
  • upgradePrice : Cost to purchase that upgrade (Must provide, valid currency name and quantity)
Copy link
On this page
Retrieving User’s purchased Items
Equip an Item
Retrieve all equipped items
Upgrade a User Purchased Item.