1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-22 06:42:55 +08:00

Remove legacy DrawableHitObject state management

This commit is contained in:
Dean Herbert 2020-02-27 11:28:29 +09:00
parent c0b09ece64
commit c06db5a54a

View File

@ -221,18 +221,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// </summary>
public event Action<DrawableHitObject, ArmedState> ApplyCustomUpdateState;
#pragma warning disable 618 // (legacy state management) - can be removed 20200227
/// <summary>
/// Enables automatic transform management of this hitobject. Implementation of transforms should be done in <see cref="UpdateInitialTransforms"/> and <see cref="UpdateStateTransforms"/> only. Rewinding and removing previous states is done automatically.
/// </summary>
/// <remarks>
/// Going forward, this is the preferred way of implementing <see cref="DrawableHitObject"/>s. Previous functionality
/// is offered as a compatibility layer until all rulesets have been migrated across.
/// </remarks>
[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,8 +228,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
if (State.Value == newState && !force)
return;
if (UseTransformStateManagement)
{
LifetimeEnd = double.MaxValue;
double transformTime = HitObject.StartTime - InitialLifetimeOffset;
@ -264,11 +250,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
if (state.Value != ArmedState.Idle && LifetimeEnd == double.MaxValue || HitObject.HitWindows == null)
Expire();
}
else
state.Value = newState;
UpdateState(newState);
// 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.
}
/// <summary>
/// Legacy method to handle state changes.
/// Should generally not be used when <see cref="UseTransformStateManagement"/> is true; use <see cref="UpdateStateTransforms"/> instead.
/// </summary>
/// <param name="state">The new armed state.</param>
[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)