示例#1
0
 public void GetPlayerStats(Action <CommonStatusCodes, GooglePlayGames.BasicApi.PlayerStats> callback)
 {
     PlayGamesHelperObject.RunOnGameThread(delegate
     {
         clientImpl.GetPlayerStats(GetApiClient(), callback);
     });
 }
示例#2
0
        ///<summary></summary>
        /// <seealso cref="GooglePlayGames.BasicApi.IPlayGamesClient.GetPlayerStats"/>
        public void GetPlayerStats(Action <CommonStatusCodes, PlayerStats> callback)
        {
#if UNITY_ANDROID
            // Temporary fix to get SpendProbability until the
            // C++ SDK supports it.
            PlayGamesHelperObject.RunOnGameThread(() =>
                                                  clientImpl.GetPlayerStats(GetApiClient(), callback));
#else
            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()));
                    }
                }
            });
#endif
        }
示例#3
0
 public void GetPlayerStats(Action <CommonStatusCodes, PlayGamesLocalUser.PlayerStats> callback)
 {
     clientImpl.GetPlayerStats(GetApiClient(), callback);
 }