mirror of
https://github.com/ppy/osu
synced 2025-02-17 10:57:03 +00:00
Fix checkbox sounds playing too often
This commit is contained in:
parent
58258188ce
commit
f7a92487ef
@ -72,17 +72,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Current.DisabledChanged += disabled => labelText.Alpha = Nub.Alpha = disabled ? 0.3f : 1;
|
Current.DisabledChanged += disabled => labelText.Alpha = Nub.Alpha = disabled ? 0.3f : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
sampleChecked = audio.Samples.Get(@"UI/check-on");
|
||||||
|
sampleUnchecked = audio.Samples.Get(@"UI/check-off");
|
||||||
Current.ValueChanged += enabled =>
|
|
||||||
{
|
|
||||||
if (enabled.NewValue)
|
|
||||||
sampleChecked?.Play();
|
|
||||||
else
|
|
||||||
sampleUnchecked?.Play();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
@ -99,11 +93,13 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
base.OnHoverLost(e);
|
base.OnHoverLost(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
protected override void OnUserChange(bool value)
|
||||||
private void load(AudioManager audio)
|
|
||||||
{
|
{
|
||||||
sampleChecked = audio.Samples.Get(@"UI/check-on");
|
base.OnUserChange(value);
|
||||||
sampleUnchecked = audio.Samples.Get(@"UI/check-off");
|
if (value)
|
||||||
|
sampleChecked?.Play();
|
||||||
|
else
|
||||||
|
sampleUnchecked?.Play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user