Package com.bitheads.braincloud.services
Class VirtualCurrencyService
java.lang.Object
com.bitheads.braincloud.services.VirtualCurrencyService
public class VirtualCurrencyService extends Object
-
Constructor Summary
Constructors Constructor Description VirtualCurrencyService(BrainCloudClient client) -
Method Summary
Modifier and Type Method Description voidawardCurrency(String vcId, int vcAmount, IServerCallback callback)Award player the passed-in amount of currency.voidconsumeCurrency(String vcId, int vcAmount, IServerCallback callback)Consume the passed-in amount of currency from the player.voidgetCurrency(String vcId, IServerCallback callback)Retrieve the user's currency account.voidgetParentCurrency(String vcId, String levelName, IServerCallback callback)Retrieve the parent user's currency account.voidgetPeerCurrency(String vcId, String peerCode, IServerCallback callback)Retrieve the peer user's currency account.voidresetCurrency(IServerCallback callback)Resets the player's currency to 0.
-
Constructor Details
-
VirtualCurrencyService
-
-
Method Details
-
getCurrency
Retrieve the user's currency account. Optional parameters: vcId (if retrieving all currencies). Service Name - VirtualCurrency Service Operation - GetCurrency- Parameters:
vcId- The currency type to retrieve or null if all currency types are being requested.callback- The method to be invoked when the server response is received
-
getParentCurrency
Retrieve the parent user's currency account. Optional parameters: vcId (if retrieving all currencies). Service Name - VirtualCurrency Service Operation - GetParentCurrency- Parameters:
vcId- The currency type to retrieve or null if all currency types are being requested.levelName- Name of the parent level.callback- The method to be invoked when the server response is received
-
getPeerCurrency
Retrieve the peer user's currency account. Optional parameters: vcId (if retrieving all currencies). Service Name - VirtualCurrency Service Operation - GetPeerCurrency- Parameters:
vcId- The currency type to retrieve or null if all currency types are being requested.peerCode- Name of the peercallback- The method to be invoked when the server response is received
-
resetCurrency
Resets the player's currency to 0. Service Name - VirtualCurrency Service Operation - ResetCurrency- Parameters:
callback- The method to be invoked when the server response is received
-
awardCurrency
Award player the passed-in amount of currency. Returns an object representing the new currency values. Note: Awarding 0 or negative currency will return an error. Use ConsumeCurrency to remove currency values. Service Name - VirtualCurrency Service Operation - GetPeerCurrency Warning, Method is recommended to be used in Cloud Code only for security If you need to use it client side, enable 'Allow Currency Calls from Client' on the brainCloud dashboard- Parameters:
vcId- The currency type to award.vcAmount- The amount of currency to award.callback- The method to be invoked when the server response is received
-
consumeCurrency
Consume the passed-in amount of currency from the player. Note: Consuming 0 or negative currency will return an error. Use AwardCurrency to add currency values. Service Name - VirtualCurrency Service Operation - GetPeerCurrency Warning, Method is recommended to be used in Cloud Code only for security If you need to use it client side, enable 'Allow Currency Calls from Client' on the brainCloud dashboard- Parameters:
vcId- The currency type to consume.vcAmount- The amount of currency to consume.callback- The method to be invoked when the server response is received
-