2021-10-09 20:43:18 +02:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2019-01-24 17:43:03 +09:00
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 18:19:50 +09:00
|
|
|
|
2022-06-17 16:37:17 +09:00
|
|
|
#nullable disable
|
|
|
|
|
2017-01-12 23:49:05 -05:00
|
|
|
using osu.Framework.Allocation;
|
2021-10-03 17:30:22 +02:00
|
|
|
using osu.Framework.Input.Events;
|
2017-11-26 01:53:03 +09:00
|
|
|
using osu.Game.Graphics.UserInterface;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
2017-05-15 10:55:29 +09:00
|
|
|
namespace osu.Game.Overlays.Settings
|
2016-11-12 01:53:20 -05:00
|
|
|
{
|
2021-10-09 20:43:18 +02:00
|
|
|
public abstract class SidebarButton : OsuButton
|
2016-11-12 01:53:20 -05:00
|
|
|
{
|
2021-10-10 11:55:45 +09:00
|
|
|
protected const double FADE_DURATION = 500;
|
2021-10-03 17:30:22 +02:00
|
|
|
|
|
|
|
[Resolved]
|
2021-10-09 20:43:18 +02:00
|
|
|
protected OverlayColourProvider ColourProvider { get; private set; }
|
2018-04-13 18:19:50 +09:00
|
|
|
|
2017-01-12 23:49:05 -05:00
|
|
|
[BackgroundDependencyLoader]
|
2021-10-03 17:30:22 +02:00
|
|
|
private void load()
|
|
|
|
{
|
2021-10-09 20:43:18 +02:00
|
|
|
BackgroundColour = ColourProvider.Background5;
|
2021-10-03 17:30:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
2021-10-09 20:43:18 +02:00
|
|
|
UpdateState();
|
|
|
|
FinishTransforms(true);
|
2021-10-03 17:30:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override bool OnHover(HoverEvent e)
|
2017-01-12 23:49:05 -05:00
|
|
|
{
|
2021-10-09 20:43:18 +02:00
|
|
|
UpdateState();
|
2021-10-03 17:30:22 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-10-09 20:43:18 +02:00
|
|
|
protected override void OnHoverLost(HoverLostEvent e) => UpdateState();
|
2021-10-03 17:30:22 +02:00
|
|
|
|
2021-10-10 11:55:45 +09:00
|
|
|
protected abstract void UpdateState();
|
2016-11-12 01:53:20 -05:00
|
|
|
}
|
2017-11-26 01:53:03 +09:00
|
|
|
}
|