mirror of
https://github.com/ppy/osu.git
synced 2025-01-29 13:42:54 +08:00
Add checkbox sound effects.
This commit is contained in:
parent
d4670fc64e
commit
590ca3108c
@ -1 +1 @@
|
|||||||
Subproject commit 6edd5eacdd25cc8c4f4dbca3414678c0b7dc5deb
|
Subproject commit 8ee9e6736fb3f656894baaef109a06fd25278fe6
|
@ -1,5 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -60,6 +63,8 @@ namespace osu.Game.Overlays.Options
|
|||||||
|
|
||||||
private Light light;
|
private Light light;
|
||||||
private SpriteText labelSpriteText;
|
private SpriteText labelSpriteText;
|
||||||
|
private AudioSample sampleChecked;
|
||||||
|
private AudioSample sampleUnchecked;
|
||||||
|
|
||||||
public CheckBoxOption()
|
public CheckBoxOption()
|
||||||
{
|
{
|
||||||
@ -102,11 +107,19 @@ namespace osu.Game.Overlays.Options
|
|||||||
base.OnHoverLost(state);
|
base.OnHoverLost(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(AudioManager audio)
|
||||||
|
{
|
||||||
|
sampleChecked = audio.Sample.Get(@"Checkbox/check-on");
|
||||||
|
sampleUnchecked = audio.Sample.Get(@"Checkbox/check-off");
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnChecked()
|
protected override void OnChecked()
|
||||||
{
|
{
|
||||||
if (bindable != null)
|
if (bindable != null)
|
||||||
bindable.Value = true;
|
bindable.Value = true;
|
||||||
|
|
||||||
|
sampleChecked?.Play();
|
||||||
light.State = CheckBoxState.Checked;
|
light.State = CheckBoxState.Checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,6 +128,7 @@ namespace osu.Game.Overlays.Options
|
|||||||
if (bindable != null)
|
if (bindable != null)
|
||||||
bindable.Value = false;
|
bindable.Value = false;
|
||||||
|
|
||||||
|
sampleUnchecked?.Play();
|
||||||
light.State = CheckBoxState.Unchecked;
|
light.State = CheckBoxState.Unchecked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user