public void GetPlayerStats(IntPtr apiClient, Action <CommonStatusCodes, PlayGamesLocalUser.PlayerStats> callback) { GoogleApiClient client = new GoogleApiClient(apiClient); StatsResultCallback resCallback; try { resCallback = new StatsResultCallback((result, stats) => { Debug.Log("Result for getStats: " + result); PlayGamesLocalUser.PlayerStats s = null; if (stats != null) { s = new PlayGamesLocalUser.PlayerStats(); s.AvgSessonLength = stats.getAverageSessionLength(); s.DaysSinceLastPlayed = stats.getDaysSinceLastPlayed(); s.NumberOfPurchases = stats.getNumberOfPurchases(); s.NumOfSessions = stats.getNumberOfSessions(); s.SessPercentile = stats.getSessionPercentile(); s.SpendPercentile = stats.getSpendPercentile(); } callback((CommonStatusCodes)result, s); }); } catch (Exception e) { Debug.LogException(e); callback(CommonStatusCodes.DeveloperError, null); return; } PendingResult <Stats_LoadPlayerStatsResultObject> pr = Games.Stats.loadPlayerStats(client, true); pr.setResultCallback(resCallback); }
public void GetPlayerStats(IntPtr apiClient, Action <CommonStatusCodes, GooglePlayGames.BasicApi.PlayerStats> callback) { GoogleApiClient client = new GoogleApiClient(apiClient); StatsResultCallback resCallback; try { resCallback = new StatsResultCallback((result, stats) => { #if BUILD_TYPE_DEBUG Debug.Log("Result for getStats: " + result); #endif GooglePlayGames.BasicApi.PlayerStats s = null; if (stats != null) { s = new GooglePlayGames.BasicApi.PlayerStats(); s.AvgSessonLength = stats.getAverageSessionLength(); s.DaysSinceLastPlayed = stats.getDaysSinceLastPlayed(); s.NumberOfPurchases = stats.getNumberOfPurchases(); s.NumberOfSessions = stats.getNumberOfSessions(); s.SessPercentile = stats.getSessionPercentile(); s.SpendPercentile = stats.getSpendPercentile(); s.ChurnProbability = stats.getChurnProbability(); s.SpendProbability = stats.getSpendProbability(); s.HighSpenderProbability = stats.getHighSpenderProbability(); s.TotalSpendNext28Days = stats.getTotalSpendNext28Days(); } callback((CommonStatusCodes)result, s); }); } catch (Exception e) { Debug.LogException(e); callback(CommonStatusCodes.DeveloperError, null); return; } PendingResult <Stats_LoadPlayerStatsResultObject> pr = Games.Stats.loadPlayerStats(client, true); pr.setResultCallback(resCallback); }
public void GetPlayerStats(IntPtr apiClient, Action <CommonStatusCodes, GooglePlayGames.BasicApi.PlayerStats> callback) { GoogleApiClient arg_GoogleApiClient_ = new GoogleApiClient(apiClient); StatsResultCallback resultCallback; try { resultCallback = new StatsResultCallback(delegate(int result, Com.Google.Android.Gms.Games.Stats.PlayerStats stats) { Debug.Log((object)("Result for getStats: " + result)); GooglePlayGames.BasicApi.PlayerStats arg = null; if (stats != null) { arg = new GooglePlayGames.BasicApi.PlayerStats { AvgSessonLength = stats.getAverageSessionLength(), DaysSinceLastPlayed = stats.getDaysSinceLastPlayed(), NumberOfPurchases = stats.getNumberOfPurchases(), NumberOfSessions = stats.getNumberOfSessions(), SessPercentile = stats.getSessionPercentile(), SpendPercentile = stats.getSpendPercentile(), ChurnProbability = stats.getChurnProbability(), SpendProbability = stats.getSpendProbability(), HighSpenderProbability = stats.getHighSpenderProbability(), TotalSpendNext28Days = stats.getTotalSpendNext28Days() }; } callback((CommonStatusCodes)result, arg); }); } catch (Exception ex) { Debug.LogException(ex); callback(CommonStatusCodes.DeveloperError, null); return; IL_0049 :; } PendingResult <Stats_LoadPlayerStatsResultObject> pendingResult = Games.Stats.loadPlayerStats(arg_GoogleApiClient_, true); pendingResult.setResultCallback(resultCallback); }