1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 11:42:54 +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);
// extend the lifetime to cover lighting fade
LifetimeEnd = 1400;
LifetimeEnd = Lighting.LatestTransformEndTime;
}
base.ApplyHitAnimations();

View File

@ -89,7 +89,6 @@ namespace osu.Game.Rulesets.Judgements
/// </remarks>
protected virtual void ApplyMissAnimations()
{
this.Delay(600).FadeOut(200);
}
/// <summary>
@ -111,33 +110,43 @@ namespace osu.Game.Rulesets.Judgements
prepareDrawables();
// not sure if this should remain going forward.
skinnableJudgement.ResetAnimation();
LifetimeStart = Result.TimeAbsolute;
switch (Result.Type)
using (BeginAbsoluteSequence(Result.TimeAbsolute, true))
{
case HitResult.None:
break;
// not sure if this should remain going forward.
skinnableJudgement.ResetAnimation();
case HitResult.Miss:
ApplyMissAnimations();
break;
switch (Result.Type)
{
case HitResult.None:
break;
default:
ApplyHitAnimations();
break;
}
case HitResult.Miss:
ApplyMissAnimations();
break;
default:
ApplyHitAnimations();
break;
}
if (skinnableJudgement.Drawable is IAnimatableJudgement animatable)
{
var drawableAnimation = (Drawable)animatable;
drawableAnimation.ClearTransforms();
if (skinnableJudgement.Drawable is IAnimatableJudgement animatable)
{
using (BeginAbsoluteSequence(Result.TimeAbsolute))
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;

View File

@ -1,12 +1,14 @@
// 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;
namespace osu.Game.Rulesets.Judgements
{
/// <summary>
/// A skinnable judgement element which supports playing an animation from the current point in time.
/// </summary>
public interface IAnimatableJudgement
public interface IAnimatableJudgement : IDrawable
{
void PlayAnimation();
}