mirror of
https://github.com/osukey/osukey.git
synced 2025-08-02 22:26:41 +09:00
Add OsuClickableContainer with generic sounds
This commit is contained in:
@ -20,7 +20,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, OsuColour colours)
|
||||
{
|
||||
ActivationSound = audio.Sample.Get(@"Menu/menuback");
|
||||
BackgroundColour = colours.Pink;
|
||||
HoverColour = colours.PinkDark;
|
||||
}
|
||||
|
@ -8,14 +8,14 @@ using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class DialogButton : ClickableContainer
|
||||
public class DialogButton : OsuClickableContainer
|
||||
{
|
||||
private const float hover_width = 0.9f;
|
||||
private const float hover_duration = 500;
|
||||
@ -79,8 +79,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
}
|
||||
|
||||
public SampleChannel SampleClick, SampleHover;
|
||||
|
||||
private readonly Container backgroundContainer;
|
||||
private readonly Container colourContainer;
|
||||
private readonly Container glowContainer;
|
||||
@ -100,8 +98,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
didClick = true;
|
||||
colourContainer.ResizeTo(new Vector2(1.5f, 1f), click_duration, EasingTypes.In);
|
||||
flash();
|
||||
SampleClick?.Play();
|
||||
Action?.Invoke();
|
||||
|
||||
Delay(click_duration);
|
||||
Schedule(delegate {
|
||||
@ -110,7 +106,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
glowContainer.FadeOut();
|
||||
});
|
||||
|
||||
return true;
|
||||
return base.OnClick(state);
|
||||
}
|
||||
|
||||
protected override bool OnHover(Framework.Input.InputState state)
|
||||
@ -119,7 +115,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
colourContainer.ResizeTo(new Vector2(hover_width, 1f), hover_duration, EasingTypes.OutElastic);
|
||||
glowContainer.FadeIn(glow_fade_duration, EasingTypes.Out);
|
||||
SampleHover?.Play();
|
||||
base.OnHover(state);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -9,10 +9,11 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class IconButton : ClickableContainer
|
||||
public class IconButton : OsuClickableContainer
|
||||
{
|
||||
private readonly TextAwesome icon;
|
||||
private readonly Box hover;
|
||||
|
@ -18,7 +18,7 @@ using osu.Framework.Graphics.Shapes;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class TwoLayerButton : ClickableContainer
|
||||
public class TwoLayerButton : OsuClickableContainer
|
||||
{
|
||||
private readonly BouncingIcon bouncingIcon;
|
||||
|
||||
@ -32,7 +32,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public static readonly Vector2 SIZE_EXTENDED = new Vector2(140, 50);
|
||||
public static readonly Vector2 SIZE_RETRACTED = new Vector2(100, 50);
|
||||
public SampleChannel ActivationSound;
|
||||
private readonly SpriteText text;
|
||||
|
||||
public Color4 HoverColour;
|
||||
@ -210,8 +209,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
flash.FadeOut(500, EasingTypes.OutQuint);
|
||||
flash.Expire();
|
||||
|
||||
ActivationSound.Play();
|
||||
|
||||
return base.OnClick(state);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user