mirror of
https://github.com/ppy/osu.git
synced 2026-06-07 07:03:40 +08:00
Remove leaking knowledge of freestyle in normal song select component
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -261,7 +261,22 @@ namespace osu.Game.Screens.SelectV2
|
||||
public partial class ModCountText : VisibilityContainer, IHasCustomTooltip<IReadOnlyList<Mod>>
|
||||
{
|
||||
public readonly Bindable<IReadOnlyList<Mod>> Mods = new Bindable<IReadOnlyList<Mod>>();
|
||||
public readonly Bindable<bool> Freestyle = new Bindable<bool>();
|
||||
|
||||
private LocalisableString? customText;
|
||||
|
||||
/// <summary>
|
||||
/// When set, this will be shown instead of a mod count.
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user