mirror of https://github.com/ppy/osu
Fix judgement animations not resetting on use
This commit is contained in:
parent
dfcb73131d
commit
8a3cadc111
|
@ -62,6 +62,8 @@ protected override void PrepareForUse()
|
|||
|
||||
if (lighting != null)
|
||||
{
|
||||
lighting.ResetAnimation();
|
||||
|
||||
if (JudgedObject != null)
|
||||
{
|
||||
lightingColour = JudgedObject.AccentColour.GetBoundCopy();
|
||||
|
|
|
@ -31,8 +31,10 @@ public class DrawableJudgement : PoolableDrawable
|
|||
public JudgementResult Result { get; private set; }
|
||||
public DrawableHitObject JudgedObject { get; private set; }
|
||||
|
||||
protected Container JudgementBody;
|
||||
protected SpriteText JudgementText;
|
||||
protected Container JudgementBody { get; private set; }
|
||||
protected SpriteText JudgementText { get; private set; }
|
||||
|
||||
private SkinnableDrawable bodyDrawable;
|
||||
|
||||
/// <summary>
|
||||
/// Duration of initial fade in.
|
||||
|
@ -89,6 +91,8 @@ protected override void PrepareForUse()
|
|||
|
||||
prepareDrawables();
|
||||
|
||||
bodyDrawable.ResetAnimation();
|
||||
|
||||
this.FadeInFromZero(FadeInDuration, Easing.OutQuint);
|
||||
JudgementBody.ScaleTo(1);
|
||||
JudgementBody.RotateTo(0);
|
||||
|
@ -131,7 +135,7 @@ private void prepareDrawables()
|
|||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = new SkinnableDrawable(new GameplaySkinComponent<HitResult>(type), _ => JudgementText = new OsuSpriteText
|
||||
Child = bodyDrawable = new SkinnableDrawable(new GameplaySkinComponent<HitResult>(type), _ => JudgementText = new OsuSpriteText
|
||||
{
|
||||
Text = type.GetDescription().ToUpperInvariant(),
|
||||
Font = OsuFont.Numeric.With(size: 20),
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
using System;
|
||||
using osu.Framework.Caching;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Animations;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
|
@ -50,6 +51,11 @@ protected SkinnableDrawable(ISkinComponent component, Func<ISkinSource, bool> al
|
|||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Seeks to the 0-th frame if the content of this <see cref="SkinnableDrawable"/> is an <see cref="IFramedAnimation"/>.
|
||||
/// </summary>
|
||||
public void ResetAnimation() => (Drawable as IFramedAnimation)?.GotoFrame(0);
|
||||
|
||||
private readonly Func<ISkinComponent, Drawable> createDefault;
|
||||
|
||||
private readonly Cached scaling = new Cached();
|
||||
|
|
Loading…
Reference in New Issue