mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 20:53:04 +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()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
if (Judgement.Result != HitResult.Miss)
|
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();
|
base.LoadComplete();
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,8 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Judgements
|
namespace osu.Game.Rulesets.Judgements
|
||||||
{
|
{
|
||||||
@ -18,9 +20,11 @@ namespace osu.Game.Rulesets.Judgements
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class DrawableJudgement : Container
|
public class DrawableJudgement : Container
|
||||||
{
|
{
|
||||||
|
private const float judgement_size = 80;
|
||||||
|
|
||||||
protected readonly Judgement Judgement;
|
protected readonly Judgement Judgement;
|
||||||
|
|
||||||
protected readonly SpriteText JudgementText;
|
protected SpriteText JudgementText;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a drawable which visualises a <see cref="Judgements.Judgement"/>.
|
/// Creates a drawable which visualises a <see cref="Judgements.Judgement"/>.
|
||||||
@ -30,31 +34,37 @@ namespace osu.Game.Rulesets.Judgements
|
|||||||
{
|
{
|
||||||
Judgement = judgement;
|
Judgement = judgement;
|
||||||
|
|
||||||
AutoSizeAxes = Axes.Both;
|
Size = new Vector2(judgement_size);
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
|
string legacyName = string.Empty;
|
||||||
switch (Judgement.Result)
|
switch (Judgement.Result)
|
||||||
{
|
{
|
||||||
case HitResult.Miss:
|
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;
|
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()
|
protected override void LoadComplete()
|
||||||
|
Loading…
Reference in New Issue
Block a user