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.Allocation;
|
|
|
|
using osu.Framework.Extensions;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Judgements
|
|
|
|
{
|
|
|
|
public class DefaultJudgementPiece : CompositeDrawable, IAnimatableJudgement
|
|
|
|
{
|
2020-11-17 14:43:54 +08:00
|
|
|
protected readonly HitResult Result;
|
|
|
|
|
|
|
|
protected SpriteText JudgementText { get; private set; }
|
2020-11-17 13:59:34 +08:00
|
|
|
|
|
|
|
[Resolved]
|
|
|
|
private OsuColour colours { get; set; }
|
|
|
|
|
2020-11-17 14:43:54 +08:00
|
|
|
public DefaultJudgementPiece(HitResult result)
|
2020-11-17 13:59:34 +08:00
|
|
|
{
|
2020-11-18 03:11:13 +08:00
|
|
|
Result = result;
|
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
|
|
|
|
2020-11-17 14:43:54 +08:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
2020-11-17 13:59:34 +08:00
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
|
|
|
JudgementText = new OsuSpriteText
|
|
|
|
{
|
2021-01-14 11:33:33 +08:00
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
2020-11-17 14:43:54 +08:00
|
|
|
Text = Result.GetDescription().ToUpperInvariant(),
|
|
|
|
Colour = colours.ForHitResult(Result),
|
2020-11-17 13:59:34 +08:00
|
|
|
Font = OsuFont.Numeric.With(size: 20),
|
|
|
|
Scale = new Vector2(0.85f, 1),
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-11-17 14:43:54 +08:00
|
|
|
public virtual void PlayAnimation()
|
2020-11-17 13:59:34 +08:00
|
|
|
{
|
2020-11-17 14:43:54 +08:00
|
|
|
switch (Result)
|
2020-11-17 13:59:34 +08:00
|
|
|
{
|
|
|
|
case HitResult.Miss:
|
|
|
|
this.ScaleTo(1.6f);
|
|
|
|
this.ScaleTo(1, 100, Easing.In);
|
|
|
|
|
2020-11-18 16:15:45 +08:00
|
|
|
this.MoveTo(Vector2.Zero);
|
2020-11-17 13:59:34 +08:00
|
|
|
this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint);
|
|
|
|
|
2020-11-18 16:15:45 +08:00
|
|
|
this.RotateTo(0);
|
2020-11-17 13:59:34 +08:00
|
|
|
this.RotateTo(40, 800, Easing.InQuint);
|
2020-11-18 16:15:45 +08:00
|
|
|
|
2020-11-17 13:59:34 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
this.ScaleTo(0.9f);
|
|
|
|
this.ScaleTo(1, 500, Easing.OutElastic);
|
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
|
2020-11-20 15:30:58 +08:00
|
|
|
public Drawable GetAboveHitObjectsProxiedContent() => null;
|
2020-11-17 13:59:34 +08:00
|
|
|
}
|
|
|
|
}
|