diff --git a/osu.Game/Screens/SelectV2/FooterButtonMods.cs b/osu.Game/Screens/SelectV2/FooterButtonMods.cs index f38d6d9376..8ea08a0085 100644 --- a/osu.Game/Screens/SelectV2/FooterButtonMods.cs +++ b/osu.Game/Screens/SelectV2/FooterButtonMods.cs @@ -57,7 +57,7 @@ namespace osu.Game.Screens.SelectV2 private Container modContainer = null!; - private Container overflowModCountDisplay = null!; + private ModCountText overflowModCountDisplay = null!; [Resolved] private OsuColour colours { get; set; } = null!; @@ -142,27 +142,7 @@ namespace osu.Game.Screens.SelectV2 Current = { BindTarget = Current }, ExpansionMode = ExpansionMode.AlwaysContracted, }, - overflowModCountDisplay = new Container - { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - new Box - { - Colour = colourProvider.Background3, - Alpha = 0.8f, - RelativeSizeAxes = Axes.Both, - }, - new ModCountText - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Shear = -OsuGame.SHEAR, - Font = OsuFont.Torus.With(size: 14f, weight: FontWeight.Bold), - Mods = { BindTarget = Current }, - } - } - }, + overflowModCountDisplay = new ModCountText { Mods = { BindTarget = Current }, }, } }, } @@ -269,17 +249,39 @@ namespace osu.Game.Screens.SelectV2 overflowModCountDisplay.Hide(); } - private partial class ModCountText : OsuSpriteText, IHasCustomTooltip> + private partial class ModCountText : CompositeDrawable, IHasCustomTooltip> { public readonly Bindable> Mods = new Bindable>(); + private OsuSpriteText text = null!; + [Resolved] private OverlayColourProvider colourProvider { get; set; } = null!; protected override void LoadComplete() { base.LoadComplete(); - Mods.BindValueChanged(v => Text = ModSelectOverlayStrings.Mods(v.NewValue.Count).ToUpper(), true); + + RelativeSizeAxes = Axes.Both; + + InternalChildren = new Drawable[] + { + new Box + { + Colour = colourProvider.Background3, + Alpha = 0.8f, + RelativeSizeAxes = Axes.Both, + }, + text = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Font = OsuFont.Torus.With(size: 14f, weight: FontWeight.Bold), + Shear = -OsuGame.SHEAR, + } + }; + + Mods.BindValueChanged(v => text.Text = ModSelectOverlayStrings.Mods(v.NewValue.Count).ToUpper(), true); } public ITooltip> GetCustomTooltip() => new ModOverflowTooltip(colourProvider);