Merge pull request #2336 from Frontear/colours-for-judgements

Implement Judgement Colours
This commit is contained in:
Dan Balasescu 2018-04-04 16:30:52 +09:00 committed by GitHub
commit 9558554ab9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,8 @@ namespace osu.Game.Rulesets.Judgements
{
private const float judgement_size = 80;
private OsuColour colours;
protected readonly Judgement Judgement;
public readonly DrawableHitObject JudgedObject;
@ -45,11 +47,13 @@ namespace osu.Game.Rulesets.Judgements
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
this.colours = colours;
Child = new SkinnableDrawable($"Play/{Judgement.Result}", _ => JudgementText = new OsuSpriteText
{
Text = Judgement.Result.GetDescription().ToUpper(),
Font = @"Venera",
Colour = Judgement.Result == HitResult.Miss ? colours.Red : Color4.White,
Colour = judgementColour(Judgement.Result),
Scale = new Vector2(0.85f, 1),
TextSize = 12
}, restrictSize: false);
@ -84,5 +88,24 @@ namespace osu.Game.Rulesets.Judgements
Expire(true);
}
private Color4 judgementColour(HitResult judgement)
{
switch (judgement)
{
case HitResult.Perfect:
case HitResult.Great:
return colours.Blue;
case HitResult.Ok:
case HitResult.Good:
return colours.Green;
case HitResult.Meh:
return colours.Yellow;
case HitResult.Miss:
return colours.Red;
}
return Color4.White;
}
}
}