2020-03-04 17:19:28 +00:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2019-09-27 16:33:52 +00:00
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2019-09-27 16:33:52 +00:00
|
|
|
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 partial class TableRowBackground : CompositeDrawable
|
|
|
|
{
|
|
|
|
private const int fade_duration = 100;
|
|
|
|
|
|
|
|
private readonly Box background;
|
|
|
|
|
|
|
|
private Color4 idleColour;
|
|
|
|
private Color4 hoverColour;
|
|
|
|
|
2020-03-04 17:19:28 +00:00
|
|
|
public TableRowBackground()
|
2019-09-27 16:33:52 +00:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
2020-02-27 21:25:49 +00:00
|
|
|
CornerRadius = 4;
|
2019-09-27 16:33:52 +00:00
|
|
|
Masking = true;
|
2020-02-27 21:25:49 +00:00
|
|
|
MaskingSmoothness = 0.5f;
|
2019-09-27 16:33:52 +00:00
|
|
|
|
|
|
|
InternalChild = background = new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2020-02-03 18:22:37 +00:00
|
|
|
private void load(OverlayColourProvider colourProvider)
|
2019-09-27 16:33:52 +00:00
|
|
|
{
|
2020-02-03 18:22:37 +00:00
|
|
|
background.Colour = idleColour = colourProvider.Background4;
|
|
|
|
hoverColour = colourProvider.Background3;
|
2019-09-27 16:33:52 +00: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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|