1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 20:53:04 +08:00

Remove in-between properties

This commit is contained in:
Dean Herbert 2018-02-07 18:04:32 +09:00
parent 20c00720e5
commit 647cc4bdad
8 changed files with 40 additions and 56 deletions

View File

@ -63,8 +63,8 @@ namespace osu.Game.Tests.Visual
{ {
Value = new[] Value = new[]
{ {
new User { GlobalRank = 1355 }, new User { Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 1355 } } },
new User { GlobalRank = 8756 }, new User { Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 8756 } } },
}, },
}, },
}), }),
@ -99,10 +99,10 @@ namespace osu.Game.Tests.Visual
}, },
Participants = Participants =
{ {
Value = new[] Value = new[]
{ {
new User { GlobalRank = 578975 }, new User { Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 578975 } } },
new User { GlobalRank = 24554 }, new User { Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 24554 } } },
}, },
}, },
}), }),
@ -116,8 +116,8 @@ namespace osu.Game.Tests.Visual
AddStep(@"change beatmap", () => first.Room.Beatmap.Value = null); AddStep(@"change beatmap", () => first.Room.Beatmap.Value = null);
AddStep(@"change participants", () => first.Room.Participants.Value = new[] AddStep(@"change participants", () => first.Room.Participants.Value = new[]
{ {
new User { GlobalRank = 1254 }, new User { Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 1254 } } },
new User { GlobalRank = 123189 }, new User { Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 123189 } } },
}); });
} }

View File

@ -65,7 +65,7 @@ namespace osu.Game.Tests.Visual
{ {
Statistics = new UserStatistics Statistics = new UserStatistics
{ {
Rank = 123456, Ranks = new UserStatistics.UserRanks { Global = 123456 },
PP = 12345, PP = 12345,
} }
}; };
@ -77,7 +77,7 @@ namespace osu.Game.Tests.Visual
{ {
Statistics = new UserStatistics Statistics = new UserStatistics
{ {
Rank = 89000, Ranks = new UserStatistics.UserRanks { Global = 89000 },
PP = 12345, PP = 12345,
}, },
RankHistory = new User.RankHistoryData RankHistory = new User.RankHistoryData
@ -93,7 +93,7 @@ namespace osu.Game.Tests.Visual
{ {
Statistics = new UserStatistics Statistics = new UserStatistics
{ {
Rank = 89000, Ranks = new UserStatistics.UserRanks { Global = 89000 },
PP = 12345, PP = 12345,
}, },
RankHistory = new User.RankHistoryData RankHistory = new User.RankHistoryData
@ -109,7 +109,7 @@ namespace osu.Game.Tests.Visual
{ {
Statistics = new UserStatistics Statistics = new UserStatistics
{ {
Rank = 12000, Ranks = new UserStatistics.UserRanks { Global = 12000 },
PP = 12345, PP = 12345,
}, },
RankHistory = new User.RankHistoryData RankHistory = new User.RankHistoryData

View File

@ -54,12 +54,12 @@ namespace osu.Game.Tests.Visual
{ {
Value = new[] Value = new[]
{ {
new User { Username = @"flyte", Id = 3103765, GlobalRank = 1425 }, new User { Username = @"flyte", Id = 3103765, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 142 } } },
new User { Username = @"Cookiezi", Id = 124493, GlobalRank = 5466 }, new User { Username = @"Cookiezi", Id = 124493, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 546 } } },
new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 2873 }, new User { Username = @"Angelsim", Id = 1777162, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 287 } } },
new User { Username = @"Rafis", Id = 2558286, GlobalRank = 4687 }, new User { Username = @"Rafis", Id = 2558286, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 468 } } },
new User { Username = @"hvick225", Id = 50265, GlobalRank = 3258 }, new User { Username = @"hvick225", Id = 50265, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 325 } } },
new User { Username = @"peppy", Id = 2, GlobalRank = 6251 } new User { Username = @"peppy", Id = 2, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 625 } } },
} }
} }
}; };
@ -80,8 +80,8 @@ namespace osu.Game.Tests.Visual
AddStep(@"change max participants", () => room.MaxParticipants.Value = null); AddStep(@"change max participants", () => room.MaxParticipants.Value = null);
AddStep(@"change participants", () => room.Participants.Value = new[] AddStep(@"change participants", () => room.Participants.Value = new[]
{ {
new User { Username = @"filsdelama", Id = 2831793, GlobalRank = 8542 }, new User { Username = @"filsdelama", Id = 2831793, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 854 } } },
new User { Username = @"_index", Id = 652457, GlobalRank = 15024 } new User { Username = @"_index", Id = 652457, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 150 } } }
}); });
AddStep(@"change room", () => AddStep(@"change room", () =>
@ -121,9 +121,9 @@ namespace osu.Game.Tests.Visual
{ {
Value = new[] Value = new[]
{ {
new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 4 }, new User { Username = @"Angelsim", Id = 1777162, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 4 } } },
new User { Username = @"HappyStick", Id = 256802, GlobalRank = 752 }, new User { Username = @"HappyStick", Id = 256802, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 752 } } },
new User { Username = @"-Konpaku-", Id = 2258797, GlobalRank = 571 } new User { Username = @"-Konpaku-", Id = 2258797, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 571 } } }
} }
} }
}; };

View File

@ -44,10 +44,9 @@ namespace osu.Game.Tests.Visual
ProfileOrder = new[] { "me" }, ProfileOrder = new[] { "me" },
Statistics = new UserStatistics Statistics = new UserStatistics
{ {
Rank = 2148, Ranks = new UserStatistics.UserRanks { Global = 2148, Country = 1 },
PP = 4567.89m PP = 4567.89m,
}, },
CountryRank = 1,
RankHistory = new User.RankHistoryData RankHistory = new User.RankHistoryData
{ {
Mode = @"osu", Mode = @"osu",

View File

@ -105,7 +105,7 @@ namespace osu.Game.Overlays.Profile
return; return;
} }
int[] userRanks = user.RankHistory?.Data ?? new[] { user.Statistics.Rank }; int[] userRanks = user.RankHistory?.Data ?? new[] { user.Statistics.Ranks.Global };
ranks = userRanks.Select((x, index) => new KeyValuePair<int, int>(index, x)).Where(x => x.Value != 0).ToArray(); ranks = userRanks.Select((x, index) => new KeyValuePair<int, int>(index, x)).Where(x => x.Value != 0).ToArray();
if (ranks.Length > 1) if (ranks.Length > 1)
@ -124,9 +124,9 @@ namespace osu.Game.Overlays.Profile
private void updateRankTexts() private void updateRankTexts()
{ {
rankText.Text = User.Value.Statistics.Rank > 0 ? $"#{User.Value.Statistics.Rank:#,0}" : "no rank"; rankText.Text = User.Value.Statistics.Ranks.Global > 0 ? $"#{User.Value.Statistics.Ranks.Global:#,0}" : "no rank";
performanceText.Text = User.Value.Statistics.PP != null ? $"{User.Value.Statistics.PP:#,0}pp" : string.Empty; performanceText.Text = User.Value.Statistics.PP != null ? $"{User.Value.Statistics.PP:#,0}pp" : string.Empty;
relativeText.Text = $"{User.Value.Country?.FullName} #{User.Value.CountryRank:#,0}"; relativeText.Text = $"{User.Value.Country?.FullName} #{User.Value.Statistics.Ranks.Country:#,0}";
} }
private void showHistoryRankTexts(int dayIndex) private void showHistoryRankTexts(int dayIndex)

View File

@ -35,7 +35,7 @@ namespace osu.Game.Screens.Multiplayer
{ {
set set
{ {
var ranks = value.Select(u => u.GlobalRank); var ranks = value.Select(u => u.Statistics.Ranks.Global);
levelRangeLower.Text = ranks.Min().ToString(); levelRangeLower.Text = ranks.Min().ToString();
levelRangeHigher.Text = ranks.Max().ToString(); levelRangeHigher.Text = ranks.Max().ToString();
} }

View File

@ -26,18 +26,6 @@ namespace osu.Game.Users
[JsonProperty(@"age")] [JsonProperty(@"age")]
public int? Age; public int? Age;
public int GlobalRank
{
get => Statistics?.Ranks.GlobalRank ?? 0;
set => Statistics.Ranks.GlobalRank = value;
}
public int CountryRank
{
get => Statistics?.Ranks.CountryRank ?? 0;
set => Statistics.Ranks.CountryRank = value;
}
//public Team Team; //public Team Team;
[JsonProperty(@"profile_colour")] [JsonProperty(@"profile_colour")]

View File

@ -23,23 +23,10 @@ namespace osu.Game.Users
public decimal? PP; public decimal? PP;
[JsonProperty(@"pp_rank")] [JsonProperty(@"pp_rank")]
public int Rank private int rank { set => Ranks.Global = value; }
{
get => Ranks.GlobalRank ?? 0;
set => Ranks.GlobalRank = value;
}
[JsonProperty(@"rank")] [JsonProperty(@"rank")]
public UserRank Ranks; public UserRanks Ranks;
public struct UserRank
{
[JsonProperty(@"global")]
public int? GlobalRank;
[JsonProperty(@"country")]
public int? CountryRank;
}
[JsonProperty(@"ranked_score")] [JsonProperty(@"ranked_score")]
public long RankedScore; public long RankedScore;
@ -82,5 +69,15 @@ namespace osu.Game.Users
[JsonProperty(@"a")] [JsonProperty(@"a")]
public int A; public int A;
} }
public struct UserRanks
{
[JsonProperty(@"global")]
public int Global;
[JsonProperty(@"country")]
public int Country;
}
} }
} }