mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 07:06:35 +09:00
Merge branch 'master' into score-country-storage
This commit is contained in:
@ -10,10 +10,10 @@ namespace osu.Game.Users
|
||||
{
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
[UsedImplicitly(ImplicitUseTargetFlags.WithMembers)]
|
||||
public enum Country
|
||||
public enum CountryCode
|
||||
{
|
||||
[Description("Alien")]
|
||||
XX = 0,
|
||||
[Description("Unknown")]
|
||||
Unknown = 0,
|
||||
|
||||
[Description("Bangladesh")]
|
||||
BD,
|
@ -10,7 +10,7 @@ namespace osu.Game.Users
|
||||
public class CountryStatistics
|
||||
{
|
||||
[JsonProperty(@"code")]
|
||||
public Country Country;
|
||||
public CountryCode Code;
|
||||
|
||||
[JsonProperty(@"active_users")]
|
||||
public long ActiveUsers;
|
||||
|
@ -15,13 +15,13 @@ namespace osu.Game.Users.Drawables
|
||||
{
|
||||
public class DrawableFlag : Sprite, IHasTooltip
|
||||
{
|
||||
private readonly Country country;
|
||||
private readonly CountryCode countryCode;
|
||||
|
||||
public LocalisableString TooltipText => country == default ? string.Empty : country.GetDescription();
|
||||
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]
|
||||
@ -30,7 +30,7 @@ namespace osu.Game.Users.Drawables
|
||||
if (ts == null)
|
||||
throw new ArgumentNullException(nameof(ts));
|
||||
|
||||
string textureName = country == default ? "__" : country.ToString();
|
||||
string textureName = countryCode == CountryCode.Unknown ? "__" : countryCode.ToString();
|
||||
Texture = ts.Get($@"Flags/{textureName}") ?? ts.Get(@"Flags/__");
|
||||
}
|
||||
}
|
||||
|
@ -13,9 +13,9 @@ using osu.Game.Overlays;
|
||||
|
||||
namespace osu.Game.Users.Drawables
|
||||
{
|
||||
public class UpdateableFlag : ModelBackedDrawable<Country>
|
||||
public class UpdateableFlag : ModelBackedDrawable<CountryCode>
|
||||
{
|
||||
public Country Country
|
||||
public CountryCode CountryCode
|
||||
{
|
||||
get => Model;
|
||||
set => Model = value;
|
||||
@ -32,14 +32,14 @@ namespace osu.Game.Users.Drawables
|
||||
/// </summary>
|
||||
public Action Action;
|
||||
|
||||
public UpdateableFlag(Country country = default)
|
||||
public UpdateableFlag(CountryCode countryCode = CountryCode.Unknown)
|
||||
{
|
||||
Country = country;
|
||||
CountryCode = countryCode;
|
||||
}
|
||||
|
||||
protected override Drawable CreateDrawable(Country country)
|
||||
protected override Drawable CreateDrawable(CountryCode countryCode)
|
||||
{
|
||||
if (country == default && !ShowPlaceholderOnUnknown)
|
||||
if (countryCode == CountryCode.Unknown && !ShowPlaceholderOnUnknown)
|
||||
return null;
|
||||
|
||||
return new Container
|
||||
@ -47,7 +47,7 @@ namespace osu.Game.Users.Drawables
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new DrawableFlag(country)
|
||||
new DrawableFlag(countryCode)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
@ -62,7 +62,7 @@ namespace osu.Game.Users.Drawables
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
Action?.Invoke();
|
||||
rankingsOverlay?.ShowCountry(Country);
|
||||
rankingsOverlay?.ShowCountry(CountryCode);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Users
|
||||
|
||||
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),
|
||||
Action = Action,
|
||||
|
Reference in New Issue
Block a user