mirror of
https://github.com/ppy/osu
synced 2024-12-15 03:16:17 +00:00
Revert "Added a BaseDrawableFlag without a tooltip, and used it."
This reverts commit b2f74325ef
.
This commit is contained in:
parent
33de27499a
commit
7bc304f20e
@ -1,29 +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.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
|
||||
namespace osu.Game.Users.Drawables
|
||||
{
|
||||
public partial class BaseDrawableFlag : Sprite
|
||||
{
|
||||
protected readonly CountryCode CountryCode;
|
||||
|
||||
public BaseDrawableFlag(CountryCode countryCode)
|
||||
{
|
||||
CountryCode = countryCode;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore ts)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(ts);
|
||||
|
||||
string textureName = CountryCode == CountryCode.Unknown ? "__" : CountryCode.ToString();
|
||||
Texture = ts.Get($@"Flags/{textureName}") ?? ts.Get(@"Flags/__");
|
||||
}
|
||||
}
|
||||
}
|
@ -34,8 +34,7 @@ namespace osu.Game.Users.Drawables
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
// This is a BaseDrawableFlag which does not show a tooltip.
|
||||
new BaseDrawableFlag(countryCode)
|
||||
new DrawableFlag(countryCode)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
|
@ -34,7 +34,6 @@ namespace osu.Game.Users.Drawables
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
// This is a DrawableFlag which implements IHasTooltip, so a tooltip is shown.
|
||||
new DrawableFlag(countryCode)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
|
@ -5,23 +5,29 @@ using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Localisation;
|
||||
|
||||
namespace osu.Game.Users.Drawables
|
||||
{
|
||||
public partial class DrawableFlag : BaseDrawableFlag, IHasTooltip
|
||||
public partial class DrawableFlag : Sprite, IHasTooltip
|
||||
{
|
||||
public LocalisableString TooltipText => CountryCode == CountryCode.Unknown ? string.Empty : CountryCode.GetDescription();
|
||||
private readonly CountryCode countryCode;
|
||||
|
||||
public DrawableFlag(CountryCode countryCode) : base(countryCode) { }
|
||||
public LocalisableString TooltipText => countryCode == CountryCode.Unknown ? string.Empty : countryCode.GetDescription();
|
||||
|
||||
public DrawableFlag(CountryCode countryCode)
|
||||
{
|
||||
this.countryCode = countryCode;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore ts)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(ts);
|
||||
|
||||
string textureName = CountryCode == CountryCode.Unknown ? "__" : CountryCode.ToString();
|
||||
string textureName = countryCode == CountryCode.Unknown ? "__" : countryCode.ToString();
|
||||
Texture = ts.Get($@"Flags/{textureName}") ?? ts.Get(@"Flags/__");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user