mirror of
https://github.com/ppy/osu.git
synced 2025-01-08 09:02:57 +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]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OverlayColourProvider colourProvider)
|
||||||
{
|
{
|
||||||
AddRangeInternal(new Drawable[]
|
AddRangeInternal(new Drawable[]
|
||||||
{
|
{
|
||||||
@ -61,7 +61,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
CornerRadius = corner_radius,
|
CornerRadius = corner_radius,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new ProfileItemContainer
|
new MostPlayedBeatmapContainer
|
||||||
{
|
{
|
||||||
Child = new Container
|
Child = new Container
|
||||||
{
|
{
|
||||||
@ -78,11 +78,14 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new MostPlayedBeatmapMetadataContainer(beatmap),
|
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,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Colour = colours.GreySeafoamLighter
|
|
||||||
}.With(d =>
|
}.With(d =>
|
||||||
{
|
{
|
||||||
d.AddText("mapped by ");
|
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
|
private class MostPlayedBeatmapMetadataContainer : BeatmapMetadataContainer
|
||||||
{
|
{
|
||||||
public MostPlayedBeatmapMetadataContainer(BeatmapInfo beatmap)
|
public MostPlayedBeatmapMetadataContainer(BeatmapInfo beatmap)
|
||||||
|
@ -16,12 +16,33 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
private Color4 idleColour;
|
|
||||||
private Color4 hoverColour;
|
|
||||||
|
|
||||||
private readonly Box background;
|
private readonly Box background;
|
||||||
private readonly Container content;
|
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()
|
public ProfileItemContainer()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
@ -44,20 +65,25 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OverlayColourProvider colourProvider)
|
private void load(OverlayColourProvider colourProvider)
|
||||||
{
|
{
|
||||||
background.Colour = idleColour = colourProvider.Background3;
|
IdleColour = colourProvider.Background3;
|
||||||
hoverColour = colourProvider.Background2;
|
HoverColour = colourProvider.Background2;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
background.FadeColour(hoverColour, hover_duration, Easing.OutQuint);
|
fadeBackgroundColour(hover_duration);
|
||||||
return base.OnHover(e);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnHoverLost(HoverLostEvent e)
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
{
|
{
|
||||||
base.OnHoverLost(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