mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 00:09:55 +09:00
Shuffle sound samples around and make more conformant
This commit is contained in:
@ -3,6 +3,8 @@
|
||||
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@ -18,6 +20,9 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
private Box hover;
|
||||
|
||||
private SampleChannel sampleClick;
|
||||
private SampleChannel sampleHover;
|
||||
|
||||
public OsuButton()
|
||||
{
|
||||
Height = 40;
|
||||
@ -34,7 +39,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
public override bool HandleInput => Action != null;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load(OsuColour colours, AudioManager audio)
|
||||
{
|
||||
if (Action == null)
|
||||
Colour = OsuColour.Gray(0.5f);
|
||||
@ -60,10 +65,20 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Alpha = 0,
|
||||
},
|
||||
});
|
||||
|
||||
sampleClick = audio.Sample.Get(@"UI/generic-click");
|
||||
sampleHover = audio.Sample.Get(@"UI/generic-hover");
|
||||
}
|
||||
|
||||
protected override bool OnClick(InputState state)
|
||||
{
|
||||
sampleClick?.Play();
|
||||
return base.OnClick(state);
|
||||
}
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
{
|
||||
sampleHover?.Play();
|
||||
hover.FadeIn(200);
|
||||
return base.OnHover(state);
|
||||
}
|
||||
|
Reference in New Issue
Block a user