1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 00:53:21 +08:00

Merge pull request #23440 from peppy/drawable-hit-object-sync-animations

Fix hit object animations not being played back in sync
This commit is contained in:
Bartłomiej Dach 2023-05-08 23:44:37 +02:00 committed by GitHub
commit 1d162d1d15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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