1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 18:33:22 +08:00

Refactor ProfileItemContainer to not use sounds

This commit is contained in:
Andrei Zavatski 2020-01-19 22:57:39 +03:00
parent 8906416294
commit 5f11084aed

View File

@ -5,28 +5,31 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using System.Collections.Generic;
using osuTK.Graphics;
namespace osu.Game.Overlays.Profile.Sections
{
public class ProfileItemContainer : OsuHoverContainer
public class ProfileItemContainer : Container
{
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
private const int hover_duration = 200;
protected override Container<Drawable> Content => content;
private Color4 idleColour;
private Color4 hoverColour;
private readonly Box background;
private readonly Container content;
public ProfileItemContainer()
{
RelativeSizeAxes = Axes.Both;
Enabled.Value = true; //manually enabled, because we have no action
Masking = true;
CornerRadius = 6;
base.Content.AddRange(new Drawable[]
AddRangeInternal(new Drawable[]
{
background = new Box
{
@ -42,8 +45,20 @@ namespace osu.Game.Overlays.Profile.Sections
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
IdleColour = colours.GreySeafoam;
HoverColour = colours.GreySeafoamLight;
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);
}
}
}