mirror of
https://github.com/ppy/osu.git
synced 2024-11-14 16:37:26 +08:00
refactor(osu.Game): separate OsuColour.ForHitResult
by usage
This commit is contained in:
parent
cbc3627189
commit
5f0832ead7
@ -102,7 +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 ForHitResult(HitResult judgement)
|
public Color4 TextForHitResult(HitResult judgement)
|
||||||
{
|
{
|
||||||
switch (judgement)
|
switch (judgement)
|
||||||
{
|
{
|
||||||
@ -125,6 +125,34 @@ namespace osu.Game.Graphics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Color4 DrawForHitResult(HitResult result)
|
||||||
|
{
|
||||||
|
switch (result)
|
||||||
|
{
|
||||||
|
case HitResult.SmallTickMiss:
|
||||||
|
case HitResult.LargeTickMiss:
|
||||||
|
case HitResult.Miss:
|
||||||
|
return Red;
|
||||||
|
|
||||||
|
case HitResult.Meh:
|
||||||
|
return Yellow;
|
||||||
|
|
||||||
|
case HitResult.Ok:
|
||||||
|
return Green;
|
||||||
|
|
||||||
|
case HitResult.Good:
|
||||||
|
return GreenLight;
|
||||||
|
|
||||||
|
case HitResult.SmallTickHit:
|
||||||
|
case HitResult.LargeTickHit:
|
||||||
|
case HitResult.Great:
|
||||||
|
return Blue;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return BlueLight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves a colour for the given <see cref="BeatmapOnlineStatus"/>.
|
/// Retrieves a colour for the given <see cref="BeatmapOnlineStatus"/>.
|
||||||
/// A <see langword="null"/> value indicates that a "background" shade from the local <see cref="OverlayColourProvider"/>
|
/// A <see langword="null"/> value indicates that a "background" shade from the local <see cref="OverlayColourProvider"/>
|
||||||
|
@ -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.ForHitResult(result),
|
Colour = colours.TextForHitResult(result),
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
|
@ -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.ForHitResult(Result),
|
Colour = colours.TextForHitResult(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),
|
||||||
}
|
}
|
||||||
|
@ -59,30 +59,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
|
|
||||||
protected Color4 GetColourForHitResult(HitResult result)
|
protected Color4 GetColourForHitResult(HitResult result)
|
||||||
{
|
{
|
||||||
switch (result)
|
return colours.DrawForHitResult(result);
|
||||||
{
|
|
||||||
case HitResult.SmallTickMiss:
|
|
||||||
case HitResult.LargeTickMiss:
|
|
||||||
case HitResult.Miss:
|
|
||||||
return colours.Red;
|
|
||||||
|
|
||||||
case HitResult.Meh:
|
|
||||||
return colours.Yellow;
|
|
||||||
|
|
||||||
case HitResult.Ok:
|
|
||||||
return colours.Green;
|
|
||||||
|
|
||||||
case HitResult.Good:
|
|
||||||
return colours.GreenLight;
|
|
||||||
|
|
||||||
case HitResult.SmallTickHit:
|
|
||||||
case HitResult.LargeTickHit:
|
|
||||||
case HitResult.Great:
|
|
||||||
return colours.Blue;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return colours.BlueLight;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -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.ForHitResult(Result);
|
HeaderText.Colour = colours.TextForHitResult(Result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user