2018-01-05 19:21:19 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-08-10 00:50:44 +08:00
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-08-09 05:11:46 +08:00
|
|
|
|
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;
|
2017-12-26 03:46:04 +08:00
|
|
|
|
private Color4 unhoverColour;
|
2017-08-09 05:11:46 +08:00
|
|
|
|
|
|
|
|
|
protected override bool OnHover(InputState state)
|
|
|
|
|
{
|
|
|
|
|
this.FadeColour(hoverColour, 500, Easing.OutQuint);
|
|
|
|
|
return base.OnHover(state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnHoverLost(InputState state)
|
|
|
|
|
{
|
2017-12-26 03:46:04 +08:00
|
|
|
|
this.FadeColour(unhoverColour, 500, Easing.OutQuint);
|
2017-08-09 05:11:46 +08:00
|
|
|
|
base.OnHoverLost(state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
|
{
|
|
|
|
|
hoverColour = colours.Yellow;
|
2017-12-26 03:46:04 +08:00
|
|
|
|
unhoverColour = Colour;
|
2017-08-09 05:11:46 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|