Class VirtualCurrencyService

java.lang.Object
com.bitheads.braincloud.services.VirtualCurrencyService

public class VirtualCurrencyService
extends Object
  • Constructor Details

    • VirtualCurrencyService

      public VirtualCurrencyService​(BrainCloudClient client)
  • Method Details

    • getCurrency

      public void getCurrency​(String vcId, IServerCallback callback)
      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

      public void getParentCurrency​(String vcId, String levelName, IServerCallback callback)
      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

      public void getPeerCurrency​(String vcId, String peerCode, IServerCallback callback)
      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 peer
      callback - The method to be invoked when the server response is received
    • resetCurrency

      public void resetCurrency​(IServerCallback callback)
      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

      public void awardCurrency​(String vcId, int vcAmount, IServerCallback callback)
      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

      public void consumeCurrency​(String vcId, int vcAmount, IServerCallback callback)
      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