update drawable score inline with the latest design

This commit is contained in:
EVAST9919
2019-02-08 19:50:02 +03:00
parent f43ee6b6a3
commit 7a3ae0f479
4 changed files with 87 additions and 84 deletions

View File

@ -25,6 +25,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private const float text_size = 14;
private readonly Box hoveredBackground;
private readonly Box background;
private readonly SpriteText rank;
private readonly SpriteText scoreText;
private readonly SpriteText accuracy;
@ -39,10 +41,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private readonly APIScoreInfo score;
public DrawableScore(int index, APIScoreInfo score)
public DrawableScore(int index, APIScoreInfo score, int maxModsAmount)
{
FillFlowContainer modsContainer;
Box background;
this.score = score;
@ -69,7 +70,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
TextSize = text_size,
X = ScoreTextLine.RANK_POSITION,
Font = @"Exo2.0-Bold",
Colour = Color4.Black,
},
new DrawableRank(score.Rank)
{
@ -85,7 +85,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Origin = Anchor.CentreLeft,
Text = $@"{score.TotalScore:N0}",
X = ScoreTextLine.SCORE_POSITION,
Colour = Color4.Black,
TextSize = text_size,
},
accuracy = new SpriteText
@ -109,7 +108,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Origin = Anchor.CentreLeft,
User = score.User,
X = ScoreTextLine.PLAYER_POSITION,
Colour = Color4.Black,
},
maxCombo = new SpriteText
{
@ -119,7 +117,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
RelativePositionAxes = Axes.X,
X = ScoreTextLine.MAX_COMBO_POSITION,
TextSize = text_size,
Colour = Color4.Black,
},
hitGreat = new SpriteText
{
@ -129,7 +126,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
RelativePositionAxes = Axes.X,
X = ScoreTextLine.HIT_GREAT_POSITION,
TextSize = text_size,
Colour = Color4.Black,
},
hitGood = new SpriteText
{
@ -139,7 +135,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
RelativePositionAxes = Axes.X,
X = ScoreTextLine.HIT_GOOD_POSITION,
TextSize = text_size,
Colour = Color4.Black,
},
hitMeh = new SpriteText
{
@ -149,7 +144,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
RelativePositionAxes = Axes.X,
X = ScoreTextLine.HIT_MEH_POSITION,
TextSize = text_size,
Colour = Color4.Black,
},
hitMiss = new SpriteText
{
@ -159,7 +153,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
RelativePositionAxes = Axes.X,
X = ScoreTextLine.HIT_MISS_POSITION,
TextSize = text_size,
Colour = Color4.Black,
},
pp = new SpriteText
{
@ -169,34 +162,35 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
RelativePositionAxes = Axes.X,
X = ScoreTextLine.PP_POSITION,
TextSize = text_size,
Colour = Color4.Black,
},
modsContainer = new FillFlowContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.Centre,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreLeft,
Direction = FillDirection.Horizontal,
AutoSizeAxes = Axes.Both,
RelativePositionAxes = Axes.X,
X = ScoreTextLine.MODS_POSITION,
X = -30 * maxModsAmount,
},
};
if (index == 0)
scoreText.Font = @"Exo2.0-Bold";
accuracy.Colour = (score.Accuracy == 1) ? Color4.Green : Color4.Black;
accuracy.Colour = (score.Accuracy == 1) ? Color4.LightGreen : Color4.White;
hitGreat.Colour = (score.Statistics[HitResult.Great] == 0) ? Color4.Gray : Color4.Black;
hitGood.Colour = (score.Statistics[HitResult.Good] == 0) ? Color4.Gray : Color4.Black;
hitMeh.Colour = (score.Statistics[HitResult.Meh] == 0) ? Color4.Gray : Color4.Black;
hitMiss.Colour = (score.Statistics[HitResult.Miss] == 0) ? Color4.Gray : Color4.Black;
hitGreat.Colour = (score.Statistics[HitResult.Great] == 0) ? Color4.Gray : Color4.White;
hitGood.Colour = (score.Statistics[HitResult.Good] == 0) ? Color4.Gray : Color4.White;
hitMeh.Colour = (score.Statistics[HitResult.Meh] == 0) ? Color4.Gray : Color4.White;
hitMiss.Colour = (score.Statistics[HitResult.Miss] == 0) ? Color4.Gray : Color4.White;
background.Colour = (index % 2 == 0) ? Color4.WhiteSmoke : Color4.White;
if (index % 2 == 0)
background.Alpha = 0;
foreach (Mod mod in score.Mods)
modsContainer.Add(new ModIcon(mod)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both,
Scale = new Vector2(0.3f),
});
@ -206,55 +200,18 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private void load(OsuColour colours)
{
hoveredBackground.Colour = colours.Gray4;
background.Colour = colours.Gray3;
}
protected override bool OnHover(HoverEvent e)
{
hoveredBackground.FadeIn(fade_duration, Easing.OutQuint);
rank.FadeColour(Color4.White, fade_duration, Easing.OutQuint);
scoreText.FadeColour(Color4.White, fade_duration, Easing.OutQuint);
accuracy.FadeColour(Color4.White, fade_duration, Easing.OutQuint);
username.FadeColour(Color4.White, fade_duration, Easing.OutQuint);
maxCombo.FadeColour(Color4.White, fade_duration, Easing.OutQuint);
pp.FadeColour(Color4.White, fade_duration, Easing.OutQuint);
if (score.Statistics[HitResult.Great] != 0)
hitGreat.FadeColour(Color4.White, fade_duration, Easing.OutQuint);
if (score.Statistics[HitResult.Good] != 0)
hitGood.FadeColour(Color4.White, fade_duration, Easing.OutQuint);
if (score.Statistics[HitResult.Meh] != 0)
hitMeh.FadeColour(Color4.White, fade_duration, Easing.OutQuint);
if (score.Statistics[HitResult.Miss] != 0)
hitMiss.FadeColour(Color4.White, fade_duration, Easing.OutQuint);
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
hoveredBackground.FadeOut(fade_duration, Easing.OutQuint);
rank.FadeColour(Color4.Black, fade_duration, Easing.OutQuint);
scoreText.FadeColour(Color4.Black, fade_duration, Easing.OutQuint);
username.FadeColour(Color4.Black, fade_duration, Easing.OutQuint);
accuracy.FadeColour((score.Accuracy == 1) ? Color4.Green : Color4.Black, fade_duration, Easing.OutQuint);
maxCombo.FadeColour(Color4.Black, fade_duration, Easing.OutQuint);
pp.FadeColour(Color4.Black, fade_duration, Easing.OutQuint);
if (score.Statistics[HitResult.Great] != 0)
hitGreat.FadeColour(Color4.Black, fade_duration, Easing.OutQuint);
if (score.Statistics[HitResult.Good] != 0)
hitGood.FadeColour(Color4.Black, fade_duration, Easing.OutQuint);
if (score.Statistics[HitResult.Meh] != 0)
hitMeh.FadeColour(Color4.Black, fade_duration, Easing.OutQuint);
if (score.Statistics[HitResult.Miss] != 0)
hitMiss.FadeColour(Color4.Black, fade_duration, Easing.OutQuint);
base.OnHoverLost(e);
}