mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 01:02:56 +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 osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -60,6 +63,8 @@ namespace osu.Game.Overlays.Options
|
||||
|
||||
private Light light;
|
||||
private SpriteText labelSpriteText;
|
||||
private AudioSample sampleChecked;
|
||||
private AudioSample sampleUnchecked;
|
||||
|
||||
public CheckBoxOption()
|
||||
{
|
||||
@ -102,11 +107,19 @@ namespace osu.Game.Overlays.Options
|
||||
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()
|
||||
{
|
||||
if (bindable != null)
|
||||
bindable.Value = true;
|
||||
|
||||
sampleChecked?.Play();
|
||||
light.State = CheckBoxState.Checked;
|
||||
}
|
||||
|
||||
@ -115,6 +128,7 @@ namespace osu.Game.Overlays.Options
|
||||
if (bindable != null)
|
||||
bindable.Value = false;
|
||||
|
||||
sampleUnchecked?.Play();
|
||||
light.State = CheckBoxState.Unchecked;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user