UserInventory
Here you will find Methods, Classes, etc. for working with iDos Games SDK code.
Method or Class – Green
Event – Yellow
Field (variable) – Orange
Important – Red
All actions and storage of user inventory data are controlled by this class.
- Subscribe to an event
*You should subscribe to events in “OnEnable” and unsubscribe in “OnDisable” methods.
UserInventory.InventoryUpdated += OnInventoryUpdated;
UserInventory.SuccessSubtractVirtualCurrency += OnSuccessSubtractVC;
UserInventory.ErrorSubtractVirtualCurrency += OnErrorSubtractVC;
InventoryUpdated – inventory data is ready to use.
- VIP status
bool hasVIPStatus = UserInventory.HasVIPStatus;
HasVIPStatus (bool) – returns the status of the user, whether there is a VIP or not.
- Item Quantity
UserInventory.GetItemAmount(itemID);
GetItemAmount – Returns the amount of a specific item in the user’s inventory by item id.
- Amount of virtual currency
UserInventory.GetVirtualCurrencyAmount("IG");
or
UserInventory.GetVirtualCurrencyAmount(VirtualCurrencyID.IG);
GetVirtualCurrencyAmount – returns the amount of virtual currency the user has. You can get it via string or enum, both options are given above.
- Number of tickets for the main spin
UserInventory.GetSpinTicketAmount(SpinTicketType.Premium);
GetSpinTicketAmount – returns the number of tickets to spin the main spin. It is possible to receive through enum.
- Number of key fragments for chests
UserInventory.GetChestKeyFragmentAmount(ChestKeyFragmentType.Common_1);
GetChestKeyFragmentAmount – returns the number of key fragments to open chests. It is possible to receive through enum.
- Subtract virtual currency from user
UserInventory.SubtractVirtualCurrency("CO", 10);
or
UserInventory.SubtractVirtualCurrency(VirtualCurrencyID.CO, 5);
UserInventory.SuccessSubtractVirtualCurrency += OnSuccessSubtractVC;
UserInventory.ErrorSubtractVirtualCurrency += OnErrorSubtractVC;
SubtractVirtualCurrency – debits the user’s virtual currency. Can be called via string or enum, both options are given above.
SuccessSubtractVirtualCurrency – the virtual currency was successfully subtracted after calling the “SubtractVirtualCurrency” method.
ErrorSubtractVirtualCurrency – Failed to subtract virtual currency after calling “SubtractVirtualCurrency” method.