From 8f5d262f300f7d9facb2b47afb6909c2c1e478aa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Mar 2017 14:06:05 +0900 Subject: [PATCH] Add GetScoresRequest API methods. --- osu.Game/Modes/Score.cs | 39 +++++++++++++++++++ .../Online/API/Requests/GetScoresRequest.cs | 37 ++++++++++++++++++ osu.Game/osu.Game.csproj | 1 + 3 files changed, 77 insertions(+) create mode 100644 osu.Game/Online/API/Requests/GetScoresRequest.cs diff --git a/osu.Game/Modes/Score.cs b/osu.Game/Modes/Score.cs index f42dc7f7d4..55bbed8e77 100644 --- a/osu.Game/Modes/Score.cs +++ b/osu.Game/Modes/Score.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using Newtonsoft.Json; using osu.Game.Users; using osu.Game.Database; using osu.Game.Modes.Mods; @@ -9,16 +11,53 @@ namespace osu.Game.Modes { public class Score { + [JsonProperty(@"rank")] public ScoreRank Rank { get; set; } + + [JsonProperty(@"score")] public double TotalScore { get; set; } public double Accuracy { get; set; } public double Health { get; set; } + + [JsonProperty(@"maxcombo")] public int MaxCombo { get; set; } public int Combo { get; set; } public Mod[] Mods { get; set; } public User User { get; set; } + + [JsonProperty(@"replay_data")] public Replay Replay; + public BeatmapInfo Beatmap; + + [JsonProperty(@"score_id")] + public long OnlineScoreID; + + [JsonProperty(@"username")] + public string Username; + + [JsonProperty(@"user_id")] + public long UserID; + + [JsonProperty(@"date")] + public DateTime Date; + + // [JsonProperty(@"count50")] 0, + //[JsonProperty(@"count100")] 0, + //[JsonProperty(@"count300")] 100, + //[JsonProperty(@"countmiss")] 0, + //[JsonProperty(@"countkatu")] 0, + //[JsonProperty(@"countgeki")] 31, + //[JsonProperty(@"perfect")] true, + //[JsonProperty(@"enabled_mods")] [ + // "DT", + // "FL", + // "HD", + // "HR" + //], + //[JsonProperty(@"rank")] "XH", + //[JsonProperty(@"pp")] 26.1816, + //[JsonProperty(@"replay")] true } } diff --git a/osu.Game/Online/API/Requests/GetScoresRequest.cs b/osu.Game/Online/API/Requests/GetScoresRequest.cs new file mode 100644 index 0000000000..4b7b3a2ce5 --- /dev/null +++ b/osu.Game/Online/API/Requests/GetScoresRequest.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using Newtonsoft.Json; +using osu.Framework.IO.Network; +using osu.Game.Database; +using osu.Game.Modes; + +namespace osu.Game.Online.API.Requests +{ + public class GetScoresRequest : APIRequest + { + private readonly BeatmapInfo beatmap; + + public GetScoresRequest(BeatmapInfo beatmap) + { + this.beatmap = beatmap; + } + + protected override WebRequest CreateWebRequest() + { + var req = base.CreateWebRequest(); + req.AddParameter(@"c", beatmap.Hash); + req.AddParameter(@"f", beatmap.Path); + return req; + } + + protected override string Target => @"beatmaps/scores"; + } + + public class GetScoresResponse + { + [JsonProperty(@"beatmap")] + public BeatmapInfo Beatmap; + + [JsonProperty(@"scores")] + public IEnumerable Scores; + } +} \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 5e807ea23d..82884263c8 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -104,6 +104,7 @@ +