mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 09:07:25 +08:00
Add legacy judgement implementation which doesn't transform on animations
This commit is contained in:
parent
8247e6ce91
commit
dd4b69feab
58
osu.Game/Skinning/LegacyJudgementPiece.cs
Normal file
58
osu.Game/Skinning/LegacyJudgementPiece.cs
Normal file
@ -0,0 +1,58 @@
|
||||
// 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;
|
||||
using osu.Framework.Graphics.Animations;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public class LegacyJudgementPiece : CompositeDrawable, IAnimatableJudgement
|
||||
{
|
||||
private readonly HitResult result;
|
||||
|
||||
public LegacyJudgementPiece(HitResult result, Drawable texture)
|
||||
{
|
||||
this.result = result;
|
||||
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
InternalChild = texture;
|
||||
}
|
||||
|
||||
public virtual void PlayAnimation()
|
||||
{
|
||||
var animation = InternalChild as IFramedAnimation;
|
||||
|
||||
animation?.GotoFrame(0);
|
||||
|
||||
this.RotateTo(0);
|
||||
this.MoveTo(Vector2.Zero);
|
||||
|
||||
// legacy judgements don't play any transforms if they are an animation.
|
||||
if (animation?.FrameCount > 1)
|
||||
return;
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case HitResult.Miss:
|
||||
this.ScaleTo(1.6f);
|
||||
this.ScaleTo(1, 100, Easing.In);
|
||||
|
||||
this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint);
|
||||
|
||||
this.RotateTo(40, 800, Easing.InQuint);
|
||||
break;
|
||||
|
||||
default:
|
||||
this.ScaleTo(0.9f);
|
||||
this.ScaleTo(1, 500, Easing.OutElastic);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -371,7 +371,19 @@ namespace osu.Game.Skinning
|
||||
}
|
||||
|
||||
case GameplaySkinComponent<HitResult> resultComponent:
|
||||
switch (resultComponent.Component)
|
||||
var drawable = getJudgementAnimation(resultComponent.Component);
|
||||
if (drawable != null)
|
||||
return new LegacyJudgementPiece(resultComponent.Component, drawable);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return this.GetAnimation(component.LookupName, false, false);
|
||||
}
|
||||
|
||||
private Drawable getJudgementAnimation(HitResult result)
|
||||
{
|
||||
switch (result)
|
||||
{
|
||||
case HitResult.Miss:
|
||||
return this.GetAnimation("hit0", true, false);
|
||||
@ -386,10 +398,7 @@ namespace osu.Game.Skinning
|
||||
return this.GetAnimation("hit300", true, false);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return this.GetAnimation(component.LookupName, false, false);
|
||||
return null;
|
||||
}
|
||||
|
||||
public override Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT)
|
||||
|
Loading…
Reference in New Issue
Block a user