1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-16 17:03:18 +08:00

chore(osu.Game): combine Osu.Colour.{Draw,Text}ForHitResult into OsuColour.ForHitResult

This commit is contained in:
Acid Chicken (硫酸鶏) 2022-09-07 23:34:46 +09:00
parent 54f0bb797e
commit 267465df18
No known key found for this signature in database
GPG Key ID: 3E87B98A3F6BAB99
6 changed files with 6 additions and 29 deletions

View File

@ -102,30 +102,7 @@ namespace osu.Game.Graphics
/// <summary> /// <summary>
/// Retrieves the colour for a <see cref="HitResult"/>. /// Retrieves the colour for a <see cref="HitResult"/>.
/// </summary> /// </summary>
public Color4 TextForHitResult(HitResult judgement) public Color4 ForHitResult(HitResult result)
{
switch (judgement)
{
case HitResult.Perfect:
case HitResult.Great:
return Blue;
case HitResult.Ok:
case HitResult.Good:
return Green;
case HitResult.Meh:
return Yellow;
case HitResult.Miss:
return Red;
default:
return Color4.White;
}
}
public Color4 DrawForHitResult(HitResult result)
{ {
switch (result) switch (result)
{ {

View File

@ -156,7 +156,7 @@ namespace osu.Game.Online.Leaderboards
{ {
Font = OsuFont.Torus.With(size: 12, weight: FontWeight.SemiBold), Font = OsuFont.Torus.With(size: 12, weight: FontWeight.SemiBold),
Text = displayName.ToUpper(), Text = displayName.ToUpper(),
Colour = colours.TextForHitResult(result), Colour = colours.ForHitResult(result),
}, },
new OsuSpriteText new OsuSpriteText
{ {

View File

@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Judgements
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Text = Result.GetDescription().ToUpperInvariant(), Text = Result.GetDescription().ToUpperInvariant(),
Colour = colours.TextForHitResult(Result), Colour = colours.ForHitResult(Result),
Font = OsuFont.Numeric.With(size: 20), Font = OsuFont.Numeric.With(size: 20),
Scale = new Vector2(0.85f, 1), Scale = new Vector2(0.85f, 1),
} }

View File

@ -59,7 +59,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
protected Color4 GetColourForHitResult(HitResult result) protected Color4 GetColourForHitResult(HitResult result)
{ {
return colours.DrawForHitResult(result); return colours.ForHitResult(result);
} }
/// <summary> /// <summary>

View File

@ -23,7 +23,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
HeaderText.Colour = colours.TextForHitResult(Result); HeaderText.Colour = colours.ForHitResult(Result);
} }
} }
} }

View File

@ -243,7 +243,7 @@ namespace osu.Game.Screens.Ranking.Statistics
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
Colour = isCentre && i == 0 ? Color4.White : colours.DrawForHitResult(v.Key), Colour = isCentre && i == 0 ? Color4.White : colours.ForHitResult(v.Key),
Height = 0, Height = 0,
}).ToArray(); }).ToArray();
// The bars of the stacked bar graph will be processed (stacked) from the bottom, which is the base position, // The bars of the stacked bar graph will be processed (stacked) from the bottom, which is the base position,