mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09:00
Update stand-alone usage of hover/select sounds in DrawableOsuMenuItem
This commit is contained in:
parent
97bb3de1c9
commit
5887b4a27c
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -23,9 +22,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
private const int text_size = 17;
|
private const int text_size = 17;
|
||||||
private const int transition_length = 80;
|
private const int transition_length = 80;
|
||||||
|
|
||||||
private Sample sampleClick;
|
|
||||||
private Sample sampleHover;
|
|
||||||
|
|
||||||
private TextContainer text;
|
private TextContainer text;
|
||||||
|
|
||||||
public DrawableOsuMenuItem(MenuItem item)
|
public DrawableOsuMenuItem(MenuItem item)
|
||||||
@ -36,12 +32,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
sampleHover = audio.Samples.Get(@"UI/generic-hover");
|
|
||||||
sampleClick = audio.Samples.Get(@"UI/generic-select");
|
|
||||||
|
|
||||||
BackgroundColour = Color4.Transparent;
|
BackgroundColour = Color4.Transparent;
|
||||||
BackgroundColourHover = Color4Extensions.FromHex(@"172023");
|
BackgroundColourHover = Color4Extensions.FromHex(@"172023");
|
||||||
|
|
||||||
|
AddInternal(new HoverClickSounds());
|
||||||
|
|
||||||
updateTextColour();
|
updateTextColour();
|
||||||
|
|
||||||
Item.Action.BindDisabledChanged(_ => updateState(), true);
|
Item.Action.BindDisabledChanged(_ => updateState(), true);
|
||||||
@ -84,7 +79,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
if (IsHovered && !Item.Action.Disabled)
|
if (IsHovered && !Item.Action.Disabled)
|
||||||
{
|
{
|
||||||
sampleHover.Play();
|
|
||||||
text.BoldText.FadeIn(transition_length, Easing.OutQuint);
|
text.BoldText.FadeIn(transition_length, Easing.OutQuint);
|
||||||
text.NormalText.FadeOut(transition_length, Easing.OutQuint);
|
text.NormalText.FadeOut(transition_length, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
@ -95,12 +89,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
|
||||||
{
|
|
||||||
sampleClick.Play();
|
|
||||||
return base.OnClick(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected sealed override Drawable CreateContent() => text = CreateTextContainer();
|
protected sealed override Drawable CreateContent() => text = CreateTextContainer();
|
||||||
protected virtual TextContainer CreateTextContainer() => new TextContainer();
|
protected virtual TextContainer CreateTextContainer() => new TextContainer();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user