///<summary></summary> /// <seealso cref="GooglePlayGames.BasicApi.IPlayGamesClient.GetPlayerStats"/> public void GetPlayerStats(Action <CommonStatusCodes, PlayerStats> callback) { mServices.StatsManager().FetchForPlayer((playerStatsResponse) => { // Translate native errors into CommonStatusCodes. CommonStatusCodes responseCode = ConversionUtils.ConvertResponseStatusToCommonStatus(playerStatsResponse.Status()); // Log errors. if (responseCode != CommonStatusCodes.Success && responseCode != CommonStatusCodes.SuccessCached) { GooglePlayGames.OurUtils.Logger.e("Error loading PlayerStats: " + playerStatsResponse.Status().ToString()); } // Fill in the stats & call the callback. if (callback != null) { if (playerStatsResponse.PlayerStats() != null) { callback(responseCode, playerStatsResponse.PlayerStats().AsPlayerStats()); } else { callback(responseCode, new PlayerStats()); } } }); }
///<summary></summary> /// <seealso cref="GooglePlayGames.BasicApi.IPlayGamesClient.GetPlayerStats"/> public void GetPlayerStats(Action <CommonStatusCodes, PlayerStats> callback) { mServices.StatsManager().FetchForPlayer((playerStatsResponse) => { // Translate native errors into CommonStatusCodes. CommonStatusCodes responseCode = ConversionUtils.ConvertResponseStatusToCommonStatus(playerStatsResponse.Status()); // Log errors. if (responseCode != CommonStatusCodes.Success && responseCode != CommonStatusCodes.SuccessCached) { GooglePlayGames.OurUtils.Logger.e("Error loading PlayerStats: " + playerStatsResponse.Status().ToString()); } // Fill in the stats & call the callback. if (callback != null) { if (playerStatsResponse.PlayerStats() != null) { // Copy the object out of the native interface so // it will not be deleted before the callback is // executed on the UI thread. PlayerStats stats = playerStatsResponse.PlayerStats().AsPlayerStats(); PlayGamesHelperObject.RunOnGameThread(() => callback(responseCode, stats)); } else { PlayGamesHelperObject.RunOnGameThread(() => callback(responseCode, new PlayerStats())); } } }); }
/// <summary> /// Asynchronously retrieves the server auth code for this client. /// </summary> /// <remarks>Note: This function is currently only implemented for Android.</remarks> /// <param name="serverClientId">The Client ID.</param> /// <param name="callback">Callback for response.</param> public void GetServerAuthCode(string serverClientId, Action <CommonStatusCodes, string> callback) { mServices.FetchServerAuthCode(serverClientId, (serverAuthCodeResponse) => { // Translate native errors into CommonStatusCodes. CommonStatusCodes responseCode = ConversionUtils.ConvertResponseStatusToCommonStatus(serverAuthCodeResponse.Status()); // Log errors. if (responseCode != CommonStatusCodes.Success && responseCode != CommonStatusCodes.SuccessCached) { OurUtils.Logger.e("Error loading server auth code: " + serverAuthCodeResponse.Status().ToString()); } // Fill in the code & call the callback. if (callback != null) { callback(responseCode, serverAuthCodeResponse.Code()); } }); }
/// <summary> /// Asynchronously retrieves the server auth code for this client. /// </summary> /// <remarks>Note: This function is currently only implemented for Android.</remarks> /// <param name="serverClientId">The Client ID.</param> /// <param name="callback">Callback for response.</param> public void GetServerAuthCode(string serverClientId, Action <CommonStatusCodes, string> callback) { mServices.FetchServerAuthCode(serverClientId, (serverAuthCodeResponse) => { // Translate native errors into CommonStatusCodes. CommonStatusCodes responseCode = ConversionUtils.ConvertResponseStatusToCommonStatus(serverAuthCodeResponse.Status()); // Log errors. if (responseCode != CommonStatusCodes.Success && responseCode != CommonStatusCodes.SuccessCached) { OurUtils.Logger.e("Error loading server auth code: " + serverAuthCodeResponse.Status().ToString()); } // Fill in the code & call the callback. if (callback != null) { // copy the auth code into managed memory before posting // the callback. string authCode = serverAuthCodeResponse.Code(); PlayGamesHelperObject.RunOnGameThread(() => callback(responseCode, authCode)); } }); }