1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 20:32:55 +08:00

update drawable top score inline with the latest design

This commit is contained in:
EVAST9919 2019-02-08 19:06:46 +03:00
parent 4b7b174f75
commit f43ee6b6a3
2 changed files with 35 additions and 57 deletions

View File

@ -30,6 +30,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private const float avatar_size = 80; private const float avatar_size = 80;
private const float margin = 10; private const float margin = 10;
private OsuColour colours;
private Color4 backgroundIdleColour => colours.Gray3;
private Color4 backgroundHoveredColour => colours.Gray4;
private readonly Box background; private readonly Box background;
private readonly UpdateableAvatar avatar; private readonly UpdateableAvatar avatar;
private readonly DrawableFlag flag; private readonly DrawableFlag flag;
@ -38,8 +43,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private readonly SpriteText date; private readonly SpriteText date;
private readonly DrawableRank rank; private readonly DrawableRank rank;
private readonly AutoSizeInfoColumn totalScore; private readonly AutoSizedInfoColumn totalScore;
private readonly MediumInfoColumn accuracy; private readonly AutoSizedInfoColumn accuracy;
private readonly MediumInfoColumn maxCombo; private readonly MediumInfoColumn maxCombo;
private readonly SmallInfoColumn hitGreat; private readonly SmallInfoColumn hitGreat;
@ -56,7 +61,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
get { return score; } get { return score; }
set set
{ {
if (score == value) return; if (score == value)
return;
score = value; score = value;
avatar.User = username.User = score.User; avatar.User = username.User = score.User;
@ -83,7 +89,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
CornerRadius = 3; CornerRadius = 10;
Masking = true; Masking = true;
EdgeEffect = new EdgeEffectParameters EdgeEffect = new EdgeEffectParameters
{ {
@ -97,7 +103,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
background = new Box background = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = Color4.White,
}, },
new Container new Container
{ {
@ -115,31 +120,20 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Spacing = new Vector2(margin, 0), Spacing = new Vector2(margin, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
new FillFlowContainer rankText = new SpriteText
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
AutoSizeAxes = Axes.Both, Text = "#1",
Direction = FillDirection.Vertical, TextSize = 30,
Spacing = new Vector2(0, 2), Font = @"Exo2.0-BoldItalic",
Children = new Drawable[] },
{ rank = new DrawableRank(ScoreRank.F)
rankText = new SpriteText {
{ Anchor = Anchor.Centre,
Anchor = Anchor.CentreRight, Origin = Anchor.Centre,
Origin = Anchor.CentreRight, Size = new Vector2(40),
Text = "#1", FillMode = FillMode.Fit,
TextSize = 20,
Font = @"Exo2.0-BoldItalic",
},
rank = new DrawableRank(ScoreRank.F)
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Size = new Vector2(30),
FillMode = FillMode.Fit,
},
}
}, },
avatar = new UpdateableAvatar avatar = new UpdateableAvatar
{ {
@ -229,8 +223,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Spacing = new Vector2(margin, 0), Spacing = new Vector2(margin, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
totalScore = new AutoSizeInfoColumn("Total Score"), totalScore = new AutoSizedInfoColumn("Total Score"),
accuracy = new MediumInfoColumn("Accuracy"), accuracy = new AutoSizedInfoColumn("Accuracy"),
maxCombo = new MediumInfoColumn("Max Combo"), maxCombo = new MediumInfoColumn("Max Combo"),
} }
}, },
@ -245,18 +239,21 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
date.Colour = rankText.Colour = colours.ContextMenuGray; this.colours = colours;
rankText.Colour = colours.Yellow;
background.Colour = backgroundIdleColour;
} }
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {
background.FadeColour(Color4.WhiteSmoke, fade_duration, Easing.OutQuint); background.FadeColour(backgroundHoveredColour, fade_duration, Easing.OutQuint);
return base.OnHover(e); return base.OnHover(e);
} }
protected override void OnHoverLost(HoverLostEvent e) protected override void OnHoverLost(HoverLostEvent e)
{ {
background.FadeColour(Color4.White, fade_duration, Easing.OutQuint); background.FadeColour(backgroundIdleColour, fade_duration, Easing.OutQuint);
base.OnHoverLost(e); base.OnHoverLost(e);
} }
@ -274,7 +271,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
{ {
set set
{ {
if (text.TextSize == value) return; if (text.TextSize == value)
return;
text.TextSize = value; text.TextSize = value;
} }
get { return text.TextSize; } get { return text.TextSize; }
@ -297,7 +295,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Add(text = new SpriteText Add(text = new SpriteText
{ {
Font = @"Exo2.0-BoldItalic", Font = @"Exo2.0-BoldItalic",
Colour = Color4.Black,
}); });
} }
@ -322,7 +319,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
protected override void OnHoverLost(HoverLostEvent e) protected override void OnHoverLost(HoverLostEvent e)
{ {
text.FadeColour(Color4.Black, username_fade_duration, Easing.OutQuint); text.FadeColour(Color4.White, username_fade_duration, Easing.OutQuint);
underscore.FadeOut(username_fade_duration, Easing.OutQuint); underscore.FadeOut(username_fade_duration, Easing.OutQuint);
base.OnHoverLost(e); base.OnHoverLost(e);
} }
@ -348,6 +345,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
{ {
TextSize = 12, TextSize = 12,
Text = header.ToUpper(), Text = header.ToUpper(),
Font = @"Exo2.0-Bold",
} }
}, },
new Container new Container
@ -362,12 +360,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
} }
}; };
} }
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
headerText.Colour = colours.ContextMenuGray;
}
} }
private class ModsInfoColumn : DrawableInfoColumn private class ModsInfoColumn : DrawableInfoColumn
@ -420,20 +412,13 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Add(valueText = new SpriteText Add(valueText = new SpriteText
{ {
TextSize = valueTextSize, TextSize = valueTextSize,
Font = @"Exo2.0-Light",
}); });
} }
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
valueText.Colour = colours.ContextMenuGray;
}
} }
private class AutoSizeInfoColumn : TextInfoColumn private class AutoSizedInfoColumn : TextInfoColumn
{ {
public AutoSizeInfoColumn(string header, float valueTextSize = 25) : base(header, valueTextSize) public AutoSizedInfoColumn(string header, float valueTextSize = 25) : base(header, valueTextSize)
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
} }

View File

@ -4,14 +4,12 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
using osuTK; using osuTK;
using osuTK.Graphics;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -102,11 +100,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Children = new Drawable[] Children = new Drawable[]
{ {
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.White,
},
new FillFlowContainer new FillFlowContainer
{ {
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,