2022-12-24 03:22:04 +08: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 12:22:36 +08:00
|
|
|
using osu.Framework.Allocation;
|
2022-12-24 03:22:04 +08:00
|
|
|
using osu.Framework.Extensions;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2022-12-24 12:22:36 +08:00
|
|
|
using osu.Game.Graphics;
|
2022-12-24 03:22:04 +08:00
|
|
|
using osu.Game.Rulesets.Scoring;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Judgements
|
|
|
|
{
|
2024-01-25 15:33:52 +08:00
|
|
|
public abstract partial class TextJudgementPiece : CompositeDrawable
|
2022-12-24 03:22:04 +08:00
|
|
|
{
|
|
|
|
protected readonly HitResult Result;
|
|
|
|
|
2022-12-24 12:22:36 +08:00
|
|
|
protected SpriteText JudgementText { get; private set; } = null!;
|
|
|
|
|
|
|
|
[Resolved]
|
|
|
|
private OsuColour colours { get; set; } = null!;
|
2022-12-24 03:22:04 +08:00
|
|
|
|
2024-01-25 15:33:52 +08:00
|
|
|
protected TextJudgementPiece(HitResult result)
|
2022-12-24 03:22:04 +08:00
|
|
|
{
|
|
|
|
Result = result;
|
|
|
|
}
|
|
|
|
|
2022-12-24 12:22:36 +08:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
2022-12-24 03:22:04 +08:00
|
|
|
{
|
2022-12-24 16:37:40 +08:00
|
|
|
AddInternal(JudgementText = CreateJudgementText());
|
2022-12-24 03:22:04 +08:00
|
|
|
|
2022-12-24 12:22:36 +08:00
|
|
|
JudgementText.Colour = colours.ForHitResult(Result);
|
2022-12-24 03:22:04 +08:00
|
|
|
JudgementText.Text = Result.GetDescription().ToUpperInvariant();
|
|
|
|
}
|
2022-12-24 12:22:36 +08:00
|
|
|
|
|
|
|
protected abstract SpriteText CreateJudgementText();
|
2022-12-24 03:22:04 +08:00
|
|
|
}
|
|
|
|
}
|