mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
generalize the hover code
This commit is contained in:
32
osu.Game/Graphics/Containers/OsuHoverContainer.cs
Normal file
32
osu.Game/Graphics/Containers/OsuHoverContainer.cs
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input;
|
||||
|
||||
namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
|
||||
public class OsuHoverContainer : OsuClickableContainer
|
||||
{
|
||||
private Color4 hoverColour;
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
{
|
||||
this.FadeColour(hoverColour, 500, Easing.OutQuint);
|
||||
return base.OnHover(state);
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(InputState state)
|
||||
{
|
||||
this.FadeColour(Color4.White, 500, Easing.OutQuint);
|
||||
base.OnHoverLost(state);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
hoverColour = colours.Yellow;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user