From c06db5a54acbb72d90c1a208f35b3e8b289c1fd5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Feb 2020 11:28:29 +0900 Subject: [PATCH] Remove legacy DrawableHitObject state management --- .../Objects/Drawables/DrawableHitObject.cs | 69 +++++-------------- 1 file changed, 17 insertions(+), 52 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 9a5e25c8ac..aa29e42fac 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -221,18 +221,6 @@ namespace osu.Game.Rulesets.Objects.Drawables /// public event Action ApplyCustomUpdateState; -#pragma warning disable 618 // (legacy state management) - can be removed 20200227 - - /// - /// Enables automatic transform management of this hitobject. Implementation of transforms should be done in and only. Rewinding and removing previous states is done automatically. - /// - /// - /// Going forward, this is the preferred way of implementing s. Previous functionality - /// is offered as a compatibility layer until all rulesets have been migrated across. - /// - [Obsolete("Use UpdateInitialTransforms()/UpdateStateTransforms() instead")] // can be removed 20200227 - protected virtual bool UseTransformStateManagement => true; - protected override void ClearInternal(bool disposeChildren = true) => throw new InvalidOperationException($"Should never clear a {nameof(DrawableHitObject)}"); private void updateState(ArmedState newState, bool force = false) @@ -240,35 +228,28 @@ namespace osu.Game.Rulesets.Objects.Drawables if (State.Value == newState && !force) return; - if (UseTransformStateManagement) + LifetimeEnd = double.MaxValue; + + double transformTime = HitObject.StartTime - InitialLifetimeOffset; + + base.ApplyTransformsAt(double.MinValue, true); + base.ClearTransformsAfter(double.MinValue, true); + + using (BeginAbsoluteSequence(transformTime, true)) { - LifetimeEnd = double.MaxValue; + UpdateInitialTransforms(); - double transformTime = HitObject.StartTime - InitialLifetimeOffset; + var judgementOffset = Result?.TimeOffset ?? 0; - base.ApplyTransformsAt(double.MinValue, true); - base.ClearTransformsAfter(double.MinValue, true); - - using (BeginAbsoluteSequence(transformTime, true)) + using (BeginDelayedSequence(InitialLifetimeOffset + judgementOffset, true)) { - UpdateInitialTransforms(); - - var judgementOffset = Result?.TimeOffset ?? 0; - - using (BeginDelayedSequence(InitialLifetimeOffset + judgementOffset, true)) - { - UpdateStateTransforms(newState); - state.Value = newState; - } + UpdateStateTransforms(newState); + state.Value = newState; } - - if (state.Value != ArmedState.Idle && LifetimeEnd == double.MaxValue || HitObject.HitWindows == null) - Expire(); } - else - state.Value = newState; - UpdateState(newState); + if (state.Value != ArmedState.Idle && LifetimeEnd == double.MaxValue || HitObject.HitWindows == null) + Expire(); // apply any custom state overrides ApplyCustomUpdateState?.Invoke(this, newState); @@ -303,30 +284,14 @@ namespace osu.Game.Rulesets.Objects.Drawables public override void ClearTransformsAfter(double time, bool propagateChildren = false, string targetMember = null) { - // When we are using automatic state management, parent calls to this should be blocked for safety. - if (!UseTransformStateManagement) - base.ClearTransformsAfter(time, propagateChildren, targetMember); + // Parent calls to this should be blocked for safety, as we are manually handling this in updateState. } public override void ApplyTransformsAt(double time, bool propagateChildren = false) { - // When we are using automatic state management, parent calls to this should be blocked for safety. - if (!UseTransformStateManagement) - base.ApplyTransformsAt(time, propagateChildren); + // Parent calls to this should be blocked for safety, as we are manually handling this in updateState. } - /// - /// Legacy method to handle state changes. - /// Should generally not be used when is true; use instead. - /// - /// The new armed state. - [Obsolete("Use UpdateInitialTransforms()/UpdateStateTransforms() instead")] // can be removed 20200227 - protected virtual void UpdateState(ArmedState state) - { - } - -#pragma warning restore 618 - #endregion protected sealed override void SkinChanged(ISkinSource skin, bool allowFallback)