1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 16:52:55 +08:00

Merge branch 'master' into fix-multiplayer-participant-panel-null-ruleset

This commit is contained in:
Salman Ahmed 2022-07-18 12:24:47 +03:00 committed by GitHub
commit 2befcfedbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 988 additions and 291 deletions

View File

@ -55,7 +55,7 @@ namespace osu.Game.Tests.Visual.Online
Id = 3103765, Id = 3103765,
IsOnline = true, IsOnline = true,
Statistics = new UserStatistics { GlobalRank = 1111 }, Statistics = new UserStatistics { GlobalRank = 1111 },
Country = new Country { FlagName = "JP" }, CountryCode = CountryCode.JP,
CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c6.jpg"
}, },
new APIUser new APIUser
@ -64,7 +64,7 @@ namespace osu.Game.Tests.Visual.Online
Id = 2, Id = 2,
IsOnline = false, IsOnline = false,
Statistics = new UserStatistics { GlobalRank = 2222 }, Statistics = new UserStatistics { GlobalRank = 2222 },
Country = new Country { FlagName = "AU" }, CountryCode = CountryCode.AU,
CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
IsSupporter = true, IsSupporter = true,
SupportLevel = 3, SupportLevel = 3,
@ -73,7 +73,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
Username = "Evast", Username = "Evast",
Id = 8195163, Id = 8195163,
Country = new Country { FlagName = "BY" }, CountryCode = CountryCode.BY,
CoverUrl = "https://assets.ppy.sh/user-profile-covers/8195163/4a8e2ad5a02a2642b631438cfa6c6bd7e2f9db289be881cb27df18331f64144c.jpeg", CoverUrl = "https://assets.ppy.sh/user-profile-covers/8195163/4a8e2ad5a02a2642b631438cfa6c6bd7e2f9db289be881cb27df18331f64144c.jpeg",
IsOnline = false, IsOnline = false,
LastVisit = DateTimeOffset.Now LastVisit = DateTimeOffset.Now

View File

@ -23,7 +23,7 @@ namespace osu.Game.Tests.Visual.Online
public TestSceneRankingsCountryFilter() public TestSceneRankingsCountryFilter()
{ {
var countryBindable = new Bindable<Country>(); var countryBindable = new Bindable<CountryCode>();
AddRange(new Drawable[] AddRange(new Drawable[]
{ {
@ -56,20 +56,12 @@ namespace osu.Game.Tests.Visual.Online
} }
}); });
var country = new Country const CountryCode country = CountryCode.BY;
{ const CountryCode unknown_country = CountryCode.CK;
FlagName = "BY",
FullName = "Belarus"
};
var unknownCountry = new Country
{
FlagName = "CK",
FullName = "Cook Islands"
};
AddStep("Set country", () => countryBindable.Value = country); AddStep("Set country", () => countryBindable.Value = country);
AddStep("Set null country", () => countryBindable.Value = null); AddStep("Set default country", () => countryBindable.Value = default);
AddStep("Set country with no flag", () => countryBindable.Value = unknownCountry); AddStep("Set country with no flag", () => countryBindable.Value = unknown_country);
} }
} }
} }

View File

@ -19,7 +19,7 @@ namespace osu.Game.Tests.Visual.Online
public TestSceneRankingsHeader() public TestSceneRankingsHeader()
{ {
var countryBindable = new Bindable<Country>(); var countryBindable = new Bindable<CountryCode>();
var ruleset = new Bindable<RulesetInfo>(); var ruleset = new Bindable<RulesetInfo>();
var scope = new Bindable<RankingsScope>(); var scope = new Bindable<RankingsScope>();
@ -30,21 +30,12 @@ namespace osu.Game.Tests.Visual.Online
Ruleset = { BindTarget = ruleset } Ruleset = { BindTarget = ruleset }
}); });
var country = new Country const CountryCode country = CountryCode.BY;
{ const CountryCode unknown_country = CountryCode.CK;
FlagName = "BY",
FullName = "Belarus"
};
var unknownCountry = new Country
{
FlagName = "CK",
FullName = "Cook Islands"
};
AddStep("Set country", () => countryBindable.Value = country); AddStep("Set country", () => countryBindable.Value = country);
AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score); AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score);
AddStep("Set country with no flag", () => countryBindable.Value = unknownCountry); AddStep("Set country with no flag", () => countryBindable.Value = unknown_country);
} }
} }
} }

View File

@ -21,7 +21,7 @@ namespace osu.Game.Tests.Visual.Online
private TestRankingsOverlay rankingsOverlay; private TestRankingsOverlay rankingsOverlay;
private readonly Bindable<Country> countryBindable = new Bindable<Country>(); private readonly Bindable<CountryCode> countryBindable = new Bindable<CountryCode>();
private readonly Bindable<RankingsScope> scope = new Bindable<RankingsScope>(); private readonly Bindable<RankingsScope> scope = new Bindable<RankingsScope>();
[SetUp] [SetUp]
@ -48,15 +48,15 @@ namespace osu.Game.Tests.Visual.Online
public void TestFlagScopeDependency() public void TestFlagScopeDependency()
{ {
AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score); AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score);
AddAssert("Check country is Null", () => countryBindable.Value == null); AddAssert("Check country is default", () => countryBindable.IsDefault);
AddStep("Set country", () => countryBindable.Value = us_country); AddStep("Set country", () => countryBindable.Value = CountryCode.US);
AddAssert("Check scope is Performance", () => scope.Value == RankingsScope.Performance); AddAssert("Check scope is Performance", () => scope.Value == RankingsScope.Performance);
} }
[Test] [Test]
public void TestShowCountry() public void TestShowCountry()
{ {
AddStep("Show US", () => rankingsOverlay.ShowCountry(us_country)); AddStep("Show US", () => rankingsOverlay.ShowCountry(CountryCode.US));
} }
private void loadRankingsOverlay() private void loadRankingsOverlay()
@ -69,15 +69,9 @@ namespace osu.Game.Tests.Visual.Online
}; };
} }
private static readonly Country us_country = new Country
{
FlagName = "US",
FullName = "United States"
};
private class TestRankingsOverlay : RankingsOverlay private class TestRankingsOverlay : RankingsOverlay
{ {
public new Bindable<Country> Country => base.Country; public new Bindable<CountryCode> Country => base.Country;
} }
} }
} }

View File

@ -57,8 +57,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
new CountryStatistics new CountryStatistics
{ {
Country = new Country { FlagName = "US", FullName = "United States" }, Code = CountryCode.US,
FlagName = "US",
ActiveUsers = 2_972_623, ActiveUsers = 2_972_623,
PlayCount = 3_086_515_743, PlayCount = 3_086_515_743,
RankedScore = 449_407_643_332_546, RankedScore = 449_407_643_332_546,
@ -66,8 +65,7 @@ namespace osu.Game.Tests.Visual.Online
}, },
new CountryStatistics new CountryStatistics
{ {
Country = new Country { FlagName = "RU", FullName = "Russian Federation" }, Code = CountryCode.RU,
FlagName = "RU",
ActiveUsers = 1_609_989, ActiveUsers = 1_609_989,
PlayCount = 1_637_052_841, PlayCount = 1_637_052_841,
RankedScore = 221_660_827_473_004, RankedScore = 221_660_827_473_004,
@ -86,7 +84,7 @@ namespace osu.Game.Tests.Visual.Online
User = new APIUser User = new APIUser
{ {
Username = "first active user", Username = "first active user",
Country = new Country { FlagName = "JP" }, CountryCode = CountryCode.JP,
Active = true, Active = true,
}, },
Accuracy = 0.9972, Accuracy = 0.9972,
@ -106,7 +104,7 @@ namespace osu.Game.Tests.Visual.Online
User = new APIUser User = new APIUser
{ {
Username = "inactive user", Username = "inactive user",
Country = new Country { FlagName = "AU" }, CountryCode = CountryCode.AU,
Active = false, Active = false,
}, },
Accuracy = 0.9831, Accuracy = 0.9831,
@ -126,7 +124,7 @@ namespace osu.Game.Tests.Visual.Online
User = new APIUser User = new APIUser
{ {
Username = "second active user", Username = "second active user",
Country = new Country { FlagName = "PL" }, CountryCode = CountryCode.PL,
Active = true, Active = true,
}, },
Accuracy = 0.9584, Accuracy = 0.9584,

View File

@ -157,11 +157,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
Id = 6602580, Id = 6602580,
Username = @"waaiiru", Username = @"waaiiru",
Country = new Country CountryCode = CountryCode.ES,
{
FullName = @"Spain",
FlagName = @"ES",
},
}, },
Mods = new[] Mods = new[]
{ {
@ -184,11 +180,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
Id = 4608074, Id = 4608074,
Username = @"Skycries", Username = @"Skycries",
Country = new Country CountryCode = CountryCode.BR,
{
FullName = @"Brazil",
FlagName = @"BR",
},
}, },
Mods = new[] Mods = new[]
{ {
@ -210,11 +202,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
Id = 1014222, Id = 1014222,
Username = @"eLy", Username = @"eLy",
Country = new Country CountryCode = CountryCode.JP,
{
FullName = @"Japan",
FlagName = @"JP",
},
}, },
Mods = new[] Mods = new[]
{ {
@ -235,11 +223,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
Id = 1541390, Id = 1541390,
Username = @"Toukai", Username = @"Toukai",
Country = new Country CountryCode = CountryCode.CA,
{
FullName = @"Canada",
FlagName = @"CA",
},
}, },
Mods = new[] Mods = new[]
{ {
@ -259,11 +243,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
Id = 7151382, Id = 7151382,
Username = @"Mayuri Hana", Username = @"Mayuri Hana",
Country = new Country CountryCode = CountryCode.TH,
{
FullName = @"Thailand",
FlagName = @"TH",
},
}, },
Rank = ScoreRank.D, Rank = ScoreRank.D,
PP = 160, PP = 160,
@ -302,11 +282,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
Id = 7151382, Id = 7151382,
Username = @"Mayuri Hana", Username = @"Mayuri Hana",
Country = new Country CountryCode = CountryCode.TH,
{
FullName = @"Thailand",
FlagName = @"TH",
},
}, },
Rank = ScoreRank.D, Rank = ScoreRank.D,
PP = 160, PP = 160,

View File

@ -60,7 +60,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
Username = @"flyte", Username = @"flyte",
Id = 3103765, Id = 3103765,
Country = new Country { FlagName = @"JP" }, CountryCode = CountryCode.JP,
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg", CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg",
Status = { Value = new UserStatusOnline() } Status = { Value = new UserStatusOnline() }
}) { Width = 300 }, }) { Width = 300 },
@ -68,7 +68,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
Username = @"peppy", Username = @"peppy",
Id = 2, Id = 2,
Country = new Country { FlagName = @"AU" }, CountryCode = CountryCode.AU,
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
IsSupporter = true, IsSupporter = true,
SupportLevel = 3, SupportLevel = 3,
@ -77,7 +77,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
Username = @"Evast", Username = @"Evast",
Id = 8195163, Id = 8195163,
Country = new Country { FlagName = @"BY" }, CountryCode = CountryCode.BY,
CoverUrl = @"https://assets.ppy.sh/user-profile-covers/8195163/4a8e2ad5a02a2642b631438cfa6c6bd7e2f9db289be881cb27df18331f64144c.jpeg", CoverUrl = @"https://assets.ppy.sh/user-profile-covers/8195163/4a8e2ad5a02a2642b631438cfa6c6bd7e2f9db289be881cb27df18331f64144c.jpeg",
IsOnline = false, IsOnline = false,
LastVisit = DateTimeOffset.Now LastVisit = DateTimeOffset.Now

View File

@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
Username = @"Somebody", Username = @"Somebody",
Id = 1, Id = 1,
Country = new Country { FullName = @"Alien" }, CountryCode = CountryCode.Unknown,
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg", CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg",
JoinDate = DateTimeOffset.Now.AddDays(-1), JoinDate = DateTimeOffset.Now.AddDays(-1),
LastVisit = DateTimeOffset.Now, LastVisit = DateTimeOffset.Now,
@ -82,7 +82,7 @@ namespace osu.Game.Tests.Visual.Online
Username = @"peppy", Username = @"peppy",
Id = 2, Id = 2,
IsSupporter = true, IsSupporter = true,
Country = new Country { FullName = @"Australia", FlagName = @"AU" }, CountryCode = CountryCode.AU,
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg" CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg"
})); }));
@ -90,7 +90,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
Username = @"flyte", Username = @"flyte",
Id = 3103765, Id = 3103765,
Country = new Country { FullName = @"Japan", FlagName = @"JP" }, CountryCode = CountryCode.JP,
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg"
})); }));
@ -99,7 +99,7 @@ namespace osu.Game.Tests.Visual.Online
Username = @"BanchoBot", Username = @"BanchoBot",
Id = 3, Id = 3,
IsBot = true, IsBot = true,
Country = new Country { FullName = @"Saint Helena", FlagName = @"SH" }, CountryCode = CountryCode.SH,
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c4.jpg" CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c4.jpg"
})); }));

View File

@ -21,7 +21,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
public TestSceneUserProfileScores() public TestSceneUserProfileScores()
{ {
var firstScore = new APIScore var firstScore = new SoloScoreInfo
{ {
PP = 1047.21, PP = 1047.21,
Rank = ScoreRank.SH, Rank = ScoreRank.SH,
@ -34,7 +34,7 @@ namespace osu.Game.Tests.Visual.Online
}, },
DifficultyName = "Extreme" DifficultyName = "Extreme"
}, },
Date = DateTimeOffset.Now, EndedAt = DateTimeOffset.Now,
Mods = new[] Mods = new[]
{ {
new APIMod { Acronym = new OsuModHidden().Acronym }, new APIMod { Acronym = new OsuModHidden().Acronym },
@ -44,7 +44,7 @@ namespace osu.Game.Tests.Visual.Online
Accuracy = 0.9813 Accuracy = 0.9813
}; };
var secondScore = new APIScore var secondScore = new SoloScoreInfo
{ {
PP = 134.32, PP = 134.32,
Rank = ScoreRank.A, Rank = ScoreRank.A,
@ -57,7 +57,7 @@ namespace osu.Game.Tests.Visual.Online
}, },
DifficultyName = "[4K] Regret" DifficultyName = "[4K] Regret"
}, },
Date = DateTimeOffset.Now, EndedAt = DateTimeOffset.Now,
Mods = new[] Mods = new[]
{ {
new APIMod { Acronym = new OsuModHardRock().Acronym }, new APIMod { Acronym = new OsuModHardRock().Acronym },
@ -66,7 +66,7 @@ namespace osu.Game.Tests.Visual.Online
Accuracy = 0.998546 Accuracy = 0.998546
}; };
var thirdScore = new APIScore var thirdScore = new SoloScoreInfo
{ {
PP = 96.83, PP = 96.83,
Rank = ScoreRank.S, Rank = ScoreRank.S,
@ -79,11 +79,11 @@ namespace osu.Game.Tests.Visual.Online
}, },
DifficultyName = "Insane" DifficultyName = "Insane"
}, },
Date = DateTimeOffset.Now, EndedAt = DateTimeOffset.Now,
Accuracy = 0.9726 Accuracy = 0.9726
}; };
var noPPScore = new APIScore var noPPScore = new SoloScoreInfo
{ {
Rank = ScoreRank.B, Rank = ScoreRank.B,
Beatmap = new APIBeatmap Beatmap = new APIBeatmap
@ -95,7 +95,7 @@ namespace osu.Game.Tests.Visual.Online
}, },
DifficultyName = "[4K] Cataclysmic Hypernova" DifficultyName = "[4K] Cataclysmic Hypernova"
}, },
Date = DateTimeOffset.Now, EndedAt = DateTimeOffset.Now,
Accuracy = 0.55879 Accuracy = 0.55879
}; };

View File

@ -140,11 +140,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
Id = 6602580, Id = 6602580,
Username = @"waaiiru", Username = @"waaiiru",
Country = new Country CountryCode = CountryCode.ES,
{
FullName = @"Spain",
FlagName = @"ES",
},
}, },
}); });
} }
@ -164,12 +160,8 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
Id = 6602580, Id = 6602580,
Username = @"waaiiru", Username = @"waaiiru",
Country = new Country CountryCode = CountryCode.ES,
{ }
FullName = @"Spain",
FlagName = @"ES",
},
},
}); });
} }
@ -225,11 +217,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
Id = 6602580, Id = 6602580,
Username = @"waaiiru", Username = @"waaiiru",
Country = new Country CountryCode = CountryCode.ES,
{
FullName = @"Spain",
FlagName = @"ES",
},
}, },
}, },
new ScoreInfo new ScoreInfo
@ -246,11 +234,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
Id = 4608074, Id = 4608074,
Username = @"Skycries", Username = @"Skycries",
Country = new Country CountryCode = CountryCode.BR,
{
FullName = @"Brazil",
FlagName = @"BR",
},
}, },
}, },
new ScoreInfo new ScoreInfo
@ -268,11 +252,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
Id = 1014222, Id = 1014222,
Username = @"eLy", Username = @"eLy",
Country = new Country CountryCode = CountryCode.JP,
{
FullName = @"Japan",
FlagName = @"JP",
},
}, },
}, },
new ScoreInfo new ScoreInfo
@ -290,11 +270,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
Id = 1541390, Id = 1541390,
Username = @"Toukai", Username = @"Toukai",
Country = new Country CountryCode = CountryCode.CA,
{
FullName = @"Canada",
FlagName = @"CA",
},
}, },
}, },
new ScoreInfo new ScoreInfo
@ -312,11 +288,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
Id = 2243452, Id = 2243452,
Username = @"Satoruu", Username = @"Satoruu",
Country = new Country CountryCode = CountryCode.VE,
{
FullName = @"Venezuela",
FlagName = @"VE",
},
}, },
}, },
new ScoreInfo new ScoreInfo
@ -334,11 +306,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
Id = 2705430, Id = 2705430,
Username = @"Mooha", Username = @"Mooha",
Country = new Country CountryCode = CountryCode.FR,
{
FullName = @"France",
FlagName = @"FR",
},
}, },
}, },
new ScoreInfo new ScoreInfo
@ -356,11 +324,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
Id = 7151382, Id = 7151382,
Username = @"Mayuri Hana", Username = @"Mayuri Hana",
Country = new Country CountryCode = CountryCode.TH,
{
FullName = @"Thailand",
FlagName = @"TH",
},
}, },
}, },
new ScoreInfo new ScoreInfo
@ -378,11 +342,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
Id = 2051389, Id = 2051389,
Username = @"FunOrange", Username = @"FunOrange",
Country = new Country CountryCode = CountryCode.CA,
{
FullName = @"Canada",
FlagName = @"CA",
},
}, },
}, },
new ScoreInfo new ScoreInfo
@ -400,11 +360,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
Id = 6169483, Id = 6169483,
Username = @"-Hebel-", Username = @"-Hebel-",
Country = new Country CountryCode = CountryCode.MX,
{
FullName = @"Mexico",
FlagName = @"MX",
},
}, },
}, },
new ScoreInfo new ScoreInfo
@ -422,11 +378,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
Id = 6702666, Id = 6702666,
Username = @"prhtnsm", Username = @"prhtnsm",
Country = new Country CountryCode = CountryCode.DE,
{
FullName = @"Germany",
FlagName = @"DE",
},
}, },
}, },
}; };

View File

@ -69,11 +69,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
Id = 6602580, Id = 6602580,
Username = @"waaiiru", Username = @"waaiiru",
Country = new Country CountryCode = CountryCode.ES,
{
FullName = @"Spain",
FlagName = @"ES",
},
}, },
}, },
new ScoreInfo new ScoreInfo
@ -88,11 +84,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
Id = 4608074, Id = 4608074,
Username = @"Skycries", Username = @"Skycries",
Country = new Country CountryCode = CountryCode.BR,
{
FullName = @"Brazil",
FlagName = @"BR",
},
}, },
}, },
new ScoreInfo new ScoreInfo
@ -107,11 +99,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
Id = 1541390, Id = 1541390,
Username = @"Toukai", Username = @"Toukai",
Country = new Country CountryCode = CountryCode.CA,
{
FullName = @"Canada",
FlagName = @"CA",
},
}, },
} }
}; };

View File

@ -22,7 +22,8 @@ namespace osu.Game.Tournament.Models
/// <summary> /// <summary>
/// The player's country. /// The player's country.
/// </summary> /// </summary>
public Country? Country { get; set; } [JsonProperty("country_code")]
public CountryCode CountryCode { get; set; }
/// <summary> /// <summary>
/// The player's global rank, or null if not available. /// The player's global rank, or null if not available.
@ -40,7 +41,7 @@ namespace osu.Game.Tournament.Models
{ {
Id = OnlineID, Id = OnlineID,
Username = Username, Username = Username,
Country = Country, CountryCode = CountryCode,
CoverUrl = CoverUrl, CoverUrl = CoverUrl,
}; };

View File

@ -21,6 +21,7 @@ using osu.Game.Online.API.Requests.Responses;
using osu.Game.Tournament.IO; using osu.Game.Tournament.IO;
using osu.Game.Tournament.IPC; using osu.Game.Tournament.IPC;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osu.Game.Users;
using osuTK.Input; using osuTK.Input;
namespace osu.Game.Tournament namespace osu.Game.Tournament
@ -186,7 +187,9 @@ namespace osu.Game.Tournament
{ {
var playersRequiringPopulation = ladder.Teams var playersRequiringPopulation = ladder.Teams
.SelectMany(t => t.Players) .SelectMany(t => t.Players)
.Where(p => string.IsNullOrEmpty(p.Username) || p.Rank == null).ToList(); .Where(p => string.IsNullOrEmpty(p.Username)
|| p.CountryCode == CountryCode.Unknown
|| p.Rank == null).ToList();
if (playersRequiringPopulation.Count == 0) if (playersRequiringPopulation.Count == 0)
return false; return false;
@ -288,7 +291,7 @@ namespace osu.Game.Tournament
user.Username = res.Username; user.Username = res.Username;
user.CoverUrl = res.CoverUrl; user.CoverUrl = res.CoverUrl;
user.Country = res.Country; user.CountryCode = res.CountryCode;
user.Rank = res.Statistics?.GlobalRank; user.Rank = res.Statistics?.GlobalRank;
success?.Invoke(); success?.Invoke();

View File

@ -60,8 +60,9 @@ namespace osu.Game.Database
/// 14 2022-03-01 Added BeatmapUserSettings to BeatmapInfo. /// 14 2022-03-01 Added BeatmapUserSettings to BeatmapInfo.
/// 15 2022-07-13 Added LastPlayed to BeatmapInfo. /// 15 2022-07-13 Added LastPlayed to BeatmapInfo.
/// 16 2022-07-15 Removed HasReplay from ScoreInfo. /// 16 2022-07-15 Removed HasReplay from ScoreInfo.
/// 17 2022-07-16 Added CountryCode to RealmUser.
/// </summary> /// </summary>
private const int schema_version = 16; private const int schema_version = 17;
/// <summary> /// <summary>
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods. /// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.

View File

@ -2,9 +2,11 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.ComponentModel; using System.ComponentModel;
using JetBrains.Annotations;
namespace osu.Game.Localisation namespace osu.Game.Localisation
{ {
[UsedImplicitly(ImplicitUseTargetFlags.WithMembers)]
public enum Language public enum Language
{ {
[Description(@"English")] [Description(@"English")]

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
#nullable disable
using System; using System;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.Users; using osu.Game.Users;
@ -17,6 +15,16 @@ namespace osu.Game.Models
public string Username { get; set; } = string.Empty; public string Username { get; set; } = string.Empty;
[Ignored]
public CountryCode CountryCode
{
get => Enum.TryParse(CountryString, out CountryCode country) ? country : CountryCode.Unknown;
set => CountryString = value.ToString();
}
[MapTo(nameof(CountryCode))]
public string CountryString { get; set; } = default(CountryCode).ToString();
public bool IsBot => false; public bool IsBot => false;
public bool Equals(RealmUser other) public bool Equals(RealmUser other)

View File

@ -5,6 +5,7 @@
using osu.Framework.IO.Network; using osu.Framework.IO.Network;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Users;
namespace osu.Game.Online.API.Requests namespace osu.Game.Online.API.Requests
{ {
@ -12,21 +13,21 @@ namespace osu.Game.Online.API.Requests
{ {
public readonly UserRankingsType Type; public readonly UserRankingsType Type;
private readonly string country; private readonly CountryCode countryCode;
public GetUserRankingsRequest(RulesetInfo ruleset, UserRankingsType type = UserRankingsType.Performance, int page = 1, string country = null) public GetUserRankingsRequest(RulesetInfo ruleset, UserRankingsType type = UserRankingsType.Performance, int page = 1, CountryCode countryCode = CountryCode.Unknown)
: base(ruleset, page) : base(ruleset, page)
{ {
Type = type; Type = type;
this.country = country; this.countryCode = countryCode;
} }
protected override WebRequest CreateWebRequest() protected override WebRequest CreateWebRequest()
{ {
var req = base.CreateWebRequest(); var req = base.CreateWebRequest();
if (country != null) if (countryCode != CountryCode.Unknown)
req.AddParameter("country", country); req.AddParameter("country", countryCode.ToString());
return req; return req;
} }

View File

@ -10,7 +10,7 @@ using osu.Game.Rulesets;
namespace osu.Game.Online.API.Requests namespace osu.Game.Online.API.Requests
{ {
public class GetUserScoresRequest : PaginatedAPIRequest<List<APIScore>> public class GetUserScoresRequest : PaginatedAPIRequest<List<SoloScoreInfo>>
{ {
private readonly long userId; private readonly long userId;
private readonly ScoreType type; private readonly ScoreType type;

View File

@ -34,8 +34,19 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty(@"previous_usernames")] [JsonProperty(@"previous_usernames")]
public string[] PreviousUsernames; public string[] PreviousUsernames;
private CountryCode? countryCode;
public CountryCode CountryCode
{
get => countryCode ??= (Enum.TryParse(country?.Code, out CountryCode result) ? result : default);
set => countryCode = value;
}
#pragma warning disable 649
[CanBeNull]
[JsonProperty(@"country")] [JsonProperty(@"country")]
public Country Country; private Country country;
#pragma warning restore 649
public readonly Bindable<UserStatus> Status = new Bindable<UserStatus>(); public readonly Bindable<UserStatus> Status = new Bindable<UserStatus>();
@ -256,5 +267,13 @@ namespace osu.Game.Online.API.Requests.Responses
public int OnlineID => Id; public int OnlineID => Id;
public bool Equals(APIUser other) => this.MatchesOnlineID(other); public bool Equals(APIUser other) => this.MatchesOnlineID(other);
#pragma warning disable 649
private class Country
{
[JsonProperty(@"code")]
public string Code;
}
#pragma warning restore 649
} }
} }

View File

@ -54,7 +54,7 @@ namespace osu.Game.Online.API.Requests.Responses
public DateTimeOffset? StartedAt { get; set; } public DateTimeOffset? StartedAt { get; set; }
[JsonProperty("ended_at")] [JsonProperty("ended_at")]
public DateTimeOffset? EndedAt { get; set; } public DateTimeOffset EndedAt { get; set; }
[JsonProperty("mods")] [JsonProperty("mods")]
public APIMod[] Mods { get; set; } = Array.Empty<APIMod>(); public APIMod[] Mods { get; set; } = Array.Empty<APIMod>();
@ -82,6 +82,23 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty("user")] [JsonProperty("user")]
public APIUser? User { get; set; } public APIUser? User { get; set; }
[JsonProperty("beatmap")]
public APIBeatmap? Beatmap { get; set; }
[JsonProperty("beatmapset")]
public APIBeatmapSet? BeatmapSet
{
set
{
// in the deserialisation case we need to ferry this data across.
// the order of properties returned by the API guarantees that the beatmap is populated by this point.
if (!(Beatmap is APIBeatmap apiBeatmap))
throw new InvalidOperationException("Beatmap set metadata arrived before beatmap metadata in response");
apiBeatmap.BeatmapSet = value;
}
}
[JsonProperty("pp")] [JsonProperty("pp")]
public double? PP { get; set; } public double? PP { get; set; }
@ -128,7 +145,7 @@ namespace osu.Game.Online.API.Requests.Responses
MaxCombo = MaxCombo, MaxCombo = MaxCombo,
Rank = Rank, Rank = Rank,
Statistics = Statistics, Statistics = Statistics,
Date = EndedAt ?? DateTimeOffset.Now, Date = EndedAt,
Hash = HasReplay ? "online" : string.Empty, // TODO: temporary? Hash = HasReplay ? "online" : string.Empty, // TODO: temporary?
Mods = mods, Mods = mods,
PP = PP, PP = PP,

View File

@ -181,7 +181,7 @@ namespace osu.Game.Online.Leaderboards
Masking = true, Masking = true,
Children = new Drawable[] Children = new Drawable[]
{ {
new UpdateableFlag(user.Country) new UpdateableFlag(user.CountryCode)
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,

View File

@ -56,7 +56,7 @@ namespace osu.Game.Online.Spectator
try try
{ {
await connection.SendAsync(nameof(ISpectatorServer.BeginPlaySession), state); await connection.InvokeAsync(nameof(ISpectatorServer.BeginPlaySession), state);
} }
catch (HubException exception) catch (HubException exception)
{ {
@ -73,7 +73,7 @@ namespace osu.Game.Online.Spectator
Debug.Assert(connection != null); Debug.Assert(connection != null);
return connection.SendAsync(nameof(ISpectatorServer.SendFrameData), bundle); return connection.InvokeAsync(nameof(ISpectatorServer.SendFrameData), bundle);
} }
protected override Task EndPlayingInternal(SpectatorState state) protected override Task EndPlayingInternal(SpectatorState state)
@ -83,7 +83,7 @@ namespace osu.Game.Online.Spectator
Debug.Assert(connection != null); Debug.Assert(connection != null);
return connection.SendAsync(nameof(ISpectatorServer.EndPlaySession), state); return connection.InvokeAsync(nameof(ISpectatorServer.EndPlaySession), state);
} }
protected override Task WatchUserInternal(int userId) protected override Task WatchUserInternal(int userId)
@ -93,7 +93,7 @@ namespace osu.Game.Online.Spectator
Debug.Assert(connection != null); Debug.Assert(connection != null);
return connection.SendAsync(nameof(ISpectatorServer.StartWatchingUser), userId); return connection.InvokeAsync(nameof(ISpectatorServer.StartWatchingUser), userId);
} }
protected override Task StopWatchingUserInternal(int userId) protected override Task StopWatchingUserInternal(int userId)
@ -103,7 +103,7 @@ namespace osu.Game.Online.Spectator
Debug.Assert(connection != null); Debug.Assert(connection != null);
return connection.SendAsync(nameof(ISpectatorServer.EndWatchingUser), userId); return connection.InvokeAsync(nameof(ISpectatorServer.EndWatchingUser), userId);
} }
} }
} }

View File

@ -165,10 +165,10 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Font = OsuFont.GetFont(size: text_size), Font = OsuFont.GetFont(size: text_size),
Colour = score.Accuracy == 1 ? highAccuracyColour : Color4.White Colour = score.Accuracy == 1 ? highAccuracyColour : Color4.White
}, },
new UpdateableFlag(score.User.Country) new UpdateableFlag(score.User.CountryCode)
{ {
Size = new Vector2(19, 14), Size = new Vector2(19, 14),
ShowPlaceholderOnNull = false, ShowPlaceholderOnUnknown = false,
}, },
username, username,
new OsuSpriteText new OsuSpriteText

View File

@ -120,7 +120,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Size = new Vector2(19, 14), Size = new Vector2(19, 14),
Margin = new MarginPadding { Top = 3 }, // makes spacing look more even Margin = new MarginPadding { Top = 3 }, // makes spacing look more even
ShowPlaceholderOnNull = false, ShowPlaceholderOnUnknown = false,
}, },
} }
} }
@ -141,7 +141,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
set set
{ {
avatar.User = value.User; avatar.User = value.User;
flag.Country = value.User.Country; flag.CountryCode = value.User.CountryCode;
achievedOn.Date = value.Date; achievedOn.Date = value.Date;
usernameText.Clear(); usernameText.Clear();

View File

@ -257,10 +257,14 @@ namespace osu.Game.Overlays.Chat
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(UserProfileOverlay? profile, ChannelManager? chatManager) private void load(UserProfileOverlay? profile, ChannelManager? chatManager, ChatOverlay? chatOverlay)
{ {
Action = () => profile?.ShowUser(sender); Action = () => profile?.ShowUser(sender);
startChatAction = () => chatManager?.OpenPrivateChannel(sender); startChatAction = () =>
{
chatManager?.OpenPrivateChannel(sender);
chatOverlay?.Show();
};
} }
public MenuItem[] ContextMenuItems public MenuItem[] ContextMenuItems

View File

@ -5,6 +5,7 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -136,7 +137,7 @@ namespace osu.Game.Overlays.Profile.Header
userFlag = new UpdateableFlag userFlag = new UpdateableFlag
{ {
Size = new Vector2(28, 20), Size = new Vector2(28, 20),
ShowPlaceholderOnNull = false, ShowPlaceholderOnUnknown = false,
}, },
userCountryText = new OsuSpriteText userCountryText = new OsuSpriteText
{ {
@ -174,8 +175,8 @@ namespace osu.Game.Overlays.Profile.Header
avatar.User = user; avatar.User = user;
usernameText.Text = user?.Username ?? string.Empty; usernameText.Text = user?.Username ?? string.Empty;
openUserExternally.Link = $@"{api.WebsiteRootUrl}/users/{user?.Id ?? 0}"; openUserExternally.Link = $@"{api.WebsiteRootUrl}/users/{user?.Id ?? 0}";
userFlag.Country = user?.Country; userFlag.CountryCode = user?.CountryCode ?? default;
userCountryText.Text = user?.Country?.FullName ?? "Alien"; userCountryText.Text = (user?.CountryCode ?? default).GetDescription();
supporterTag.SupportLevel = user?.SupportLevel ?? 0; supporterTag.SupportLevel = user?.SupportLevel ?? 0;
titleText.Text = user?.Title ?? string.Empty; titleText.Text = user?.Title ?? string.Empty;
titleText.Colour = Color4Extensions.FromHex(user?.Colour ?? "fff"); titleText.Colour = Color4Extensions.FromHex(user?.Colour ?? "fff");

View File

@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
private const float performance_background_shear = 0.45f; private const float performance_background_shear = 0.45f;
protected readonly APIScore Score; protected readonly SoloScoreInfo Score;
[Resolved] [Resolved]
private OsuColour colours { get; set; } private OsuColour colours { get; set; }
@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
[Resolved] [Resolved]
private OverlayColourProvider colourProvider { get; set; } private OverlayColourProvider colourProvider { get; set; }
public DrawableProfileScore(APIScore score) public DrawableProfileScore(SoloScoreInfo score)
{ {
Score = score; Score = score;
@ -98,7 +98,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular), Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular),
Colour = colours.Yellow Colour = colours.Yellow
}, },
new DrawableDate(Score.Date, 12) new DrawableDate(Score.EndedAt, 12)
{ {
Colour = colourProvider.Foreground1 Colour = colourProvider.Foreground1
} }
@ -138,7 +138,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
{ {
var ruleset = rulesets.GetRuleset(Score.RulesetID) ?? throw new InvalidOperationException($"Ruleset with ID of {Score.RulesetID} not found locally"); var ruleset = rulesets.GetRuleset(Score.RulesetID) ?? throw new InvalidOperationException($"Ruleset with ID of {Score.RulesetID} not found locally");
return new ModIcon(ruleset.CreateInstance().CreateModFromAcronym(mod.Acronym)) return new ModIcon(mod.ToMod(ruleset.CreateInstance()))
{ {
Scale = new Vector2(0.35f) Scale = new Vector2(0.35f)
}; };

View File

@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
{ {
private readonly double weight; private readonly double weight;
public DrawableProfileWeightedScore(APIScore score, double weight) public DrawableProfileWeightedScore(SoloScoreInfo score, double weight)
: base(score) : base(score)
{ {
this.weight = weight; this.weight = weight;

View File

@ -17,7 +17,7 @@ using APIUser = osu.Game.Online.API.Requests.Responses.APIUser;
namespace osu.Game.Overlays.Profile.Sections.Ranks namespace osu.Game.Overlays.Profile.Sections.Ranks
{ {
public class PaginatedScoreContainer : PaginatedProfileSubsection<APIScore> public class PaginatedScoreContainer : PaginatedProfileSubsection<SoloScoreInfo>
{ {
private readonly ScoreType type; private readonly ScoreType type;
@ -54,7 +54,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
} }
} }
protected override void OnItemsReceived(List<APIScore> items) protected override void OnItemsReceived(List<SoloScoreInfo> items)
{ {
if (CurrentPage == null || CurrentPage?.Offset == 0) if (CurrentPage == null || CurrentPage?.Offset == 0)
drawableItemIndex = 0; drawableItemIndex = 0;
@ -62,12 +62,12 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
base.OnItemsReceived(items); base.OnItemsReceived(items);
} }
protected override APIRequest<List<APIScore>> CreateRequest(PaginationParameters pagination) => protected override APIRequest<List<SoloScoreInfo>> CreateRequest(PaginationParameters pagination) =>
new GetUserScoresRequest(User.Value.Id, type, pagination); new GetUserScoresRequest(User.Value.Id, type, pagination);
private int drawableItemIndex; private int drawableItemIndex;
protected override Drawable CreateDrawableItem(APIScore model) protected override Drawable CreateDrawableItem(SoloScoreInfo model)
{ {
switch (type) switch (type)
{ {

View File

@ -16,14 +16,14 @@ using osuTK;
namespace osu.Game.Overlays.Rankings namespace osu.Game.Overlays.Rankings
{ {
public class CountryFilter : CompositeDrawable, IHasCurrentValue<Country> public class CountryFilter : CompositeDrawable, IHasCurrentValue<CountryCode>
{ {
private const int duration = 200; private const int duration = 200;
private const int height = 70; private const int height = 70;
private readonly BindableWithCurrent<Country> current = new BindableWithCurrent<Country>(); private readonly BindableWithCurrent<CountryCode> current = new BindableWithCurrent<CountryCode>();
public Bindable<Country> Current public Bindable<CountryCode> Current
{ {
get => current.Current; get => current.Current;
set => current.Current = value; set => current.Current = value;
@ -89,9 +89,9 @@ namespace osu.Game.Overlays.Rankings
Current.BindValueChanged(onCountryChanged, true); Current.BindValueChanged(onCountryChanged, true);
} }
private void onCountryChanged(ValueChangedEvent<Country> country) private void onCountryChanged(ValueChangedEvent<CountryCode> country)
{ {
if (country.NewValue == null) if (Current.Value == CountryCode.Unknown)
{ {
countryPill.Collapse(); countryPill.Collapse();
this.ResizeHeightTo(0, duration, Easing.OutQuint); this.ResizeHeightTo(0, duration, Easing.OutQuint);

View File

@ -6,6 +6,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
@ -21,13 +22,13 @@ using osuTK.Graphics;
namespace osu.Game.Overlays.Rankings namespace osu.Game.Overlays.Rankings
{ {
public class CountryPill : CompositeDrawable, IHasCurrentValue<Country> public class CountryPill : CompositeDrawable, IHasCurrentValue<CountryCode>
{ {
private const int duration = 200; private const int duration = 200;
private readonly BindableWithCurrent<Country> current = new BindableWithCurrent<Country>(); private readonly BindableWithCurrent<CountryCode> current = new BindableWithCurrent<CountryCode>();
public Bindable<Country> Current public Bindable<CountryCode> Current
{ {
get => current.Current; get => current.Current;
set => current.Current = value; set => current.Current = value;
@ -93,7 +94,7 @@ namespace osu.Game.Overlays.Rankings
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Action = () => Current.Value = null Action = Current.SetDefault,
} }
} }
} }
@ -130,13 +131,13 @@ namespace osu.Game.Overlays.Rankings
this.FadeOut(duration, Easing.OutQuint); this.FadeOut(duration, Easing.OutQuint);
} }
private void onCountryChanged(ValueChangedEvent<Country> country) private void onCountryChanged(ValueChangedEvent<CountryCode> country)
{ {
if (country.NewValue == null) if (Current.Value == CountryCode.Unknown)
return; return;
flag.Country = country.NewValue; flag.CountryCode = country.NewValue;
countryName.Text = country.NewValue.FullName; countryName.Text = country.NewValue.GetDescription();
} }
private class CloseButton : OsuHoverContainer private class CloseButton : OsuHoverContainer

View File

@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Rankings
{ {
public Bindable<RulesetInfo> Ruleset => rulesetSelector.Current; public Bindable<RulesetInfo> Ruleset => rulesetSelector.Current;
public Bindable<Country> Country => countryFilter.Current; public Bindable<CountryCode> Country => countryFilter.Current;
private OverlayRulesetSelector rulesetSelector; private OverlayRulesetSelector rulesetSelector;
private CountryFilter countryFilter; private CountryFilter countryFilter;

View File

@ -11,6 +11,7 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions;
using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Extensions.LocalisationExtensions;
using osu.Game.Resources.Localisation.Web; using osu.Game.Resources.Localisation.Web;
@ -33,9 +34,9 @@ namespace osu.Game.Overlays.Rankings.Tables
new RankingsTableColumn(RankingsStrings.StatAveragePerformance, Anchor.Centre, new Dimension(GridSizeMode.AutoSize)), new RankingsTableColumn(RankingsStrings.StatAveragePerformance, Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
}; };
protected override Country GetCountry(CountryStatistics item) => item.Country; protected override CountryCode GetCountryCode(CountryStatistics item) => item.Code;
protected override Drawable CreateFlagContent(CountryStatistics item) => new CountryName(item.Country); protected override Drawable CreateFlagContent(CountryStatistics item) => new CountryName(item.Code);
protected override Drawable[] CreateAdditionalContent(CountryStatistics item) => new Drawable[] protected override Drawable[] CreateAdditionalContent(CountryStatistics item) => new Drawable[]
{ {
@ -70,15 +71,15 @@ namespace osu.Game.Overlays.Rankings.Tables
[Resolved(canBeNull: true)] [Resolved(canBeNull: true)]
private RankingsOverlay rankings { get; set; } private RankingsOverlay rankings { get; set; }
public CountryName(Country country) public CountryName(CountryCode countryCode)
: base(t => t.Font = OsuFont.GetFont(size: 12)) : base(t => t.Font = OsuFont.GetFont(size: 12))
{ {
AutoSizeAxes = Axes.X; AutoSizeAxes = Axes.X;
RelativeSizeAxes = Axes.Y; RelativeSizeAxes = Axes.Y;
TextAnchor = Anchor.CentreLeft; TextAnchor = Anchor.CentreLeft;
if (!string.IsNullOrEmpty(country.FullName)) if (countryCode != CountryCode.Unknown)
AddLink(country.FullName, () => rankings?.ShowCountry(country)); AddLink(countryCode.GetDescription(), () => rankings?.ShowCountry(countryCode));
} }
} }
} }

View File

@ -79,7 +79,7 @@ namespace osu.Game.Overlays.Rankings.Tables
protected sealed override Drawable CreateHeader(int index, TableColumn column) protected sealed override Drawable CreateHeader(int index, TableColumn column)
=> (column as RankingsTableColumn)?.CreateHeaderText() ?? new HeaderText(column?.Header ?? default, false); => (column as RankingsTableColumn)?.CreateHeaderText() ?? new HeaderText(column?.Header ?? default, false);
protected abstract Country GetCountry(TModel item); protected abstract CountryCode GetCountryCode(TModel item);
protected abstract Drawable CreateFlagContent(TModel item); protected abstract Drawable CreateFlagContent(TModel item);
@ -97,10 +97,10 @@ namespace osu.Game.Overlays.Rankings.Tables
Margin = new MarginPadding { Bottom = row_spacing }, Margin = new MarginPadding { Bottom = row_spacing },
Children = new[] Children = new[]
{ {
new UpdateableFlag(GetCountry(item)) new UpdateableFlag(GetCountryCode(item))
{ {
Size = new Vector2(28, 20), Size = new Vector2(28, 20),
ShowPlaceholderOnNull = false, ShowPlaceholderOnUnknown = false,
}, },
CreateFlagContent(item) CreateFlagContent(item)
} }

View File

@ -59,7 +59,7 @@ namespace osu.Game.Overlays.Rankings.Tables
.Concat(GradeColumns.Select(grade => new GradeTableColumn(grade, Anchor.Centre, new Dimension(GridSizeMode.AutoSize)))) .Concat(GradeColumns.Select(grade => new GradeTableColumn(grade, Anchor.Centre, new Dimension(GridSizeMode.AutoSize))))
.ToArray(); .ToArray();
protected sealed override Country GetCountry(UserStatistics item) => item.User.Country; protected sealed override CountryCode GetCountryCode(UserStatistics item) => item.User.CountryCode;
protected sealed override Drawable CreateFlagContent(UserStatistics item) protected sealed override Drawable CreateFlagContent(UserStatistics item)
{ {

View File

@ -17,7 +17,7 @@ namespace osu.Game.Overlays
{ {
public class RankingsOverlay : TabbableOnlineOverlay<RankingsOverlayHeader, RankingsScope> public class RankingsOverlay : TabbableOnlineOverlay<RankingsOverlayHeader, RankingsScope>
{ {
protected Bindable<Country> Country => Header.Country; protected Bindable<CountryCode> Country => Header.Country;
private APIRequest lastRequest; private APIRequest lastRequest;
@ -44,7 +44,7 @@ namespace osu.Game.Overlays
Country.BindValueChanged(_ => Country.BindValueChanged(_ =>
{ {
// if a country is requested, force performance scope. // if a country is requested, force performance scope.
if (Country.Value != null) if (!Country.IsDefault)
Header.Current.Value = RankingsScope.Performance; Header.Current.Value = RankingsScope.Performance;
Scheduler.AddOnce(triggerTabChanged); Scheduler.AddOnce(triggerTabChanged);
@ -76,7 +76,7 @@ namespace osu.Game.Overlays
{ {
// country filtering is only valid for performance scope. // country filtering is only valid for performance scope.
if (Header.Current.Value != RankingsScope.Performance) if (Header.Current.Value != RankingsScope.Performance)
Country.Value = null; Country.SetDefault();
Scheduler.AddOnce(triggerTabChanged); Scheduler.AddOnce(triggerTabChanged);
} }
@ -85,9 +85,9 @@ namespace osu.Game.Overlays
protected override RankingsOverlayHeader CreateHeader() => new RankingsOverlayHeader(); protected override RankingsOverlayHeader CreateHeader() => new RankingsOverlayHeader();
public void ShowCountry(Country requested) public void ShowCountry(CountryCode requested)
{ {
if (requested == null) if (requested == default)
return; return;
Show(); Show();
@ -128,7 +128,7 @@ namespace osu.Game.Overlays
switch (Header.Current.Value) switch (Header.Current.Value)
{ {
case RankingsScope.Performance: case RankingsScope.Performance:
return new GetUserRankingsRequest(ruleset.Value, country: Country.Value?.FlagName); return new GetUserRankingsRequest(ruleset.Value, countryCode: Country.Value);
case RankingsScope.Country: case RankingsScope.Country:
return new GetCountryRankingsRequest(ruleset.Value); return new GetCountryRankingsRequest(ruleset.Value);

View File

@ -58,6 +58,7 @@ namespace osu.Game.Rulesets.Mods
public class ModCreatedUser : IUser public class ModCreatedUser : IUser
{ {
public int OnlineID => APIUser.SYSTEM_USER_ID; public int OnlineID => APIUser.SYSTEM_USER_ID;
public CountryCode CountryCode => default;
public bool IsBot => true; public bool IsBot => true;
public string Username { get; set; } = string.Empty; public string Username { get; set; } = string.Empty;

View File

@ -84,7 +84,7 @@ namespace osu.Game.Scoring
api.Perform(userRequest); api.Perform(userRequest);
if (userRequest.Response is APIUser user) if (userRequest.Response is APIUser user)
model.RealmUser.OnlineID = user.Id; model.User = user;
} }
} }
} }

View File

@ -85,8 +85,9 @@ namespace osu.Game.Scoring
{ {
get => user ??= new APIUser get => user ??= new APIUser
{ {
Username = RealmUser.Username,
Id = RealmUser.OnlineID, Id = RealmUser.OnlineID,
Username = RealmUser.Username,
CountryCode = RealmUser.CountryCode,
}; };
set set
{ {
@ -95,7 +96,8 @@ namespace osu.Game.Scoring
RealmUser = new RealmUser RealmUser = new RealmUser
{ {
OnlineID = user.OnlineID, OnlineID = user.OnlineID,
Username = user.Username Username = user.Username,
CountryCode = user.CountryCode,
}; };
} }
} }
@ -135,6 +137,7 @@ namespace osu.Game.Scoring
{ {
OnlineID = RealmUser.OnlineID, OnlineID = RealmUser.OnlineID,
Username = RealmUser.Username, Username = RealmUser.Username,
CountryCode = RealmUser.CountryCode,
}; };
return clone; return clone;

View File

@ -128,7 +128,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Size = new Vector2(28, 20), Size = new Vector2(28, 20),
Country = user?.Country CountryCode = user?.CountryCode ?? default
}, },
new OsuSpriteText new OsuSpriteText
{ {

View File

@ -6,6 +6,7 @@
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -214,7 +215,7 @@ namespace osu.Game.Screens.Ranking.Contracted
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Text = key, Text = key.ToTitle(),
Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold) Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold)
}, },
new OsuSpriteText new OsuSpriteText

View File

@ -37,7 +37,7 @@ namespace osu.Game.Screens.Ranking
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Size = new Vector2(13), Size = new Vector2(13),
Icon = FontAwesome.Solid.ArrowCircleLeft, Icon = FontAwesome.Solid.Redo,
}, },
}; };

View File

@ -96,7 +96,7 @@ namespace osu.Game.Skinning
new SkinInfo new SkinInfo
{ {
Name = beatmapInfo.ToString(), Name = beatmapInfo.ToString(),
Creator = beatmapInfo.Metadata.Author.Username ?? string.Empty Creator = beatmapInfo.Metadata.Author.Username
}; };
} }
} }

View File

@ -1,27 +0,0 @@
// 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.
#nullable disable
using System;
using Newtonsoft.Json;
namespace osu.Game.Users
{
public class Country : IEquatable<Country>
{
/// <summary>
/// The name of this country.
/// </summary>
[JsonProperty(@"name")]
public string FullName;
/// <summary>
/// Two-letter flag acronym (ISO 3166 standard)
/// </summary>
[JsonProperty(@"code")]
public string FlagName;
public bool Equals(Country other) => FlagName == other?.FlagName;
}
}

View File

@ -0,0 +1,768 @@
// 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.ComponentModel;
using JetBrains.Annotations;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace osu.Game.Users
{
[JsonConverter(typeof(StringEnumConverter))]
[UsedImplicitly(ImplicitUseTargetFlags.WithMembers)]
public enum CountryCode
{
[Description("Unknown")]
Unknown = 0,
[Description("Bangladesh")]
BD,
[Description("Belgium")]
BE,
[Description("Burkina Faso")]
BF,
[Description("Bulgaria")]
BG,
[Description("Bosnia and Herzegovina")]
BA,
[Description("Barbados")]
BB,
[Description("Wallis and Futuna")]
WF,
[Description("Saint Barthelemy")]
BL,
[Description("Bermuda")]
BM,
[Description("Brunei")]
BN,
[Description("Bolivia")]
BO,
[Description("Bahrain")]
BH,
[Description("Burundi")]
BI,
[Description("Benin")]
BJ,
[Description("Bhutan")]
BT,
[Description("Jamaica")]
JM,
[Description("Bouvet Island")]
BV,
[Description("Botswana")]
BW,
[Description("Samoa")]
WS,
[Description("Bonaire, Saint Eustatius and Saba")]
BQ,
[Description("Brazil")]
BR,
[Description("Bahamas")]
BS,
[Description("Jersey")]
JE,
[Description("Belarus")]
BY,
[Description("Belize")]
BZ,
[Description("Russia")]
RU,
[Description("Rwanda")]
RW,
[Description("Serbia")]
RS,
[Description("East Timor")]
TL,
[Description("Reunion")]
RE,
[Description("Turkmenistan")]
TM,
[Description("Tajikistan")]
TJ,
[Description("Romania")]
RO,
[Description("Tokelau")]
TK,
[Description("Guinea-Bissau")]
GW,
[Description("Guam")]
GU,
[Description("Guatemala")]
GT,
[Description("South Georgia and the South Sandwich Islands")]
GS,
[Description("Greece")]
GR,
[Description("Equatorial Guinea")]
GQ,
[Description("Guadeloupe")]
GP,
[Description("Japan")]
JP,
[Description("Guyana")]
GY,
[Description("Guernsey")]
GG,
[Description("French Guiana")]
GF,
[Description("Georgia")]
GE,
[Description("Grenada")]
GD,
[Description("United Kingdom")]
GB,
[Description("Gabon")]
GA,
[Description("El Salvador")]
SV,
[Description("Guinea")]
GN,
[Description("Gambia")]
GM,
[Description("Greenland")]
GL,
[Description("Gibraltar")]
GI,
[Description("Ghana")]
GH,
[Description("Oman")]
OM,
[Description("Tunisia")]
TN,
[Description("Jordan")]
JO,
[Description("Croatia")]
HR,
[Description("Haiti")]
HT,
[Description("Hungary")]
HU,
[Description("Hong Kong")]
HK,
[Description("Honduras")]
HN,
[Description("Heard Island and McDonald Islands")]
HM,
[Description("Venezuela")]
VE,
[Description("Puerto Rico")]
PR,
[Description("Palestinian Territory")]
PS,
[Description("Palau")]
PW,
[Description("Portugal")]
PT,
[Description("Svalbard and Jan Mayen")]
SJ,
[Description("Paraguay")]
PY,
[Description("Iraq")]
IQ,
[Description("Panama")]
PA,
[Description("French Polynesia")]
PF,
[Description("Papua New Guinea")]
PG,
[Description("Peru")]
PE,
[Description("Pakistan")]
PK,
[Description("Philippines")]
PH,
[Description("Pitcairn")]
PN,
[Description("Poland")]
PL,
[Description("Saint Pierre and Miquelon")]
PM,
[Description("Zambia")]
ZM,
[Description("Western Sahara")]
EH,
[Description("Estonia")]
EE,
[Description("Egypt")]
EG,
[Description("South Africa")]
ZA,
[Description("Ecuador")]
EC,
[Description("Italy")]
IT,
[Description("Vietnam")]
VN,
[Description("Solomon Islands")]
SB,
[Description("Ethiopia")]
ET,
[Description("Somalia")]
SO,
[Description("Zimbabwe")]
ZW,
[Description("Saudi Arabia")]
SA,
[Description("Spain")]
ES,
[Description("Eritrea")]
ER,
[Description("Montenegro")]
ME,
[Description("Moldova")]
MD,
[Description("Madagascar")]
MG,
[Description("Saint Martin")]
MF,
[Description("Morocco")]
MA,
[Description("Monaco")]
MC,
[Description("Uzbekistan")]
UZ,
[Description("Myanmar")]
MM,
[Description("Mali")]
ML,
[Description("Macao")]
MO,
[Description("Mongolia")]
MN,
[Description("Marshall Islands")]
MH,
[Description("North Macedonia")]
MK,
[Description("Mauritius")]
MU,
[Description("Malta")]
MT,
[Description("Malawi")]
MW,
[Description("Maldives")]
MV,
[Description("Martinique")]
MQ,
[Description("Northern Mariana Islands")]
MP,
[Description("Montserrat")]
MS,
[Description("Mauritania")]
MR,
[Description("Isle of Man")]
IM,
[Description("Uganda")]
UG,
[Description("Tanzania")]
TZ,
[Description("Malaysia")]
MY,
[Description("Mexico")]
MX,
[Description("Israel")]
IL,
[Description("France")]
FR,
[Description("British Indian Ocean Territory")]
IO,
[Description("Saint Helena")]
SH,
[Description("Finland")]
FI,
[Description("Fiji")]
FJ,
[Description("Falkland Islands")]
FK,
[Description("Micronesia")]
FM,
[Description("Faroe Islands")]
FO,
[Description("Nicaragua")]
NI,
[Description("Netherlands")]
NL,
[Description("Norway")]
NO,
[Description("Namibia")]
NA,
[Description("Vanuatu")]
VU,
[Description("New Caledonia")]
NC,
[Description("Niger")]
NE,
[Description("Norfolk Island")]
NF,
[Description("Nigeria")]
NG,
[Description("New Zealand")]
NZ,
[Description("Nepal")]
NP,
[Description("Nauru")]
NR,
[Description("Niue")]
NU,
[Description("Cook Islands")]
CK,
[Description("Kosovo")]
XK,
[Description("Ivory Coast")]
CI,
[Description("Switzerland")]
CH,
[Description("Colombia")]
CO,
[Description("China")]
CN,
[Description("Cameroon")]
CM,
[Description("Chile")]
CL,
[Description("Cocos Islands")]
CC,
[Description("Canada")]
CA,
[Description("Republic of the Congo")]
CG,
[Description("Central African Republic")]
CF,
[Description("Democratic Republic of the Congo")]
CD,
[Description("Czech Republic")]
CZ,
[Description("Cyprus")]
CY,
[Description("Christmas Island")]
CX,
[Description("Costa Rica")]
CR,
[Description("Curacao")]
CW,
[Description("Cabo Verde")]
CV,
[Description("Cuba")]
CU,
[Description("Eswatini")]
SZ,
[Description("Syria")]
SY,
[Description("Sint Maarten")]
SX,
[Description("Kyrgyzstan")]
KG,
[Description("Kenya")]
KE,
[Description("South Sudan")]
SS,
[Description("Suriname")]
SR,
[Description("Kiribati")]
KI,
[Description("Cambodia")]
KH,
[Description("Saint Kitts and Nevis")]
KN,
[Description("Comoros")]
KM,
[Description("Sao Tome and Principe")]
ST,
[Description("Slovakia")]
SK,
[Description("South Korea")]
KR,
[Description("Slovenia")]
SI,
[Description("North Korea")]
KP,
[Description("Kuwait")]
KW,
[Description("Senegal")]
SN,
[Description("San Marino")]
SM,
[Description("Sierra Leone")]
SL,
[Description("Seychelles")]
SC,
[Description("Kazakhstan")]
KZ,
[Description("Cayman Islands")]
KY,
[Description("Singapore")]
SG,
[Description("Sweden")]
SE,
[Description("Sudan")]
SD,
[Description("Dominican Republic")]
DO,
[Description("Dominica")]
DM,
[Description("Djibouti")]
DJ,
[Description("Denmark")]
DK,
[Description("British Virgin Islands")]
VG,
[Description("Germany")]
DE,
[Description("Yemen")]
YE,
[Description("Algeria")]
DZ,
[Description("United States")]
US,
[Description("Uruguay")]
UY,
[Description("Mayotte")]
YT,
[Description("United States Minor Outlying Islands")]
UM,
[Description("Lebanon")]
LB,
[Description("Saint Lucia")]
LC,
[Description("Laos")]
LA,
[Description("Tuvalu")]
TV,
[Description("Taiwan")]
TW,
[Description("Trinidad and Tobago")]
TT,
[Description("Turkey")]
TR,
[Description("Sri Lanka")]
LK,
[Description("Liechtenstein")]
LI,
[Description("Latvia")]
LV,
[Description("Tonga")]
TO,
[Description("Lithuania")]
LT,
[Description("Luxembourg")]
LU,
[Description("Liberia")]
LR,
[Description("Lesotho")]
LS,
[Description("Thailand")]
TH,
[Description("French Southern Territories")]
TF,
[Description("Togo")]
TG,
[Description("Chad")]
TD,
[Description("Turks and Caicos Islands")]
TC,
[Description("Libya")]
LY,
[Description("Vatican")]
VA,
[Description("Saint Vincent and the Grenadines")]
VC,
[Description("United Arab Emirates")]
AE,
[Description("Andorra")]
AD,
[Description("Antigua and Barbuda")]
AG,
[Description("Afghanistan")]
AF,
[Description("Anguilla")]
AI,
[Description("U.S. Virgin Islands")]
VI,
[Description("Iceland")]
IS,
[Description("Iran")]
IR,
[Description("Armenia")]
AM,
[Description("Albania")]
AL,
[Description("Angola")]
AO,
[Description("Antarctica")]
AQ,
[Description("American Samoa")]
AS,
[Description("Argentina")]
AR,
[Description("Australia")]
AU,
[Description("Austria")]
AT,
[Description("Aruba")]
AW,
[Description("India")]
IN,
[Description("Aland Islands")]
AX,
[Description("Azerbaijan")]
AZ,
[Description("Ireland")]
IE,
[Description("Indonesia")]
ID,
[Description("Ukraine")]
UA,
[Description("Qatar")]
QA,
[Description("Mozambique")]
MZ,
}
}

View File

@ -9,11 +9,8 @@ namespace osu.Game.Users
{ {
public class CountryStatistics public class CountryStatistics
{ {
[JsonProperty]
public Country Country;
[JsonProperty(@"code")] [JsonProperty(@"code")]
public string FlagName; public CountryCode Code;
[JsonProperty(@"active_users")] [JsonProperty(@"active_users")]
public long ActiveUsers; public long ActiveUsers;

View File

@ -5,6 +5,7 @@
using System; using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
@ -14,13 +15,13 @@ namespace osu.Game.Users.Drawables
{ {
public class DrawableFlag : Sprite, IHasTooltip public class DrawableFlag : Sprite, IHasTooltip
{ {
private readonly Country country; private readonly CountryCode countryCode;
public LocalisableString TooltipText => country?.FullName; public LocalisableString TooltipText => countryCode == CountryCode.Unknown ? string.Empty : countryCode.GetDescription();
public DrawableFlag(Country country) public DrawableFlag(CountryCode countryCode)
{ {
this.country = country; this.countryCode = countryCode;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -29,7 +30,8 @@ namespace osu.Game.Users.Drawables
if (ts == null) if (ts == null)
throw new ArgumentNullException(nameof(ts)); throw new ArgumentNullException(nameof(ts));
Texture = ts.Get($@"Flags/{country?.FlagName ?? @"__"}") ?? ts.Get(@"Flags/__"); string textureName = countryCode == CountryCode.Unknown ? "__" : countryCode.ToString();
Texture = ts.Get($@"Flags/{textureName}") ?? ts.Get(@"Flags/__");
} }
} }
} }

View File

@ -13,18 +13,18 @@ using osu.Game.Overlays;
namespace osu.Game.Users.Drawables namespace osu.Game.Users.Drawables
{ {
public class UpdateableFlag : ModelBackedDrawable<Country> public class UpdateableFlag : ModelBackedDrawable<CountryCode>
{ {
public Country Country public CountryCode CountryCode
{ {
get => Model; get => Model;
set => Model = value; set => Model = value;
} }
/// <summary> /// <summary>
/// Whether to show a place holder on null country. /// Whether to show a place holder on unknown country.
/// </summary> /// </summary>
public bool ShowPlaceholderOnNull = true; public bool ShowPlaceholderOnUnknown = true;
/// <summary> /// <summary>
/// Perform an action in addition to showing the country ranking. /// Perform an action in addition to showing the country ranking.
@ -32,14 +32,14 @@ namespace osu.Game.Users.Drawables
/// </summary> /// </summary>
public Action Action; public Action Action;
public UpdateableFlag(Country country = null) public UpdateableFlag(CountryCode countryCode = CountryCode.Unknown)
{ {
Country = country; CountryCode = countryCode;
} }
protected override Drawable CreateDrawable(Country country) protected override Drawable CreateDrawable(CountryCode countryCode)
{ {
if (country == null && !ShowPlaceholderOnNull) if (countryCode == CountryCode.Unknown && !ShowPlaceholderOnUnknown)
return null; return null;
return new Container return new Container
@ -47,7 +47,7 @@ namespace osu.Game.Users.Drawables
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
new DrawableFlag(country) new DrawableFlag(countryCode)
{ {
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both
}, },
@ -62,7 +62,7 @@ namespace osu.Game.Users.Drawables
protected override bool OnClick(ClickEvent e) protected override bool OnClick(ClickEvent e)
{ {
Action?.Invoke(); Action?.Invoke();
rankingsOverlay?.ShowCountry(Country); rankingsOverlay?.ShowCountry(CountryCode);
return true; return true;
} }
} }

View File

@ -53,7 +53,7 @@ namespace osu.Game.Users
protected UpdateableAvatar CreateAvatar() => new UpdateableAvatar(User, false); protected UpdateableAvatar CreateAvatar() => new UpdateableAvatar(User, false);
protected UpdateableFlag CreateFlag() => new UpdateableFlag(User.Country) protected UpdateableFlag CreateFlag() => new UpdateableFlag(User.CountryCode)
{ {
Size = new Vector2(36, 26), Size = new Vector2(36, 26),
Action = Action, Action = Action,

View File

@ -10,6 +10,8 @@ namespace osu.Game.Users
{ {
string Username { get; } string Username { get; }
CountryCode CountryCode { get; }
bool IsBot { get; } bool IsBot { get; }
bool IEquatable<IUser>.Equals(IUser? other) bool IEquatable<IUser>.Equals(IUser? other)