1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-29 22:07:29 +08:00
osu-lazer/osu.Game/Overlays/Rankings/Tables/TableRowBackground.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

56 lines
1.5 KiB
C#
Raw Normal View History

// 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
{
public class TableRowBackground : CompositeDrawable
{
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);
}
}
}