1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-09 09:37:42 +08:00
osu-lazer/osu.Game/Overlays/Settings/SidebarButton.cs
Dean Herbert 49b341daff Remove HoverTarget shared state update path
Felt quite convoluted to follow. Have just duplicated the single shared
line instead.
2021-10-10 11:55:47 +09:00

41 lines
1.1 KiB
C#

// 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.
using osu.Framework.Allocation;
using osu.Framework.Input.Events;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings
{
public abstract class SidebarButton : OsuButton
{
protected const double FADE_DURATION = 500;
[Resolved]
protected OverlayColourProvider ColourProvider { get; private set; }
[BackgroundDependencyLoader]
private void load()
{
BackgroundColour = ColourProvider.Background5;
}
protected override void LoadComplete()
{
base.LoadComplete();
UpdateState();
FinishTransforms(true);
}
protected override bool OnHover(HoverEvent e)
{
UpdateState();
return false;
}
protected override void OnHoverLost(HoverLostEvent e) => UpdateState();
protected abstract void UpdateState();
}
}