/// <summary> /// Atomically increment (or decrement) player statistics. /// Any rewards that are triggered from player statistic increments /// will be considered. Player 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 player has hit it). /// </summary> /// <remarks> /// Service Name - PlayerStatistics /// Service Operation - Update /// </remarks> /// <param name="in_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. /// </param> /// <param name="in_success"> /// The success callback /// </param> /// <param name="in_failure"> /// The failure callback /// </param> /// <param name="in_cbObject"> /// The callback object /// </param> /// <returns> JSON describing the new value of the statistics and any rewards that were triggered: /// { /// "status":200, /// "data":{ /// "experiencePoints":10, /// "xpCapped":false, /// "rewardDetails":{ /// "xp":{ /// "experienceLevels":[ /// { /// "level":1, /// "reward":{ /// "currency":{ /// "gold":1000 /// } /// } /// } /// ] /// } /// }, /// "rewards":{ /// "experienceLevels":[ /// 1 /// ], /// "currency":{ /// "gold":1000 /// } /// }, /// "experienceLevel":1, /// "statistics":{ /// "LIVES":1 /// }, /// "currency":{ /// "gems":{ /// "purchased":0, /// "balance":10, /// "consumed":0, /// "awarded":10 /// }, /// "gold":{ /// "purchased":0, /// "balance":2000, /// "consumed":0, /// "awarded":2000 /// } /// } /// } /// } /// </returns> public void IncrementPlayerStats( string in_jsonData, SuccessCallback in_success = null, FailureCallback in_failure = null, object in_cbObject = null) { Dictionary <string, object> data = new Dictionary <string, object>(); Dictionary <string, object> statsData = JsonReader.Deserialize <Dictionary <string, object> > (in_jsonData); data[OperationParam.PlayerStatisticsServiceStats.Value] = statsData; SuccessCallback successCallbacks = m_brainCloudClientRef.GetGamificationService().CheckForAchievementsToAward; if (in_success != null) { successCallbacks += in_success; } ServerCallback callback = BrainCloudClient.CreateServerCallback(successCallbacks, in_failure, in_cbObject); ServerCall sc = new ServerCall(ServiceName.PlayerStatistics, ServiceOperation.Update, data, callback); m_brainCloudClientRef.SendRequest(sc); }