1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 19:42:55 +08:00

Replace default with CountryCode.Unknown

This commit is contained in:
Salman Ahmed 2022-07-18 08:54:35 +03:00
parent cf99849478
commit 018da74fe8
8 changed files with 12 additions and 11 deletions

View File

@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual.Online
public void TestFlagScopeDependency()
{
AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score);
AddAssert("Check country is default", () => countryBindable.Value == default);
AddAssert("Check country is default", () => countryBindable.IsDefault);
AddStep("Set country", () => countryBindable.Value = CountryCode.US);
AddAssert("Check scope is Performance", () => scope.Value == RankingsScope.Performance);
}

View File

@ -21,6 +21,7 @@ using osu.Game.Online.API.Requests.Responses;
using osu.Game.Tournament.IO;
using osu.Game.Tournament.IPC;
using osu.Game.Tournament.Models;
using osu.Game.Users;
using osuTK.Input;
namespace osu.Game.Tournament
@ -187,7 +188,7 @@ namespace osu.Game.Tournament
var playersRequiringPopulation = ladder.Teams
.SelectMany(t => t.Players)
.Where(p => string.IsNullOrEmpty(p.Username)
|| p.CountryCode == default
|| p.CountryCode == CountryCode.Unknown
|| p.Rank == null).ToList();
if (playersRequiringPopulation.Count == 0)

View File

@ -15,7 +15,7 @@ namespace osu.Game.Online.API.Requests
private readonly CountryCode countryCode;
public GetUserRankingsRequest(RulesetInfo ruleset, UserRankingsType type = UserRankingsType.Performance, int page = 1, CountryCode countryCode = default)
public GetUserRankingsRequest(RulesetInfo ruleset, UserRankingsType type = UserRankingsType.Performance, int page = 1, CountryCode countryCode = CountryCode.Unknown)
: base(ruleset, page)
{
Type = type;
@ -26,7 +26,7 @@ namespace osu.Game.Online.API.Requests
{
var req = base.CreateWebRequest();
if (countryCode != default)
if (countryCode != CountryCode.Unknown)
req.AddParameter("country", countryCode.ToString());
return req;

View File

@ -91,7 +91,7 @@ namespace osu.Game.Overlays.Rankings
private void onCountryChanged(ValueChangedEvent<CountryCode> country)
{
if (country.NewValue == default)
if (Current.Value == CountryCode.Unknown)
{
countryPill.Collapse();
this.ResizeHeightTo(0, duration, Easing.OutQuint);

View File

@ -133,7 +133,7 @@ namespace osu.Game.Overlays.Rankings
private void onCountryChanged(ValueChangedEvent<CountryCode> country)
{
if (country.NewValue == default)
if (Current.Value == CountryCode.Unknown)
return;
flag.CountryCode = country.NewValue;

View File

@ -78,7 +78,7 @@ namespace osu.Game.Overlays.Rankings.Tables
RelativeSizeAxes = Axes.Y;
TextAnchor = Anchor.CentreLeft;
if (countryCode != default)
if (countryCode != CountryCode.Unknown)
AddLink(countryCode.GetDescription(), () => rankings?.ShowCountry(countryCode));
}
}

View File

@ -17,7 +17,7 @@ namespace osu.Game.Users.Drawables
{
private readonly CountryCode countryCode;
public LocalisableString TooltipText => countryCode == default ? string.Empty : countryCode.GetDescription();
public LocalisableString TooltipText => countryCode == CountryCode.Unknown ? string.Empty : countryCode.GetDescription();
public DrawableFlag(CountryCode countryCode)
{
@ -30,7 +30,7 @@ namespace osu.Game.Users.Drawables
if (ts == null)
throw new ArgumentNullException(nameof(ts));
string textureName = countryCode == default ? "__" : countryCode.ToString();
string textureName = countryCode == CountryCode.Unknown ? "__" : countryCode.ToString();
Texture = ts.Get($@"Flags/{textureName}") ?? ts.Get(@"Flags/__");
}
}

View File

@ -32,14 +32,14 @@ namespace osu.Game.Users.Drawables
/// </summary>
public Action Action;
public UpdateableFlag(CountryCode countryCode = default)
public UpdateableFlag(CountryCode countryCode = CountryCode.Unknown)
{
CountryCode = countryCode;
}
protected override Drawable CreateDrawable(CountryCode countryCode)
{
if (countryCode == default && !ShowPlaceholderOnUnknown)
if (countryCode == CountryCode.Unknown && !ShowPlaceholderOnUnknown)
return null;
return new Container