コード例 #1
0
        internal Task <LeaderboardResult> GetLeaderboardInternal(string xuid, string serviceConfigurationId, string leaderboardName, string socialGroup, LeaderboardQuery query, LeaderboardRequestType leaderboardType)
        {
            string requestPath = "";

            string skipToXboxUserId = null;

            if (query.SkipResultToMe)
            {
                skipToXboxUserId = userContext.XboxUserId;
            }
            if (leaderboardType == LeaderboardRequestType.Social)
            {
                requestPath = CreateSocialLeaderboardUrlPath(serviceConfigurationId, leaderboardName, xuid, query.MaxItems, skipToXboxUserId, query.SkipResultsToRank, query.ContinuationToken, socialGroup);
            }
            else
            {
                requestPath = CreateLeaderboardUrlPath(serviceConfigurationId, leaderboardName, xuid, query.MaxItems, skipToXboxUserId, query.SkipResultsToRank, query.ContinuationToken, socialGroup);
            }

            XboxLiveHttpRequest request = XboxLiveHttpRequest.Create(xboxLiveContextSettings, HttpMethod.Get, leaderboardsBaseUri.ToString(), requestPath);

            request.ContractVersion = leaderboardAPIContract;
            return(request.GetResponseWithAuth(userContext, HttpCallResponseBodyType.JsonBody)
                   .ContinueWith(
                       responseTask =>
            {
                var leaderboardRequestType = LeaderboardRequestType.Global;
                if (socialGroup != null)
                {
                    leaderboardRequestType = LeaderboardRequestType.Social;
                }
                LeaderboardRequest leaderboardRequest = new LeaderboardRequest(leaderboardRequestType, leaderboardName);
                LeaderboardQuery nextQuery = new LeaderboardQuery(query);
                nextQuery.StatName = leaderboardName;
                nextQuery.SocialGroup = socialGroup;
                return this.HandleLeaderboardResponse(leaderboardRequest, responseTask, nextQuery);
            }));
        }
コード例 #2
0
 public LeaderboardRequest(LeaderboardRequestType requestType, string leaderboardName)
 {
     this.RequestType     = requestType;
     this.LeaderboardName = leaderboardName;
 }