2022-12-23 19:22:04 +00:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2022-12-24 04:22:36 +00:00
|
|
|
using osu.Framework.Allocation;
|
2022-12-23 19:22:04 +00:00
|
|
|
using osu.Framework.Extensions;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2022-12-24 04:22:36 +00:00
|
|
|
using osu.Game.Graphics;
|
2022-12-23 19:22:04 +00:00
|
|
|
using osu.Game.Rulesets.Scoring;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Judgements
|
|
|
|
{
|
2024-01-25 07:33:52 +00:00
|
|
|
public abstract partial class TextJudgementPiece : CompositeDrawable
|
2022-12-23 19:22:04 +00:00
|
|
|
{
|
|
|
|
protected readonly HitResult Result;
|
|
|
|
|
2022-12-24 04:22:36 +00:00
|
|
|
protected SpriteText JudgementText { get; private set; } = null!;
|
|
|
|
|
|
|
|
[Resolved]
|
|
|
|
private OsuColour colours { get; set; } = null!;
|
2022-12-23 19:22:04 +00:00
|
|
|
|
2024-01-25 07:33:52 +00:00
|
|
|
protected TextJudgementPiece(HitResult result)
|
2022-12-23 19:22:04 +00:00
|
|
|
{
|
|
|
|
Result = result;
|
|
|
|
}
|
|
|
|
|
2022-12-24 04:22:36 +00:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
2022-12-23 19:22:04 +00:00
|
|
|
{
|
2022-12-24 08:37:40 +00:00
|
|
|
AddInternal(JudgementText = CreateJudgementText());
|
2022-12-23 19:22:04 +00:00
|
|
|
|
2022-12-24 04:22:36 +00:00
|
|
|
JudgementText.Colour = colours.ForHitResult(Result);
|
2022-12-23 19:22:04 +00:00
|
|
|
JudgementText.Text = Result.GetDescription().ToUpperInvariant();
|
|
|
|
}
|
2022-12-24 04:22:36 +00:00
|
|
|
|
|
|
|
protected abstract SpriteText CreateJudgementText();
|
2022-12-23 19:22:04 +00:00
|
|
|
}
|
|
|
|
}
|