mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 05:47:50 +08:00
Add skin support for judgements
This commit is contained in:
parent
bd952ce370
commit
05eb678654
@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
if (Judgement.Result != HitResult.Miss)
|
||||
JudgementText.TransformSpacingTo(new Vector2(14, 0), 1800, Easing.OutQuint);
|
||||
JudgementText?.TransformSpacingTo(new Vector2(14, 0), 1800, Easing.OutQuint);
|
||||
|
||||
base.LoadComplete();
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Skinning;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Judgements
|
||||
{
|
||||
@ -18,9 +20,11 @@ namespace osu.Game.Rulesets.Judgements
|
||||
/// </summary>
|
||||
public class DrawableJudgement : Container
|
||||
{
|
||||
private const float judgement_size = 80;
|
||||
|
||||
protected readonly Judgement Judgement;
|
||||
|
||||
protected readonly SpriteText JudgementText;
|
||||
protected SpriteText JudgementText;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a drawable which visualises a <see cref="Judgements.Judgement"/>.
|
||||
@ -30,31 +34,37 @@ namespace osu.Game.Rulesets.Judgements
|
||||
{
|
||||
Judgement = judgement;
|
||||
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
JudgementText = new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Text = judgement.Result.GetDescription().ToUpper(),
|
||||
Font = @"Venera",
|
||||
Scale = new Vector2(0.85f, 1),
|
||||
TextSize = 12
|
||||
}
|
||||
};
|
||||
Size = new Vector2(judgement_size);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
string legacyName = string.Empty;
|
||||
switch (Judgement.Result)
|
||||
{
|
||||
case HitResult.Miss:
|
||||
Colour = colours.Red;
|
||||
legacyName = "hit0";
|
||||
break;
|
||||
case HitResult.Meh:
|
||||
legacyName = "hit50";
|
||||
break;
|
||||
case HitResult.Good:
|
||||
legacyName = "hit100";
|
||||
break;
|
||||
case HitResult.Great:
|
||||
legacyName = "hit300";
|
||||
break;
|
||||
}
|
||||
|
||||
Child = new SkinnableDrawable($"Play/osu/{legacyName}", _ => JudgementText = new OsuSpriteText
|
||||
{
|
||||
Text = Judgement.Result.GetDescription().ToUpper(),
|
||||
Font = @"Venera",
|
||||
Colour = Judgement.Result == HitResult.Miss ? colours.Red : Color4.White,
|
||||
Scale = new Vector2(0.85f, 1),
|
||||
TextSize = 12
|
||||
}, restrictSize: false);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
|
Loading…
Reference in New Issue
Block a user