1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:47:27 +08:00

Merge pull request #8047 from TheWildTree/adjust-most-played

Adjust most played beatmaps section to better match osu-web
This commit is contained in:
Dean Herbert 2020-03-09 02:20:02 +09:00 committed by GitHub
commit 460bd993ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 12 deletions

View File

@ -37,7 +37,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OverlayColourProvider colourProvider)
{
AddRangeInternal(new Drawable[]
{
@ -61,7 +61,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
CornerRadius = corner_radius,
Children = new Drawable[]
{
new ProfileItemContainer
new MostPlayedBeatmapContainer
{
Child = new Container
{
@ -78,11 +78,14 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
Children = new Drawable[]
{
new MostPlayedBeatmapMetadataContainer(beatmap),
new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular))
new LinkFlowContainer(t =>
{
t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular);
t.Colour = colourProvider.Foreground1;
})
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Colour = colours.GreySeafoamLighter
}.With(d =>
{
d.AddText("mapped by ");
@ -105,6 +108,16 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
});
}
private class MostPlayedBeatmapContainer : ProfileItemContainer
{
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
IdleColour = colourProvider.Background4;
HoverColour = colourProvider.Background3;
}
}
private class MostPlayedBeatmapMetadataContainer : BeatmapMetadataContainer
{
public MostPlayedBeatmapMetadataContainer(BeatmapInfo beatmap)

View File

@ -16,12 +16,33 @@ namespace osu.Game.Overlays.Profile.Sections
protected override Container<Drawable> Content => content;
private Color4 idleColour;
private Color4 hoverColour;
private readonly Box background;
private readonly Container content;
private Color4 idleColour;
protected Color4 IdleColour
{
get => idleColour;
set
{
idleColour = value;
fadeBackgroundColour();
}
}
private Color4 hoverColour;
protected Color4 HoverColour
{
get => hoverColour;
set
{
hoverColour = value;
fadeBackgroundColour();
}
}
public ProfileItemContainer()
{
RelativeSizeAxes = Axes.Both;
@ -44,20 +65,25 @@ namespace osu.Game.Overlays.Profile.Sections
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
background.Colour = idleColour = colourProvider.Background3;
hoverColour = colourProvider.Background2;
IdleColour = colourProvider.Background3;
HoverColour = colourProvider.Background2;
}
protected override bool OnHover(HoverEvent e)
{
background.FadeColour(hoverColour, hover_duration, Easing.OutQuint);
return base.OnHover(e);
fadeBackgroundColour(hover_duration);
return true;
}
protected override void OnHoverLost(HoverLostEvent e)
{
base.OnHoverLost(e);
background.FadeColour(idleColour, hover_duration, Easing.OutQuint);
fadeBackgroundColour(hover_duration);
}
private void fadeBackgroundColour(double fadeDuration = 0)
{
background.FadeColour(IsHovered ? HoverColour : IdleColour, fadeDuration, Easing.OutQuint);
}
}
}