mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Replace EntryCrossedBoundary
with more useful RemoveRewoundEntry
property
It can be used for dynamically added entries.
This commit is contained in:
@ -39,6 +39,12 @@ namespace osu.Game.Rulesets.Objects.Pooling
|
||||
/// </remarks>
|
||||
public IEnumerable<(TEntry Entry, TDrawable Drawable)> AliveEntries => aliveDrawableMap.Select(x => (x.Key, x.Value));
|
||||
|
||||
/// <summary>
|
||||
/// Whether to remove an entry when clock goes backward and crossed its <see cref="LifetimeEntry.LifetimeStart"/>.
|
||||
/// Used when entries are dynamically added at its <see cref="LifetimeEntry.LifetimeStart"/> to prevent duplicated entries.
|
||||
/// </summary>
|
||||
protected virtual bool RemoveRewoundEntry => false;
|
||||
|
||||
/// <summary>
|
||||
/// The amount of time prior to the current time within which entries should be considered alive.
|
||||
/// </summary>
|
||||
@ -130,11 +136,10 @@ namespace osu.Game.Rulesets.Objects.Pooling
|
||||
/// </remarks>
|
||||
protected virtual void RemoveDrawable(TEntry entry, TDrawable drawable) => RemoveInternal(drawable);
|
||||
|
||||
private void entryCrossedBoundary(LifetimeEntry lifetimeEntry, LifetimeBoundaryKind kind, LifetimeBoundaryCrossingDirection direction) =>
|
||||
OnEntryCrossedBoundary((TEntry)lifetimeEntry, kind, direction);
|
||||
|
||||
protected virtual void OnEntryCrossedBoundary(TEntry entry, LifetimeBoundaryKind kind, LifetimeBoundaryCrossingDirection direction)
|
||||
private void entryCrossedBoundary(LifetimeEntry lifetimeEntry, LifetimeBoundaryKind kind, LifetimeBoundaryCrossingDirection direction)
|
||||
{
|
||||
if (RemoveRewoundEntry && kind == LifetimeBoundaryKind.Start && direction == LifetimeBoundaryCrossingDirection.Backward)
|
||||
Remove((TEntry)lifetimeEntry);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user