1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 03:27:24 +08:00

Add an IAnimationTimeReference to DrawableHitObject to synchronise all animations

This commit is contained in:
Dean Herbert 2023-05-08 18:56:29 +09:00
parent 214bc40570
commit 64498e95a4

View File

@ -30,7 +30,7 @@ using osuTK.Graphics;
namespace osu.Game.Rulesets.Objects.Drawables
{
[Cached(typeof(DrawableHitObject))]
public abstract partial class DrawableHitObject : PoolableDrawableWithLifetime<HitObjectLifetimeEntry>
public abstract partial class DrawableHitObject : PoolableDrawableWithLifetime<HitObjectLifetimeEntry>, IAnimationTimeReference
{
/// <summary>
/// Invoked after this <see cref="DrawableHitObject"/>'s applied <see cref="HitObject"/> has had its defaults applied.
@ -425,11 +425,13 @@ namespace osu.Game.Rulesets.Objects.Drawables
LifetimeEnd = double.MaxValue;
double transformTime = HitObject.StartTime - InitialLifetimeOffset;
clearExistingStateTransforms();
using (BeginAbsoluteSequence(transformTime))
double initialTransformsTime = HitObject.StartTime - InitialLifetimeOffset;
AnimationStartTime.Value = initialTransformsTime;
using (BeginAbsoluteSequence(initialTransformsTime))
UpdateInitialTransforms();
using (BeginAbsoluteSequence(StateUpdateTime))
@ -721,6 +723,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
if (CurrentSkin != null)
CurrentSkin.SourceChanged -= skinSourceChanged;
}
public Bindable<double> AnimationStartTime { get; } = new BindableDouble();
}
public abstract partial class DrawableHitObject<TObject> : DrawableHitObject