1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-16 15:37:44 +08:00
osu-lazer/osu.Game/Overlays/Rankings/Tables/TableRowBackground.cs

56 lines
1.6 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.
2019-09-28 00:33:52 +08:00
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osuTK.Graphics;
namespace osu.Game.Overlays.Rankings.Tables
{
2022-11-24 13:32:20 +08:00
public partial class TableRowBackground : CompositeDrawable
2019-09-28 00:33:52 +08:00
{
private const int fade_duration = 100;
private readonly Box background;
private Color4 idleColour;
private Color4 hoverColour;
public TableRowBackground()
2019-09-28 00:33:52 +08:00
{
RelativeSizeAxes = Axes.X;
CornerRadius = 4;
2019-09-28 00:33:52 +08:00
Masking = true;
MaskingSmoothness = 0.5f;
2019-09-28 00:33:52 +08:00
InternalChild = background = new Box
{
RelativeSizeAxes = Axes.Both,
};
}
[BackgroundDependencyLoader]
2020-02-04 02:22:37 +08:00
private void load(OverlayColourProvider colourProvider)
2019-09-28 00:33:52 +08:00
{
2020-02-04 02:22:37 +08:00
background.Colour = idleColour = colourProvider.Background4;
hoverColour = colourProvider.Background3;
2019-09-28 00:33:52 +08:00
}
protected override bool OnHover(HoverEvent e)
{
background.FadeColour(hoverColour, fade_duration, Easing.OutQuint);
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
background.FadeColour(idleColour, fade_duration, Easing.OutQuint);
base.OnHoverLost(e);
}
}
}