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:
parent
f25535548a
commit
5a56e2ba4b
@ -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
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user