From 7cd6caacaa2e0b1be559a1660ef63cc0a349abdd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Sep 2017 18:08:12 +0900 Subject: [PATCH] Update to support newer return structure from osu-web API --- .../Visual/TestCaseUserProfile.cs | 9 +++----- osu.Game/Overlays/Profile/RankChart.cs | 2 +- osu.Game/Users/User.cs | 23 ++++--------------- 3 files changed, 8 insertions(+), 26 deletions(-) diff --git a/osu.Desktop.Tests/Visual/TestCaseUserProfile.cs b/osu.Desktop.Tests/Visual/TestCaseUserProfile.cs index e5955441dc..a94177c1b6 100644 --- a/osu.Desktop.Tests/Visual/TestCaseUserProfile.cs +++ b/osu.Desktop.Tests/Visual/TestCaseUserProfile.cs @@ -33,13 +33,10 @@ namespace osu.Desktop.Tests.Visual Rank = 2148, PP = 4567.89m }, - AllRankHistories = new User.RankHistories + RankHistory = new User.RankHistoryData { - Osu = new User.RankHistory - { - Mode = @"osu", - Data = Enumerable.Range(2345,45).Concat(Enumerable.Range(2109,40)).ToArray() - } + Mode = @"osu", + Data = Enumerable.Range(2345, 45).Concat(Enumerable.Range(2109, 40)).ToArray() } }, false)); AddStep("Show ppy", () => profile.ShowUser(new User diff --git a/osu.Game/Overlays/Profile/RankChart.cs b/osu.Game/Overlays/Profile/RankChart.cs index 416bcedfea..2e2286098a 100644 --- a/osu.Game/Overlays/Profile/RankChart.cs +++ b/osu.Game/Overlays/Profile/RankChart.cs @@ -70,7 +70,7 @@ namespace osu.Game.Overlays.Profile } }; - ranks = user.AllRankHistories?.Osu?.Data ?? new[] { user.Statistics.Rank }; + ranks = user.RankHistory?.Data ?? new[] { user.Statistics.Rank }; } private void updateRankTexts() diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 37b426ac2c..2adb809334 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -122,25 +122,10 @@ namespace osu.Game.Users public int Available; } - [JsonProperty(@"defaultStatistics")] + [JsonProperty(@"statistics")] public UserStatistics Statistics; - public class RankHistories - { - [JsonProperty(@"osu")] - public RankHistory Osu; - - [JsonProperty(@"taiko")] - public RankHistory Taiko; - - [JsonProperty(@"fruits")] - public RankHistory Fruits; - - [JsonProperty(@"mania")] - public RankHistory Mania; - } - - public class RankHistory + public class RankHistoryData { [JsonProperty(@"mode")] public string Mode; @@ -149,7 +134,7 @@ namespace osu.Game.Users public int[] Data; } - [JsonProperty(@"allRankHistories")] - public RankHistories AllRankHistories; + [JsonProperty(@"rankHistory")] + public RankHistoryData RankHistory; } }