Merge remote-tracking branch 'upstream/master' into leaderboard-scopes

This commit is contained in:
naoey
2017-12-11 13:59:22 +05:30
193 changed files with 7484 additions and 2230 deletions

View File

@ -10,7 +10,7 @@ using System;
namespace osu.Game.Online.API.Requests
{
public class GetBeatmapSetsResponse : BeatmapMetadata // todo: this is a bit wrong...
public class APIResponseBeatmapSet : BeatmapMetadata // todo: this is a bit wrong...
{
[JsonProperty(@"covers")]
private BeatmapSetOnlineCovers covers { get; set; }
@ -45,7 +45,7 @@ namespace osu.Game.Online.API.Requests
}
[JsonProperty(@"beatmaps")]
private IEnumerable<GetBeatmapSetsBeatmapResponse> beatmaps { get; set; }
private IEnumerable<APIResponseBeatmap> beatmaps { get; set; }
public BeatmapSetInfo ToBeatmapSet(RulesetStore rulesets)
{
@ -65,11 +65,11 @@ namespace osu.Game.Online.API.Requests
Ranked = ranked,
LastUpdated = lastUpdated,
},
Beatmaps = beatmaps.Select(b => b.ToBeatmap(rulesets)).ToList(),
Beatmaps = beatmaps?.Select(b => b.ToBeatmap(rulesets)).ToList(),
};
}
private class GetBeatmapSetsBeatmapResponse : BeatmapMetadata
private class APIResponseBeatmap : BeatmapMetadata
{
[JsonProperty(@"id")]
private int onlineBeatmapID { get; set; }

View File

@ -3,7 +3,7 @@
namespace osu.Game.Online.API.Requests
{
public class GetBeatmapSetRequest : APIRequest<GetBeatmapSetsResponse>
public class GetBeatmapSetRequest : APIRequest<APIResponseBeatmapSet>
{
private readonly int beatmapSetId;

View File

@ -6,7 +6,7 @@ using System.Collections.Generic;
namespace osu.Game.Online.API.Requests
{
public class GetUserBeatmapsRequest : APIRequest<List<GetBeatmapSetsResponse>>
public class GetUserBeatmapsRequest : APIRequest<List<APIResponseBeatmapSet>>
{
private readonly long userId;
private readonly int offset;
@ -24,7 +24,6 @@ namespace osu.Game.Online.API.Requests
public enum BeatmapSetType
{
MostPlayed,
Favourite,
RankedAndApproved,
Unranked,

View File

@ -0,0 +1,48 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using Newtonsoft.Json;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using System.Collections.Generic;
namespace osu.Game.Online.API.Requests
{
public class GetUserMostPlayedBeatmapsRequest : APIRequest<List<MostPlayedBeatmap>>
{
private readonly long userId;
private readonly int offset;
public GetUserMostPlayedBeatmapsRequest(long userId, int offset = 0)
{
this.userId = userId;
this.offset = offset;
}
protected override string Target => $@"users/{userId}/beatmapsets/most_played?offset={offset}";
}
public class MostPlayedBeatmap
{
[JsonProperty("beatmap_id")]
public int BeatmapID;
[JsonProperty("count")]
public int PlayCount;
[JsonProperty]
private BeatmapInfo beatmap;
[JsonProperty]
private APIResponseBeatmapSet beatmapSet;
public BeatmapInfo GetBeatmapInfo(RulesetStore rulesets)
{
BeatmapSetInfo setInfo = beatmapSet.ToBeatmapSet(rulesets);
beatmap.BeatmapSet = setInfo;
beatmap.OnlineBeatmapSetID = setInfo.OnlineBeatmapSetID;
beatmap.Metadata = setInfo.Metadata;
return beatmap;
}
}
}

View File

@ -9,7 +9,7 @@ using osu.Game.Rulesets;
namespace osu.Game.Online.API.Requests
{
public class SearchBeatmapSetsRequest : APIRequest<IEnumerable<GetBeatmapSetsResponse>>
public class SearchBeatmapSetsRequest : APIRequest<IEnumerable<APIResponseBeatmapSet>>
{
private readonly string query;
private readonly RulesetInfo ruleset;