2020-01-18 06:36:14 +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.
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2020-01-20 03:57:39 +08:00
|
|
|
|
using osu.Framework.Input.Events;
|
2020-01-18 06:36:14 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2020-01-20 03:57:39 +08:00
|
|
|
|
using osuTK.Graphics;
|
2020-01-18 06:36:14 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Profile.Sections
|
|
|
|
|
{
|
2020-01-20 03:57:39 +08:00
|
|
|
|
public class ProfileItemContainer : Container
|
2020-01-18 06:36:14 +08:00
|
|
|
|
{
|
2020-01-20 03:57:39 +08:00
|
|
|
|
private const int hover_duration = 200;
|
|
|
|
|
|
2020-01-18 06:36:14 +08:00
|
|
|
|
protected override Container<Drawable> Content => content;
|
|
|
|
|
|
2020-01-20 03:57:39 +08:00
|
|
|
|
private Color4 idleColour;
|
|
|
|
|
private Color4 hoverColour;
|
|
|
|
|
|
2020-01-18 06:36:14 +08:00
|
|
|
|
private readonly Box background;
|
|
|
|
|
private readonly Container content;
|
|
|
|
|
|
2020-01-20 03:48:11 +08:00
|
|
|
|
public ProfileItemContainer()
|
2020-01-18 06:36:14 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
Masking = true;
|
|
|
|
|
CornerRadius = 6;
|
|
|
|
|
|
2020-01-20 03:57:39 +08:00
|
|
|
|
AddRangeInternal(new Drawable[]
|
2020-01-18 06:36:14 +08:00
|
|
|
|
{
|
|
|
|
|
background = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
},
|
|
|
|
|
content = new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
|
{
|
2020-01-20 03:57:39 +08:00
|
|
|
|
background.Colour = idleColour = colours.GreySeafoam;
|
|
|
|
|
hoverColour = colours.GreySeafoamLight;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool OnHover(HoverEvent e)
|
|
|
|
|
{
|
|
|
|
|
background.FadeColour(hoverColour, hover_duration, Easing.OutQuint);
|
|
|
|
|
return base.OnHover(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnHoverLost(HoverLostEvent e)
|
|
|
|
|
{
|
|
|
|
|
base.OnHoverLost(e);
|
|
|
|
|
background.FadeColour(idleColour, hover_duration, Easing.OutQuint);
|
2020-01-18 06:36:14 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|