From 7bc304f20ee27d7314fc06620cf1250acebba89f Mon Sep 17 00:00:00 2001 From: yesseruser Date: Wed, 22 Nov 2023 15:25:17 +0100 Subject: [PATCH] Revert "Added a BaseDrawableFlag without a tooltip, and used it." This reverts commit b2f74325efb4f477b42320cca8cbd380895b12da. --- osu.Game/Users/Drawables/BaseDrawableFlag.cs | 29 ------------------- .../Users/Drawables/BaseUpdateableFlag.cs | 3 +- .../Drawables/ClickableUpdateableFlag.cs | 1 - osu.Game/Users/Drawables/DrawableFlag.cs | 14 ++++++--- 4 files changed, 11 insertions(+), 36 deletions(-) delete mode 100644 osu.Game/Users/Drawables/BaseDrawableFlag.cs diff --git a/osu.Game/Users/Drawables/BaseDrawableFlag.cs b/osu.Game/Users/Drawables/BaseDrawableFlag.cs deleted file mode 100644 index 90f8cd7b70..0000000000 --- a/osu.Game/Users/Drawables/BaseDrawableFlag.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) ppy Pty Ltd . 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/__"); - } - } -} diff --git a/osu.Game/Users/Drawables/BaseUpdateableFlag.cs b/osu.Game/Users/Drawables/BaseUpdateableFlag.cs index 3a27238b19..16a368c60c 100644 --- a/osu.Game/Users/Drawables/BaseUpdateableFlag.cs +++ b/osu.Game/Users/Drawables/BaseUpdateableFlag.cs @@ -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 }, diff --git a/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs b/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs index 2eaa3661d1..e00fe3c009 100644 --- a/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs +++ b/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs @@ -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 diff --git a/osu.Game/Users/Drawables/DrawableFlag.cs b/osu.Game/Users/Drawables/DrawableFlag.cs index aef34c093f..289f68ee7f 100644 --- a/osu.Game/Users/Drawables/DrawableFlag.cs +++ b/osu.Game/Users/Drawables/DrawableFlag.cs @@ -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/__"); } }