internal PlayGamesLocalUser(PlayGamesPlatform plaf)
     : base("localUser", string.Empty, string.Empty)
 {
     mPlatform = plaf;
     emailAddress = null;
     mStats = null;
 }
Beispiel #2
0
 internal GooglePlayGames.BasicApi.PlayerStats AsPlayerStats()
 {
     GooglePlayGames.BasicApi.PlayerStats stats = new GooglePlayGames.BasicApi.PlayerStats();
     stats.Valid = this.Valid();
     if (this.Valid())
     {
         stats.AvgSessonLength     = this.AverageSessionLength();
         stats.ChurnProbability    = this.ChurnProbability();
         stats.DaysSinceLastPlayed = this.DaysSinceLastPlayed();
         stats.NumberOfPurchases   = this.NumberOfPurchases();
         stats.NumberOfSessions    = this.NumberOfSessions();
         stats.SessPercentile      = this.SessionPercentile();
         stats.SpendPercentile     = this.SpendPercentile();
         stats.SpendProbability    = -1f;
     }
     return(stats);
 }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
        }
        internal PlayerStats AsPlayerStats()
        {
            PlayerStats playerStats = new PlayerStats();

            playerStats.Valid = Valid();
            if (Valid ()) {
                playerStats.AvgSessonLength = AverageSessionLength();
                playerStats.ChurnProbability = ChurnProbability();
                playerStats.DaysSinceLastPlayed = DaysSinceLastPlayed();
                playerStats.NumberOfPurchases = NumberOfPurchases();
                playerStats.NumberOfSessions = NumberOfSessions();
                playerStats.SessPercentile = SessionPercentile();
                playerStats.SpendPercentile = SpendPercentile();
            }

            return playerStats;
        }
 /// <summary>
 /// Gets the player's stats.
 /// </summary>
 /// <param name="callback">Callback when they are available.</param>
 public void GetStats(Action<CommonStatusCodes, PlayerStats> callback)
 {
     if (mStats == null)
     {
         mPlatform.GetPlayerStats((rc, stats) =>
             {
                 mStats = stats;
                 callback(rc, stats);
             });
     }
     else
     {
         // 0 = success
         callback(CommonStatusCodes.Success, mStats);
     }
 }