diff --git a/osu.Game.Rulesets.Catch/UI/CatcherTrailEntry.cs b/osu.Game.Rulesets.Catch/UI/CatcherTrailEntry.cs index 3a40ab26ccce..86fd5cde898f 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherTrailEntry.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherTrailEntry.cs @@ -2,11 +2,12 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics.Performance; + using osuTK; namespace osu.Game.Rulesets.Catch.UI { - public class CatcherTrailEntry : LifetimeEntry + public class CatcherTrailEntry : LifetimeEntryBase { public readonly CatcherAnimationState CatcherState; diff --git a/osu.Game.Rulesets.Catch/UI/HitExplosionEntry.cs b/osu.Game.Rulesets.Catch/UI/HitExplosionEntry.cs index f265da149aa3..6b97c9750259 100644 --- a/osu.Game.Rulesets.Catch/UI/HitExplosionEntry.cs +++ b/osu.Game.Rulesets.Catch/UI/HitExplosionEntry.cs @@ -4,11 +4,12 @@ using osu.Framework.Graphics.Performance; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Judgements; + using osuTK.Graphics; namespace osu.Game.Rulesets.Catch.UI { - public class HitExplosionEntry : LifetimeEntry + public class HitExplosionEntry : LifetimeEntryBase { /// /// The judgement result that triggered this explosion. diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointLifetimeEntry.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointLifetimeEntry.cs index cbec5efda7e3..c8d0617155e7 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointLifetimeEntry.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointLifetimeEntry.cs @@ -3,14 +3,16 @@ using System; using System.Diagnostics; + using osu.Framework.Bindables; using osu.Framework.Graphics.Performance; using osu.Game.Rulesets.Objects; + using osuTK; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections { - public class FollowPointLifetimeEntry : LifetimeEntry + public class FollowPointLifetimeEntry : LifetimeEntryBase { public event Action? Invalidated; public readonly OsuHitObject Start; diff --git a/osu.Game/Rulesets/Objects/HitObjectLifetimeEntry.cs b/osu.Game/Rulesets/Objects/HitObjectLifetimeEntry.cs index 4962ac13b5eb..1ba29e5bf772 100644 --- a/osu.Game/Rulesets/Objects/HitObjectLifetimeEntry.cs +++ b/osu.Game/Rulesets/Objects/HitObjectLifetimeEntry.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; + using osu.Framework.Bindables; using osu.Framework.Graphics.Performance; using osu.Game.Rulesets.Judgements; @@ -11,9 +12,9 @@ namespace osu.Game.Rulesets.Objects { /// - /// A that stores the lifetime for a . + /// A that stores the lifetime for a . /// - public class HitObjectLifetimeEntry : LifetimeEntry + public class HitObjectLifetimeEntry : LifetimeEntryBase { /// /// The . @@ -122,12 +123,12 @@ internal bool KeepAlive /// /// /// This is only used as an optimisation to delay the initial application of the to a . - /// A more accurate should be set on the hit object application, for further optimisation. + /// A more accurate should be set on the hit object application, for further optimisation. /// protected virtual double InitialLifetimeOffset => 10000; /// - /// Set using . + /// Set using . /// internal void SetInitialLifetime() => LifetimeStart = HitObject.StartTime - InitialLifetimeOffset; diff --git a/osu.Game/Rulesets/Objects/Pooling/PoolableDrawableWithLifetime.cs b/osu.Game/Rulesets/Objects/Pooling/PoolableDrawableWithLifetime.cs index a06f810cfeb3..1e7243c8b457 100644 --- a/osu.Game/Rulesets/Objects/Pooling/PoolableDrawableWithLifetime.cs +++ b/osu.Game/Rulesets/Objects/Pooling/PoolableDrawableWithLifetime.cs @@ -3,6 +3,7 @@ using System; using System.Diagnostics; + using osu.Framework.Graphics; using osu.Framework.Graphics.Performance; using osu.Framework.Graphics.Pooling; @@ -12,8 +13,8 @@ namespace osu.Game.Rulesets.Objects.Pooling /// /// A that is controlled by to implement drawable pooling and replay rewinding. /// - /// The type storing state and controlling this drawable. - public abstract partial class PoolableDrawableWithLifetime : PoolableDrawable where TEntry : LifetimeEntry + /// The type storing state and controlling this drawable. + public abstract partial class PoolableDrawableWithLifetime : PoolableDrawable where TEntry : LifetimeEntryBase { private TEntry? entry; @@ -150,7 +151,7 @@ private void free() HasEntryApplied = false; } - private void setLifetimeFromEntry(LifetimeEntry entry) + private void setLifetimeFromEntry(TEntry entry) { Debug.Assert(entry == Entry); base.LifetimeStart = entry.LifetimeStart; diff --git a/osu.Game/Rulesets/Objects/Pooling/PooledDrawableWithLifetimeContainer.cs b/osu.Game/Rulesets/Objects/Pooling/PooledDrawableWithLifetimeContainer.cs index efc10f26e16f..5b2d349cc6a2 100644 --- a/osu.Game/Rulesets/Objects/Pooling/PooledDrawableWithLifetimeContainer.cs +++ b/osu.Game/Rulesets/Objects/Pooling/PooledDrawableWithLifetimeContainer.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; + using osu.Framework.Extensions.ListExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -20,7 +21,7 @@ namespace osu.Game.Rulesets.Objects.Pooling /// The type of entries managed by this container. /// The type of drawables corresponding to the entries. public abstract partial class PooledDrawableWithLifetimeContainer : CompositeDrawable - where TEntry : LifetimeEntry + where TEntry : LifetimeEntryBase where TDrawable : Drawable { /// @@ -40,8 +41,8 @@ public abstract partial class PooledDrawableWithLifetimeContainer AliveEntries; /// - /// Whether to remove an entry when clock goes backward and crossed its . - /// Used when entries are dynamically added at its to prevent duplicated entries. + /// Whether to remove an entry when clock goes backward and crossed its . + /// Used when entries are dynamically added at its to prevent duplicated entries. /// protected virtual bool RemoveRewoundEntry => false; @@ -58,7 +59,7 @@ public abstract partial class PooledDrawableWithLifetimeContainer aliveDrawableMap = new Dictionary(); private readonly HashSet allEntries = new HashSet(); - private readonly LifetimeEntryManager lifetimeManager = new LifetimeEntryManager(); + private readonly LifetimeEntryManager lifetimeManager = new(); protected PooledDrawableWithLifetimeContainer() { @@ -102,9 +103,9 @@ public virtual bool Remove(TEntry entry) /// The corresponding to the entry. protected abstract TDrawable GetDrawable(TEntry entry); - private void entryBecameAlive(LifetimeEntry lifetimeEntry) + private void entryBecameAlive(TEntry lifetimeEntry) { - var entry = (TEntry)lifetimeEntry; + var entry = lifetimeEntry; Debug.Assert(!aliveDrawableMap.ContainsKey(entry)); TDrawable drawable = GetDrawable(entry); @@ -120,9 +121,9 @@ private void entryBecameAlive(LifetimeEntry lifetimeEntry) /// protected virtual void AddDrawable(TEntry entry, TDrawable drawable) => AddInternal(drawable); - private void entryBecameDead(LifetimeEntry lifetimeEntry) + private void entryBecameDead(TEntry lifetimeEntry) { - var entry = (TEntry)lifetimeEntry; + var entry = lifetimeEntry; Debug.Assert(aliveDrawableMap.ContainsKey(entry)); TDrawable drawable = aliveDrawableMap[entry]; @@ -138,10 +139,10 @@ private void entryBecameDead(LifetimeEntry lifetimeEntry) /// protected virtual void RemoveDrawable(TEntry entry, TDrawable drawable) => RemoveInternal(drawable, false); - private void entryCrossedBoundary(LifetimeEntry lifetimeEntry, LifetimeBoundaryKind kind, LifetimeBoundaryCrossingDirection direction) + private void entryCrossedBoundary(TEntry lifetimeEntry, LifetimeBoundaryKind kind, LifetimeBoundaryCrossingDirection direction) { if (RemoveRewoundEntry && kind == LifetimeBoundaryKind.Start && direction == LifetimeBoundaryCrossingDirection.Backward) - Remove((TEntry)lifetimeEntry); + Remove(lifetimeEntry); } ///