1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-19 03:12:54 +08:00
osu-lazer/osu.Game/Graphics/Containers/OsuHoverContainer.cs

46 lines
1.4 KiB
C#
Raw Normal View History

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
using System.Collections.Generic;
2017-08-09 05:11:46 +08:00
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions;
2017-08-09 05:11:46 +08:00
using osu.Framework.Graphics;
using osu.Framework.Input;
namespace osu.Game.Graphics.Containers
{
public class OsuHoverContainer : OsuClickableContainer
{
protected Color4 HoverColour;
protected Color4 IdleColour = Color4.White;
protected virtual IEnumerable<Drawable> EffectTargets => new[] { Content };
2017-08-09 05:11:46 +08:00
protected override bool OnHover(InputState state)
{
EffectTargets.ForEach(d => d.FadeColour(HoverColour, 500, Easing.OutQuint));
2017-08-09 05:11:46 +08:00
return base.OnHover(state);
}
protected override void OnHoverLost(InputState state)
{
EffectTargets.ForEach(d => d.FadeColour(IdleColour, 500, Easing.OutQuint));
2017-08-09 05:11:46 +08:00
base.OnHoverLost(state);
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
HoverColour = colours.Yellow;
}
protected override void LoadComplete()
{
base.LoadComplete();
EffectTargets.ForEach(d => d.FadeColour(IdleColour));
2017-08-09 05:11:46 +08:00
}
}
}