diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs b/osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs index 1f7da7ac0d..61574a7f23 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs @@ -82,7 +82,7 @@ namespace osu.Game.Tests.Visual.Online { GlobalRank = 89000, PP = 12345, - RankHistory = new APIUser.RankHistoryData + RankHistory = new APIRankHistory { Data = data, } @@ -95,7 +95,7 @@ namespace osu.Game.Tests.Visual.Online { GlobalRank = 89000, PP = 12345, - RankHistory = new APIUser.RankHistoryData + RankHistory = new APIRankHistory { Data = dataWithZeros, } @@ -108,7 +108,7 @@ namespace osu.Game.Tests.Visual.Online { GlobalRank = 12000, PP = 12345, - RankHistory = new APIUser.RankHistoryData + RankHistory = new APIRankHistory { Data = smallData, } @@ -121,7 +121,7 @@ namespace osu.Game.Tests.Visual.Online { GlobalRank = 12000, PP = 12345, - RankHistory = new APIUser.RankHistoryData + RankHistory = new APIRankHistory { Data = edgyData, } diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs index 2a6f304369..a8ed2cf110 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs @@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual.Online Current = 727, Progress = 69, }, - RankHistory = new APIUser.RankHistoryData + RankHistory = new APIRankHistory { Mode = @"osu", Data = Enumerable.Range(2345, 45).Concat(Enumerable.Range(2109, 40)).ToArray() @@ -59,7 +59,7 @@ namespace osu.Game.Tests.Visual.Online }, Title = "osu!volunteer", Colour = "ff0000", - Achievements = Array.Empty(), + Achievements = Array.Empty(), }; public TestSceneUserProfileOverlay() diff --git a/osu.Game/Online/API/Requests/Responses/APIRankHistory.cs b/osu.Game/Online/API/Requests/Responses/APIRankHistory.cs new file mode 100644 index 0000000000..064badcccb --- /dev/null +++ b/osu.Game/Online/API/Requests/Responses/APIRankHistory.cs @@ -0,0 +1,16 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Newtonsoft.Json; + +namespace osu.Game.Online.API.Requests.Responses +{ + public class APIRankHistory + { + [JsonProperty(@"mode")] + public string Mode; + + [JsonProperty(@"data")] + public int[] Data; + } +} diff --git a/osu.Game/Online/API/Requests/Responses/APIUser.cs b/osu.Game/Online/API/Requests/Responses/APIUser.cs index aa5c556826..58f19ceaad 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUser.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUser.cs @@ -200,34 +200,16 @@ namespace osu.Game.Online.API.Requests.Responses } [JsonProperty(@"rank_history")] - private RankHistoryData rankHistory + private APIRankHistory rankHistory { set => statistics.RankHistory = value; } - public class RankHistoryData - { - [JsonProperty(@"mode")] - public string Mode; - - [JsonProperty(@"data")] - public int[] Data; - } - [JsonProperty("badges")] public Badge[] Badges; [JsonProperty("user_achievements")] - public UserAchievement[] Achievements; - - public class UserAchievement - { - [JsonProperty("achieved_at")] - public DateTimeOffset AchievedAt; - - [JsonProperty("achievement_id")] - public int ID; - } + public APIUserAchievement[] Achievements; [JsonProperty("monthly_playcounts")] public APIUserHistoryCount[] MonthlyPlaycounts; diff --git a/osu.Game/Online/API/Requests/Responses/APIUserAchievement.cs b/osu.Game/Online/API/Requests/Responses/APIUserAchievement.cs new file mode 100644 index 0000000000..cfba9118c2 --- /dev/null +++ b/osu.Game/Online/API/Requests/Responses/APIUserAchievement.cs @@ -0,0 +1,17 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using Newtonsoft.Json; + +namespace osu.Game.Online.API.Requests.Responses +{ + public class APIUserAchievement + { + [JsonProperty("achievement_id")] + public int ID; + + [JsonProperty("achieved_at")] + public DateTimeOffset AchievedAt; + } +} diff --git a/osu.Game/Users/UserStatistics.cs b/osu.Game/Users/UserStatistics.cs index 6acb63fdc4..c690447256 100644 --- a/osu.Game/Users/UserStatistics.cs +++ b/osu.Game/Users/UserStatistics.cs @@ -7,7 +7,6 @@ using osu.Framework.Localisation; using osu.Game.Online.API.Requests.Responses; using osu.Game.Scoring; using osu.Game.Utils; -using static osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Users { @@ -35,7 +34,7 @@ namespace osu.Game.Users public int? CountryRank; // populated via User model, as that's where the data currently lives. - public RankHistoryData RankHistory; + public APIRankHistory RankHistory; [JsonProperty(@"pp")] public decimal? PP;