From ca7b850c8c75da7a67c48fee2ec4a7747b68d803 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 28 Jan 2026 16:37:39 +0900 Subject: [PATCH] Remove leaking knowledge of freestyle in normal song select component --- .../OnlinePlay/FooterButtonFreeModsV2.cs | 9 ++++++-- osu.Game/Screens/SelectV2/FooterButtonMods.cs | 22 +++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/FooterButtonFreeModsV2.cs b/osu.Game/Screens/OnlinePlay/FooterButtonFreeModsV2.cs index 822af03c5f..612eca9474 100644 --- a/osu.Game/Screens/OnlinePlay/FooterButtonFreeModsV2.cs +++ b/osu.Game/Screens/OnlinePlay/FooterButtonFreeModsV2.cs @@ -5,11 +5,13 @@ using System; using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; +using osu.Framework.Localisation; using osu.Framework.Utils; using osu.Game.Graphics; using osu.Game.Localisation; @@ -100,7 +102,6 @@ namespace osu.Game.Screens.OnlinePlay overflowModCountDisplay = new FooterButtonMods.ModCountText { Mods = { BindTarget = FreeMods }, - Freestyle = { BindTarget = Freestyle } }, } }, @@ -112,7 +113,11 @@ namespace osu.Game.Screens.OnlinePlay { base.LoadComplete(); - Freestyle.BindValueChanged(f => Enabled.Value = !f.NewValue, true); + Freestyle.BindValueChanged(f => + { + Enabled.Value = !f.NewValue; + overflowModCountDisplay.CustomText = f.NewValue ? ModSelectOverlayStrings.AllMods.ToUpper() : (LocalisableString?)null; + }, true); FreeMods.BindValueChanged(m => { if (m.NewValue.Count == 0 && !Freestyle.Value) diff --git a/osu.Game/Screens/SelectV2/FooterButtonMods.cs b/osu.Game/Screens/SelectV2/FooterButtonMods.cs index 55f3b6fb05..27e0ac68f9 100644 --- a/osu.Game/Screens/SelectV2/FooterButtonMods.cs +++ b/osu.Game/Screens/SelectV2/FooterButtonMods.cs @@ -261,7 +261,22 @@ namespace osu.Game.Screens.SelectV2 public partial class ModCountText : VisibilityContainer, IHasCustomTooltip> { public readonly Bindable> Mods = new Bindable>(); - public readonly Bindable Freestyle = new Bindable(); + + private LocalisableString? customText; + + /// + /// When set, this will be shown instead of a mod count. + /// + public LocalisableString? CustomText + { + get => customText; + set + { + customText = value; + if (IsLoaded) + updateText(); + } + } private OsuSpriteText text = null!; @@ -291,7 +306,6 @@ namespace osu.Game.Screens.SelectV2 } }; - Freestyle.BindValueChanged(_ => updateText()); Mods.BindValueChanged(_ => updateText(), true); } @@ -304,8 +318,8 @@ namespace osu.Game.Screens.SelectV2 private void updateText() { - if (Freestyle.Value) - text.Text = ModSelectOverlayStrings.AllMods.ToUpper(); + if (CustomText != null) + text.Text = CustomText.Value; else text.Text = ModSelectOverlayStrings.Mods(Mods.Value.Count).ToUpper(); }