mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 23:52:57 +08:00
Fix sound duplication due to checkbox
This commit is contained in:
parent
f25535548a
commit
5a56e2ba4b
@ -18,6 +18,11 @@ namespace osu.Game.Graphics.UserInterface
|
||||
public Color4 UncheckedColor { get; set; } = Color4.White;
|
||||
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
|
||||
{
|
||||
set
|
||||
@ -96,10 +101,14 @@ namespace osu.Game.Graphics.UserInterface
|
||||
protected override void OnUserChange(bool value)
|
||||
{
|
||||
base.OnUserChange(value);
|
||||
if (value)
|
||||
sampleChecked?.Play();
|
||||
else
|
||||
sampleUnchecked?.Play();
|
||||
|
||||
if (PlaySoundsOnUserChange)
|
||||
{
|
||||
if (value)
|
||||
sampleChecked?.Play();
|
||||
else
|
||||
sampleUnchecked?.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -110,6 +110,8 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
{
|
||||
public Action<bool> Changed;
|
||||
|
||||
protected override bool PlaySoundsOnUserChange => false;
|
||||
|
||||
protected override void OnUserChange(bool value)
|
||||
{
|
||||
base.OnUserChange(value);
|
||||
|
Loading…
Reference in New Issue
Block a user