Inventory
For this, you need to add an InventoryModule in Initialisation. Refer Initialise the RGN SDK.
RGNCoreBuilder.AddModule(new InventoryModule());
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.
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.
InventoryModule inventoryModule = RGNCoreBuilder.I.GetModule<InventoryModule>();
RGNEquipItemResult equipItemResult = await inventoryModule.EquipItem(itemId);
InventoryModule inventoryModule = RGNCoreBuilder.I.GetModule<InventoryModule>();
RGNUserEquippedGameItems userEquippedGameItems = await inventoryModule.GetUserEquippedItems();
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.
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
});
- 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)
Last modified 8mo ago