2020-03-05 01:19:28 +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
|
|
|
|
|
{
|
|
|
|
|
public partial class TableRowBackground : CompositeDrawable
|
|
|
|
|
{
|
|
|
|
|
private const int fade_duration = 100;
|
|
|
|
|
|
|
|
|
|
private readonly Box background;
|
|
|
|
|
|
|
|
|
|
private Color4 idleColour;
|
|
|
|
|
private Color4 hoverColour;
|
|
|
|
|
|
2020-03-05 01:19:28 +08:00
|
|
|
|
public TableRowBackground()
|
2019-09-28 00:33:52 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
|
2020-02-28 05:25:49 +08:00
|
|
|
|
CornerRadius = 4;
|
2019-09-28 00:33:52 +08:00
|
|
|
|
Masking = true;
|
2020-02-28 05:25:49 +08:00
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|