2020-11-17 13:59:34 +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.
|
|
|
|
|
|
|
|
using osu.Framework.Graphics;
|
2022-12-24 12:22:36 +08:00
|
|
|
using osu.Framework.Graphics.Sprites;
|
2020-11-17 13:59:34 +08:00
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Judgements
|
|
|
|
{
|
2022-12-24 03:22:04 +08:00
|
|
|
public partial class DefaultJudgementPiece : JudgementPiece, IAnimatableJudgement
|
2020-11-17 13:59:34 +08:00
|
|
|
{
|
2020-11-17 14:43:54 +08:00
|
|
|
public DefaultJudgementPiece(HitResult result)
|
2022-12-24 03:22:04 +08:00
|
|
|
: base(result)
|
2020-11-17 13:59:34 +08:00
|
|
|
{
|
2022-12-24 12:22:36 +08:00
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
2020-11-17 13:59:34 +08:00
|
|
|
Origin = Anchor.Centre;
|
2020-11-17 14:43:54 +08:00
|
|
|
}
|
2020-11-17 13:59:34 +08:00
|
|
|
|
2022-12-24 12:22:36 +08:00
|
|
|
protected override SpriteText CreateJudgementText() =>
|
|
|
|
new OsuSpriteText
|
2020-11-17 13:59:34 +08:00
|
|
|
{
|
2022-12-24 12:22:36 +08:00
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Font = OsuFont.Numeric.With(size: 20),
|
|
|
|
Scale = new Vector2(0.85f, 1),
|
2020-11-17 13:59:34 +08:00
|
|
|
};
|
|
|
|
|
2021-09-02 15:31:43 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Plays the default animation for this judgement piece.
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// The base implementation only handles fade (for all result types) and misses.
|
|
|
|
/// Individual rulesets are recommended to implement their appropriate hit animations.
|
|
|
|
/// </remarks>
|
2020-11-17 14:43:54 +08:00
|
|
|
public virtual void PlayAnimation()
|
2020-11-17 13:59:34 +08:00
|
|
|
{
|
2023-12-25 16:32:30 +08:00
|
|
|
// TODO: make these better. currently they are using a text `-` and it's not centered properly.
|
|
|
|
// Should be an explicit drawable.
|
|
|
|
//
|
|
|
|
// When this is done, remove the [Description] attributes from HitResults which were added for this purpose.
|
|
|
|
if (Result == HitResult.IgnoreMiss || Result == HitResult.LargeTickMiss)
|
|
|
|
{
|
|
|
|
this.RotateTo(-45);
|
|
|
|
this.ScaleTo(1.8f);
|
|
|
|
this.ScaleTo(1.2f, 100, Easing.In);
|
|
|
|
|
|
|
|
this.MoveTo(Vector2.Zero);
|
|
|
|
this.MoveToOffset(new Vector2(0, 10), 800, Easing.InQuint);
|
|
|
|
}
|
|
|
|
else if (Result.IsMiss())
|
2020-11-17 13:59:34 +08:00
|
|
|
{
|
2023-12-20 19:23:19 +08:00
|
|
|
this.ScaleTo(1.6f);
|
|
|
|
this.ScaleTo(1, 100, Easing.In);
|
2020-11-17 13:59:34 +08:00
|
|
|
|
2023-12-20 19:23:19 +08:00
|
|
|
this.MoveTo(Vector2.Zero);
|
|
|
|
this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint);
|
2020-11-17 13:59:34 +08:00
|
|
|
|
2023-12-20 19:23:19 +08:00
|
|
|
this.RotateTo(0);
|
|
|
|
this.RotateTo(40, 800, Easing.InQuint);
|
2020-11-17 13:59:34 +08:00
|
|
|
}
|
2020-11-18 16:15:45 +08:00
|
|
|
|
|
|
|
this.FadeOutFromOne(800);
|
2020-11-17 13:59:34 +08:00
|
|
|
}
|
2020-11-20 15:14:38 +08:00
|
|
|
|
2022-12-24 12:22:36 +08:00
|
|
|
public Drawable? GetAboveHitObjectsProxiedContent() => null;
|
2020-11-17 13:59:34 +08:00
|
|
|
}
|
|
|
|
}
|