コード例 #1
0
        internal void HandleFetchScorePage(LeaderboardScoreData data,
                                           ScorePageToken token,
                                           FetchScorePageResponse rsp, Action <LeaderboardScoreData> callback)
        {
            data.Status = (ResponseStatus)rsp.GetStatus();
            // add the scores that match the criteria
            if (rsp.GetStatus() != Status.ResponseStatus.VALID &&
                rsp.GetStatus() != Status.ResponseStatus.VALID_BUT_STALE)
            {
                callback(data);
            }

            NativeScorePage page = rsp.GetScorePage();

            if (!page.Valid())
            {
                callback(data);
            }

            if (page.HasNextScorePage())
            {
                data.NextPageToken = new ScorePageToken(
                    page.GetNextScorePageToken(),
                    token.LeaderboardId,
                    token.Collection,
                    token.TimeSpan);
            }
            if (page.HasPrevScorePage())
            {
                data.PrevPageToken = new ScorePageToken(
                    page.GetPreviousScorePageToken(),
                    token.LeaderboardId,
                    token.Collection,
                    token.TimeSpan);
            }

            foreach (NativeScoreEntry ent in page)
            {
                data.AddScore(ent.AsScore(data.Id));
            }

            callback(data);
        }
コード例 #2
0
        internal void HandleFetchScorePage(LeaderboardScoreData data, ScorePageToken token, FetchScorePageResponse rsp, Action <LeaderboardScoreData> callback)
        {
            data.Status = (ResponseStatus)rsp.GetStatus();
            if (rsp.GetStatus() != CommonErrorStatus.ResponseStatus.VALID && rsp.GetStatus() != CommonErrorStatus.ResponseStatus.VALID_BUT_STALE)
            {
                callback(data);
            }
            NativeScorePage scorePage = rsp.GetScorePage();

            if (!scorePage.Valid())
            {
                callback(data);
            }
            if (scorePage.HasNextScorePage())
            {
                data.NextPageToken = new ScorePageToken(scorePage.GetNextScorePageToken(), token.LeaderboardId, token.Collection, token.TimeSpan);
            }
            if (scorePage.HasPrevScorePage())
            {
                data.PrevPageToken = new ScorePageToken(scorePage.GetPreviousScorePageToken(), token.LeaderboardId, token.Collection, token.TimeSpan);
            }
            foreach (NativeScoreEntry item in scorePage)
            {
                data.AddScore(item.AsScore(data.Id));
            }
            callback(data);
        }
コード例 #3
0
        internal void HandleFetchScorePage(LeaderboardScoreData data,
            ScorePageToken token,
            FetchScorePageResponse rsp, Action<LeaderboardScoreData> callback)
        {
            data.Status = (ResponseStatus)rsp.GetStatus();
            // add the scores that match the criteria
            if (rsp.GetStatus() != Status.ResponseStatus.VALID &&
                rsp.GetStatus() != Status.ResponseStatus.VALID_BUT_STALE)
            {
                callback(data);
            }

            NativeScorePage page = rsp.GetScorePage();

            if (!page.Valid())
            {
                callback(data);
            }

            if (page.HasNextScorePage())
            {
                data.NextPageToken = new ScorePageToken(
                                               page.GetNextScorePageToken(),
                                               token.LeaderboardId,
                                               token.Collection,
                                               token.TimeSpan);

            }
            if (page.HasPrevScorePage())
            {
                data.PrevPageToken = new ScorePageToken(
                    page.GetPreviousScorePageToken(),
                    token.LeaderboardId,
                    token.Collection,
                    token.TimeSpan);
            }

            foreach (NativeScoreEntry ent in page)
            {
                data.AddScore(ent.AsScore(data.Id));
            }

            callback(data);
        }