osu/osu.Game/Overlays/Settings/SidebarButton.cs

41 lines
1.1 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-04-13 09:19:50 +00:00
using osu.Framework.Allocation;
using osu.Framework.Input.Events;
2018-04-13 09:19:50 +00:00
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings
{
public abstract class SidebarButton : OsuButton
2018-04-13 09:19:50 +00:00
{
protected const double FADE_DURATION = 500;
[Resolved]
protected OverlayColourProvider ColourProvider { get; private set; }
2018-04-13 09:19:50 +00:00
[BackgroundDependencyLoader]
private void load()
{
BackgroundColour = ColourProvider.Background5;
}
protected override void LoadComplete()
{
base.LoadComplete();
UpdateState();
FinishTransforms(true);
}
protected override bool OnHover(HoverEvent e)
2018-04-13 09:19:50 +00:00
{
UpdateState();
return false;
}
protected override void OnHoverLost(HoverLostEvent e) => UpdateState();
protected abstract void UpdateState();
2018-04-13 09:19:50 +00:00
}
}