mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 16:43:00 +08:00
Handle DrawableJudgement lifetime more flexibly
This commit is contained in:
parent
25d4511e49
commit
72a15ef2dc
@ -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();
|
||||||
|
@ -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,33 +110,43 @@ namespace osu.Game.Rulesets.Judgements
|
|||||||
|
|
||||||
prepareDrawables();
|
prepareDrawables();
|
||||||
|
|
||||||
// not sure if this should remain going forward.
|
LifetimeStart = Result.TimeAbsolute;
|
||||||
skinnableJudgement.ResetAnimation();
|
|
||||||
|
|
||||||
switch (Result.Type)
|
using (BeginAbsoluteSequence(Result.TimeAbsolute, true))
|
||||||
{
|
{
|
||||||
case HitResult.None:
|
// not sure if this should remain going forward.
|
||||||
break;
|
skinnableJudgement.ResetAnimation();
|
||||||
|
|
||||||
case HitResult.Miss:
|
switch (Result.Type)
|
||||||
ApplyMissAnimations();
|
{
|
||||||
break;
|
case HitResult.None:
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
case HitResult.Miss:
|
||||||
ApplyHitAnimations();
|
ApplyMissAnimations();
|
||||||
break;
|
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();
|
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;
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user