1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 05:02:55 +08:00

Fix sound duplication due to checkbox

This commit is contained in:
smoogipoo 2021-02-02 21:29:00 +09:00
parent f25535548a
commit 5a56e2ba4b
2 changed files with 15 additions and 4 deletions

View File

@ -18,6 +18,11 @@ namespace osu.Game.Graphics.UserInterface
public Color4 UncheckedColor { get; set; } = Color4.White; public Color4 UncheckedColor { get; set; } = Color4.White;
public int FadeDuration { get; set; } public int FadeDuration { get; set; }
/// <summary>
/// Whether to play sounds when the state changes as a result of user interaction.
/// </summary>
protected virtual bool PlaySoundsOnUserChange => true;
public string LabelText public string LabelText
{ {
set set
@ -96,6 +101,9 @@ namespace osu.Game.Graphics.UserInterface
protected override void OnUserChange(bool value) protected override void OnUserChange(bool value)
{ {
base.OnUserChange(value); base.OnUserChange(value);
if (PlaySoundsOnUserChange)
{
if (value) if (value)
sampleChecked?.Play(); sampleChecked?.Play();
else else
@ -103,3 +111,4 @@ namespace osu.Game.Graphics.UserInterface
} }
} }
} }
}

View File

@ -110,6 +110,8 @@ namespace osu.Game.Screens.OnlinePlay
{ {
public Action<bool> Changed; public Action<bool> Changed;
protected override bool PlaySoundsOnUserChange => false;
protected override void OnUserChange(bool value) protected override void OnUserChange(bool value)
{ {
base.OnUserChange(value); base.OnUserChange(value);