Package com.bitheads.braincloud.services
Class PlayerStatisticsService
java.lang.Object
com.bitheads.braincloud.services.PlayerStatisticsService
public class PlayerStatisticsService extends Object
-
Constructor Summary
Constructors Constructor Description PlayerStatisticsService(BrainCloudClient client) -
Method Summary
Modifier and Type Method Description voidgetNextExperienceLevel(IServerCallback callback)Returns JSON representing the next experience level for the user.voidincrementExperiencePoints(int xpValue, IServerCallback callback)Increments the user's experience.voidincrementUserStats(String jsonData, IServerCallback callback)Atomically increment (or decrement) user statistics.voidprocessStatistics(String jsonData, IServerCallback callback)Apply statistics grammar to a partial set of statistics.voidreadAllUserStats(IServerCallback callback)Read all available user statistics.voidreadUserStatsForCategory(String category, IServerCallback callback)Method retrieves the user statistics for the given category.voidreadUserStatsSubset(String[] statistics, IServerCallback callback)Reads a subset of user statistics as defined by the input collection.voidresetAllUserStats(IServerCallback callback)Reset all of the statistics for this user back to their initial value.voidsetExperiencePoints(int xpValue, IServerCallback callback)Sets the user's experience to an absolute value.
-
Constructor Details
-
PlayerStatisticsService
-
-
Method Details
-
readAllUserStats
Read all available user statistics. Service Name - PlayerStatistics Service Operation - Read- Parameters:
callback- The method to be invoked when the server response is received
-
readUserStatsSubset
Reads a subset of user statistics as defined by the input collection. Service Name - PlayerStatistics Service Operation - ReadSubset- Parameters:
statistics- A collection containing the subset of statistics to read: ex. [ "pantaloons", "minions" ]callback- The method to be invoked when the server response is received
-
readUserStatsForCategory
Method retrieves the user statistics for the given category. Service Name - PlayerStatistics Service Operation - READ_FOR_CATEGORY- Parameters:
category- The user statistics categorycallback- Method to be invoked when the server response is received.
-
resetAllUserStats
Reset all of the statistics for this user back to their initial value. Service Name - PlayerStatistics Service Operation - Reset- Parameters:
callback- The method to be invoked when the server response is received
-
incrementUserStats
Atomically increment (or decrement) user statistics. Any rewards that are triggered from user statistic increments will be considered. User statistics are defined through the brainCloud portal. Note also that the "xpCapped" property is returned (true/false depending on whether the xp cap is turned on and whether the user has hit it). Service Name - PlayerStatistics Service Operation - Update- Parameters:
jsonData- The JSON encoded data to be sent to the server as follows: { stat1: 10, stat2: -5.5, } would increment stat1 by 10 and decrement stat2 by 5.5. For the full statistics grammer see the api.braincloudservers.com site. There are many more complex operations supported such as: { stat1:INC_TO_LIMIT#9#30 } which increments stat1 by 9 up to a limit of 30.callback- The method to be invoked when the server response is received
-
incrementExperiencePoints
Increments the user's experience. If the user goes up a level, the new level details will be returned along with a list of rewards. Service Name - PlayerStatistics Service Operation - UpdateIncrement- Parameters:
xpValue- The amount to increase the user's experience bycallback- The method to be invoked when the server response is received
-
getNextExperienceLevel
Returns JSON representing the next experience level for the user. Service Name - PlayerStatistics Service Operation - ReadNextXpLevel- Parameters:
callback- The method to be invoked when the server response is received
-
setExperiencePoints
Sets the user's experience to an absolute value. Note that this is simply a set and will not reward the user if their level changes as a result. Service Name - PlayerStatistics Service Operation - SetXpPoints- Parameters:
xpValue- The amount to set the the user's experience tocallback- The method to be invoked when the server response is received
-
processStatistics
Apply statistics grammar to a partial set of statistics. Service Name - PlayerStatistics Service Operation - PROCESS_STATISTICS- Parameters:
jsonData- The JSON format is as follows: { "DEAD_CATS": "RESET", "LIVES_LEFT": "SET#9", "MICE_KILLED": "INC#2", "DOG_SCARE_BONUS_POINTS": "INC#10", "TREES_CLIMBED": 1 }callback- Method to be invoked when the server response is received.
-