1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 19:42:55 +08:00

Handle DrawableJudgement lifetime more flexibly

This commit is contained in:
Dean Herbert 2020-11-18 15:51:09 +09:00
parent 25d4511e49
commit 72a15ef2dc
3 changed files with 34 additions and 23 deletions

View File

@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Lighting.FadeIn(200).Then().Delay(200).FadeOut(1000); Lighting.FadeIn(200).Then().Delay(200).FadeOut(1000);
// extend the lifetime to cover lighting fade // extend the lifetime to cover lighting fade
LifetimeEnd = 1400; LifetimeEnd = Lighting.LatestTransformEndTime;
} }
base.ApplyHitAnimations(); base.ApplyHitAnimations();

View File

@ -89,7 +89,6 @@ namespace osu.Game.Rulesets.Judgements
/// </remarks> /// </remarks>
protected virtual void ApplyMissAnimations() protected virtual void ApplyMissAnimations()
{ {
this.Delay(600).FadeOut(200);
} }
/// <summary> /// <summary>
@ -111,6 +110,10 @@ namespace osu.Game.Rulesets.Judgements
prepareDrawables(); prepareDrawables();
LifetimeStart = Result.TimeAbsolute;
using (BeginAbsoluteSequence(Result.TimeAbsolute, true))
{
// not sure if this should remain going forward. // not sure if this should remain going forward.
skinnableJudgement.ResetAnimation(); skinnableJudgement.ResetAnimation();
@ -130,14 +133,20 @@ namespace osu.Game.Rulesets.Judgements
if (skinnableJudgement.Drawable is IAnimatableJudgement animatable) if (skinnableJudgement.Drawable is IAnimatableJudgement animatable)
{ {
using (BeginAbsoluteSequence(Result.TimeAbsolute)) var drawableAnimation = (Drawable)animatable;
drawableAnimation.ClearTransforms();
animatable.PlayAnimation(); animatable.PlayAnimation();
drawableAnimation.Expire(true);
// a derived version of DrawableJudgement may be adjusting lifetime.
// if not adjusted (or the skinned portion requires greater bounds than calculated) use the skinned source's lifetime.
if (LifetimeEnd == double.MaxValue || drawableAnimation.LifetimeEnd > LifetimeEnd)
LifetimeEnd = drawableAnimation.LifetimeEnd;
}
} }
JudgementBody.Expire(true);
LifetimeStart = JudgementBody.LifetimeStart;
LifetimeEnd = JudgementBody.LifetimeEnd;
} }
private HitResult? currentDrawableType; private HitResult? currentDrawableType;

View File

@ -1,12 +1,14 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
namespace osu.Game.Rulesets.Judgements namespace osu.Game.Rulesets.Judgements
{ {
/// <summary> /// <summary>
/// A skinnable judgement element which supports playing an animation from the current point in time. /// A skinnable judgement element which supports playing an animation from the current point in time.
/// </summary> /// </summary>
public interface IAnimatableJudgement public interface IAnimatableJudgement : IDrawable
{ {
void PlayAnimation(); void PlayAnimation();
} }