1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-24 22:32:55 +08:00
osu-lazer/osu.Game/Overlays/Settings/SidebarButton.cs

46 lines
1.2 KiB
C#
Raw Normal View History

2023-06-23 00:37:25 +08:00
// 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 17:19:50 +08:00
using osu.Framework.Allocation;
using osu.Framework.Input.Events;
2018-04-13 17:19:50 +08:00
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings
{
2022-11-24 13:32:20 +08:00
public abstract partial class SidebarButton : OsuButton
2018-04-13 17:19:50 +08:00
{
protected const double FADE_DURATION = 500;
[Resolved]
2023-06-23 00:37:25 +08:00
protected OverlayColourProvider ColourProvider { get; private set; } = null!;
2018-04-13 17:19:50 +08:00
protected SidebarButton(HoverSampleSet? hoverSounds = HoverSampleSet.ButtonSidebar)
: base(hoverSounds)
{
}
2018-04-13 17:19:50 +08: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 17:19:50 +08:00
{
UpdateState();
return false;
}
protected override void OnHoverLost(HoverLostEvent e) => UpdateState();
protected abstract void UpdateState();
2018-04-13 17:19:50 +08:00
}
}