A game framework written with osu! in mind.

Add `LifetimeChanged` event to `LifetimeEntry`

ekrctb da2b0cc3 7ca5ce9c

+10 -2
+9 -1
osu.Framework/Graphics/Performance/LifetimeEntry.cs
··· 37 37 } 38 38 39 39 /// <summary> 40 - /// Invoked when <see cref="LifetimeStart"/> or <see cref="LifetimeEnd"/> is going to be changed. 40 + /// Invoked before <see cref="LifetimeStart"/> or <see cref="LifetimeEnd"/> changes. 41 + /// It is used because <see cref="LifetimeChanged"/> cannot be used to ensuring comparator stability. 41 42 /// </summary> 42 43 internal event Action<LifetimeEntry> RequestLifetimeUpdate; 44 + 45 + /// <summary> 46 + /// Invoked after <see cref="LifetimeStart"/> or <see cref="LifetimeEnd"/> changes. 47 + /// </summary> 48 + public event Action<LifetimeEntry> LifetimeChanged; 43 49 44 50 /// <summary> 45 51 /// Update <see cref="LifetimeStart"/> of this <see cref="LifetimeEntry"/>. ··· 70 76 71 77 lifetimeStart = start; 72 78 lifetimeEnd = Math.Max(start, end); // Negative intervals are undesired. 79 + 80 + LifetimeChanged?.Invoke(this); 73 81 } 74 82 75 83 /// <summary>
+1 -1
osu.Framework/Graphics/Performance/LifetimeEntryManager.cs
··· 163 163 // Entries in the past/future sets need to be re-sorted to prevent the comparer from becoming unstable. 164 164 // To prevent, e.g. CompositeDrawable alive children changing during enumeration, the entry's state must not be updated immediately. 165 165 // 166 - // In order to achieve the above, the entry is first removed from the past/future set (resolving the comparer stability issues) 166 + // In order to achieve the above, the entry is first removed from the past/future set (resolving the comparator stability issues) 167 167 // and then re-queued back onto the new entries list to be re-processed in the next Update(). 168 168 // 169 169 // Note that this does not apply to entries that are in the current set, as they don't utilise a lifetime comparer.