Implement ISamplePlaybackDisabler in mod select

This commit is contained in:
Bartłomiej Dach 2022-05-07 16:28:28 +02:00
parent cbd1169495
commit 81ca534f87
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497

View File

@ -15,6 +15,7 @@ using osu.Framework.Input.Events;
using osu.Framework.Layout;
using osu.Framework.Lists;
using osu.Framework.Utils;
using osu.Game.Audio;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
@ -27,7 +28,7 @@ using osuTK.Input;
namespace osu.Game.Overlays.Mods
{
public abstract class ModSelectScreen : ShearedOverlayContainer
public abstract class ModSelectScreen : ShearedOverlayContainer, ISamplePlaybackDisabler
{
protected const int BUTTON_WIDTH = 200;
@ -188,6 +189,8 @@ namespace osu.Game.Overlays.Mods
{
base.LoadComplete();
State.BindValueChanged(_ => samplePlaybackDisabled.Value = State.Value == Visibility.Hidden, true);
((IBindable<IReadOnlyList<Mod>>)modSettingsArea.SelectedMods).BindTo(SelectedMods);
SelectedMods.BindValueChanged(val =>
@ -430,6 +433,13 @@ namespace osu.Game.Overlays.Mods
#endregion
#region Sample playback control
private readonly Bindable<bool> samplePlaybackDisabled = new BindableBool(true);
IBindable<bool> ISamplePlaybackDisabler.SamplePlaybackDisabled => samplePlaybackDisabled;
#endregion
/// <summary>
/// Manages horizontal scrolling of mod columns, along with the "active" states of each column based on visibility.
/// </summary>