1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 20:32:54 +08:00

Split out a couple more nested classes

This commit is contained in:
Dean Herbert 2021-11-05 13:38:37 +09:00
parent ed07ee8c61
commit ead64282dd
6 changed files with 42 additions and 28 deletions

View File

@ -82,7 +82,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
GlobalRank = 89000, GlobalRank = 89000,
PP = 12345, PP = 12345,
RankHistory = new APIUser.RankHistoryData RankHistory = new APIRankHistory
{ {
Data = data, Data = data,
} }
@ -95,7 +95,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
GlobalRank = 89000, GlobalRank = 89000,
PP = 12345, PP = 12345,
RankHistory = new APIUser.RankHistoryData RankHistory = new APIRankHistory
{ {
Data = dataWithZeros, Data = dataWithZeros,
} }
@ -108,7 +108,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
GlobalRank = 12000, GlobalRank = 12000,
PP = 12345, PP = 12345,
RankHistory = new APIUser.RankHistoryData RankHistory = new APIRankHistory
{ {
Data = smallData, Data = smallData,
} }
@ -121,7 +121,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
GlobalRank = 12000, GlobalRank = 12000,
PP = 12345, PP = 12345,
RankHistory = new APIUser.RankHistoryData RankHistory = new APIRankHistory
{ {
Data = edgyData, Data = edgyData,
} }

View File

@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual.Online
Current = 727, Current = 727,
Progress = 69, Progress = 69,
}, },
RankHistory = new APIUser.RankHistoryData RankHistory = new APIRankHistory
{ {
Mode = @"osu", Mode = @"osu",
Data = Enumerable.Range(2345, 45).Concat(Enumerable.Range(2109, 40)).ToArray() Data = Enumerable.Range(2345, 45).Concat(Enumerable.Range(2109, 40)).ToArray()
@ -59,7 +59,7 @@ namespace osu.Game.Tests.Visual.Online
}, },
Title = "osu!volunteer", Title = "osu!volunteer",
Colour = "ff0000", Colour = "ff0000",
Achievements = Array.Empty<APIUser.UserAchievement>(), Achievements = Array.Empty<APIUserAchievement>(),
}; };
public TestSceneUserProfileOverlay() public TestSceneUserProfileOverlay()

View File

@ -0,0 +1,16 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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;
}
}

View File

@ -200,34 +200,16 @@ namespace osu.Game.Online.API.Requests.Responses
} }
[JsonProperty(@"rank_history")] [JsonProperty(@"rank_history")]
private RankHistoryData rankHistory private APIRankHistory rankHistory
{ {
set => statistics.RankHistory = value; set => statistics.RankHistory = value;
} }
public class RankHistoryData
{
[JsonProperty(@"mode")]
public string Mode;
[JsonProperty(@"data")]
public int[] Data;
}
[JsonProperty("badges")] [JsonProperty("badges")]
public Badge[] Badges; public Badge[] Badges;
[JsonProperty("user_achievements")] [JsonProperty("user_achievements")]
public UserAchievement[] Achievements; public APIUserAchievement[] Achievements;
public class UserAchievement
{
[JsonProperty("achieved_at")]
public DateTimeOffset AchievedAt;
[JsonProperty("achievement_id")]
public int ID;
}
[JsonProperty("monthly_playcounts")] [JsonProperty("monthly_playcounts")]
public APIUserHistoryCount[] MonthlyPlaycounts; public APIUserHistoryCount[] MonthlyPlaycounts;

View File

@ -0,0 +1,17 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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;
}
}

View File

@ -7,7 +7,6 @@ using osu.Framework.Localisation;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
using osu.Game.Scoring; using osu.Game.Scoring;
using osu.Game.Utils; using osu.Game.Utils;
using static osu.Game.Online.API.Requests.Responses.APIUser;
namespace osu.Game.Users namespace osu.Game.Users
{ {
@ -35,7 +34,7 @@ namespace osu.Game.Users
public int? CountryRank; public int? CountryRank;
// populated via User model, as that's where the data currently lives. // populated via User model, as that's where the data currently lives.
public RankHistoryData RankHistory; public APIRankHistory RankHistory;
[JsonProperty(@"pp")] [JsonProperty(@"pp")]
public decimal? PP; public decimal? PP;