mirror of
https://github.com/ppy/osu.git
synced 2025-01-07 00:42:54 +08:00
Merge branch 'master' into score-counter-flexibility
This commit is contained in:
commit
0c868f54bc
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user