コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: AndroidClient.cs プロジェクト: zunaalabaya/TAC-BOT
        public void GetPlayerStats(IntPtr apiClient, Action <CommonStatusCodes, PlayGamesLocalUser.PlayerStats> callback)
        {
            GoogleApiClient arg_GoogleApiClient_1 = new GoogleApiClient(apiClient);

            AndroidClient.StatsResultCallback statsResultCallback;
            try
            {
                statsResultCallback = new AndroidClient.StatsResultCallback((Action <int, Com.Google.Android.Gms.Games.Stats.PlayerStats>)((result, stats) =>
                {
                    Debug.Log((object)("Result for getStats: " + (object)result));
                    PlayGamesLocalUser.PlayerStats playerStats = (PlayGamesLocalUser.PlayerStats)null;
                    if (stats != null)
                    {
                        playerStats = new PlayGamesLocalUser.PlayerStats();
                        playerStats.AvgSessonLength     = stats.getAverageSessionLength();
                        playerStats.DaysSinceLastPlayed = stats.getDaysSinceLastPlayed();
                        playerStats.NumberOfPurchases   = stats.getNumberOfPurchases();
                        playerStats.NumOfSessions       = stats.getNumberOfSessions();
                        playerStats.SessPercentile      = stats.getSessionPercentile();
                        playerStats.SpendPercentile     = stats.getSpendPercentile();
                    }
                    callback((CommonStatusCodes)result, playerStats);
                }));
            }
            catch (Exception ex)
            {
                Debug.LogException(ex);
                callback(CommonStatusCodes.DeveloperError, (PlayGamesLocalUser.PlayerStats)null);
                return;
            }
            Com.Google.Android.Gms.Games.Games.Stats.loadPlayerStats(arg_GoogleApiClient_1, true).setResultCallback((ResultCallback <Stats_LoadPlayerStatsResultObject>)statsResultCallback);
        }