/// <summary>
        /// Handles the fetch of a specific leaderboard definition.  This
        /// is called with the expectation that the leaderboard summary and
        /// scores are also needed.
        /// </summary>
        /// <param name="token">token for the current fetching request.</param>
        /// <param name="response">Response.</param>
        /// <param name="selfPlayerId">Self player identifier.</param>
        /// <param name="maxResults">Number of scores to return.</param>
        /// <param name="callback">Callback.</param>
        internal void HandleFetch(ScorePageToken token,
                                  FetchResponse response,
                                  string selfPlayerId,
                                  int maxResults,
                                  Action <LeaderboardScoreData> callback)
        {
            LeaderboardScoreData data =
                new LeaderboardScoreData(
                    token.LeaderboardId, (ResponseStatus)response.GetStatus());

            if (response.GetStatus() != Status.ResponseStatus.VALID &&
                response.GetStatus() != Status.ResponseStatus.VALID_BUT_STALE)
            {
                Logger.w("Error returned from fetch: " + response.GetStatus());
                callback(data);
                return;
            }

            data.Title = response.Leaderboard().Title();
            data.Id    = token.LeaderboardId;

            // now fetch the summary of the leaderboard.

            C.LeaderboardManager_FetchScoreSummary(mServices.AsHandle(),
                                                   Types.DataSource.CACHE_OR_NETWORK,
                                                   token.LeaderboardId,
                                                   (Types.LeaderboardTimeSpan)token.TimeSpan,
                                                   (Types.LeaderboardCollection)token.Collection,
                                                   InternalFetchSummaryCallback,
                                                   Callbacks.ToIntPtr <FetchScoreSummaryResponse>((rsp) =>
                                                                                                  HandleFetchScoreSummary(data, rsp, selfPlayerId, maxResults, token, callback),
                                                                                                  FetchScoreSummaryResponse.FromPointer)
                                                   );
        }
        internal void HandleFetch(ScorePageToken token, FetchResponse response, string selfPlayerId, int maxResults, Action <LeaderboardScoreData> callback)
        {
            LeaderboardScoreData data = new LeaderboardScoreData(token.LeaderboardId, (ResponseStatus)response.GetStatus());

            if (response.GetStatus() != CommonErrorStatus.ResponseStatus.VALID && response.GetStatus() != CommonErrorStatus.ResponseStatus.VALID_BUT_STALE)
            {
                Logger.w("Error returned from fetch: " + response.GetStatus());
                callback(data);
            }
            else
            {
                data.Title = response.Leaderboard().Title();
                data.Id    = token.LeaderboardId;
                GooglePlayGames.Native.Cwrapper.LeaderboardManager.LeaderboardManager_FetchScoreSummary(mServices.AsHandle(), Types.DataSource.CACHE_OR_NETWORK, token.LeaderboardId, (Types.LeaderboardTimeSpan) token.TimeSpan, (Types.LeaderboardCollection) token.Collection, InternalFetchSummaryCallback, Callbacks.ToIntPtr(delegate(FetchScoreSummaryResponse rsp)
                {
                    HandleFetchScoreSummary(data, rsp, selfPlayerId, maxResults, token, callback);
                }, FetchScoreSummaryResponse.FromPointer));
            }
        }
Beispiel #3
0
 internal void HandleFetch(ScorePageToken token, FetchResponse response, string selfPlayerId, int maxResults, Action <LeaderboardScoreData> callback)
 {
     // ISSUE: object of a compiler-generated type is created
     // ISSUE: variable of a compiler-generated type
     LeaderboardManager.\u003CHandleFetch\u003Ec__AnonStorey165 fetchCAnonStorey165 = new LeaderboardManager.\u003CHandleFetch\u003Ec__AnonStorey165();
     // ISSUE: reference to a compiler-generated field
     fetchCAnonStorey165.selfPlayerId = selfPlayerId;
     // ISSUE: reference to a compiler-generated field
     fetchCAnonStorey165.maxResults = maxResults;
     // ISSUE: reference to a compiler-generated field
     fetchCAnonStorey165.token = token;
     // ISSUE: reference to a compiler-generated field
     fetchCAnonStorey165.callback = callback;
     // ISSUE: reference to a compiler-generated field
     fetchCAnonStorey165.\u003C\u003Ef__this = this;
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     fetchCAnonStorey165.data = new LeaderboardScoreData(fetchCAnonStorey165.token.LeaderboardId, (GooglePlayGames.BasicApi.ResponseStatus)response.GetStatus());
     if (response.GetStatus() != CommonErrorStatus.ResponseStatus.VALID && response.GetStatus() != CommonErrorStatus.ResponseStatus.VALID_BUT_STALE)
     {
         Logger.w("Error returned from fetch: " + (object)response.GetStatus());
         // ISSUE: reference to a compiler-generated field
         // ISSUE: reference to a compiler-generated field
         fetchCAnonStorey165.callback(fetchCAnonStorey165.data);
     }
     else
     {
         // ISSUE: reference to a compiler-generated field
         fetchCAnonStorey165.data.Title = response.Leaderboard().Title();
         // ISSUE: reference to a compiler-generated field
         // ISSUE: reference to a compiler-generated field
         fetchCAnonStorey165.data.Id = fetchCAnonStorey165.token.LeaderboardId;
         // ISSUE: reference to a compiler-generated field
         // ISSUE: reference to a compiler-generated field
         // ISSUE: reference to a compiler-generated field
         // ISSUE: reference to a compiler-generated method
         GooglePlayGames.Native.Cwrapper.LeaderboardManager.LeaderboardManager_FetchScoreSummary(this.mServices.AsHandle(), Types.DataSource.CACHE_OR_NETWORK, fetchCAnonStorey165.token.LeaderboardId, (Types.LeaderboardTimeSpan)fetchCAnonStorey165.token.TimeSpan, (Types.LeaderboardCollection)fetchCAnonStorey165.token.Collection, new GooglePlayGames.Native.Cwrapper.LeaderboardManager.FetchScoreSummaryCallback(LeaderboardManager.InternalFetchSummaryCallback), Callbacks.ToIntPtr <FetchScoreSummaryResponse>(new Action <FetchScoreSummaryResponse>(fetchCAnonStorey165.\u003C\u003Em__A2), new Func <IntPtr, FetchScoreSummaryResponse>(FetchScoreSummaryResponse.FromPointer)));
     }
 }
        /// <summary>
        /// Handles the fetch of a specific leaderboard definition.  This
        /// is called with the expectation that the leaderboard summary and
        /// scores are also needed.
        /// </summary>
        /// <param name="token">token for the current fetching request.</param>
        /// <param name="response">Response.</param>
        /// <param name="selfPlayerId">Self player identifier.</param>
        /// <param name="maxResults">Number of scores to return.</param>
        /// <param name="callback">Callback.</param>
        internal void HandleFetch(ScorePageToken token,
            FetchResponse response,
            string selfPlayerId,
            int maxResults,
            Action<LeaderboardScoreData> callback)
        {

            LeaderboardScoreData data =
                new LeaderboardScoreData(
                    token.LeaderboardId, (ResponseStatus)response.GetStatus());

            if (response.GetStatus() != Status.ResponseStatus.VALID &&
                response.GetStatus() != Status.ResponseStatus.VALID_BUT_STALE)
            {
                Logger.w("Error returned from fetch: " + response.GetStatus());
                callback(data);
                return;
            }

            data.Title = response.Leaderboard().Title();
            data.Id = token.LeaderboardId;

            // now fetch the summary of the leaderboard.

            C.LeaderboardManager_FetchScoreSummary(mServices.AsHandle(),
                Types.DataSource.CACHE_OR_NETWORK,
                token.LeaderboardId,
                (Types.LeaderboardTimeSpan)token.TimeSpan,
                (Types.LeaderboardCollection)token.Collection,
                InternalFetchSummaryCallback,
                Callbacks.ToIntPtr<FetchScoreSummaryResponse>((rsp) =>
                    HandleFetchScoreSummary(data, rsp, selfPlayerId, maxResults, token, callback),
                FetchScoreSummaryResponse.FromPointer)
            );
        }