Fix setting lifetime during KeepAlive is ignored

This commit is contained in:
ekrctb
2021-05-04 16:56:48 +09:00
parent 4a93e27e83
commit aa42cf2fc0

View File

@ -32,12 +32,11 @@ namespace osu.Game.Rulesets.Objects.Pooling
get => Entry?.LifetimeStart ?? double.MinValue; get => Entry?.LifetimeStart ?? double.MinValue;
set set
{ {
if (LifetimeStart == value) return; if (Entry == null && LifetimeStart != value)
if (Entry == null)
throw new InvalidOperationException($"Cannot modify lifetime of {nameof(PoolableDrawableWithLifetime<TEntry>)} when entry is not set"); throw new InvalidOperationException($"Cannot modify lifetime of {nameof(PoolableDrawableWithLifetime<TEntry>)} when entry is not set");
Entry.LifetimeStart = value; if (Entry != null)
Entry.LifetimeStart = value;
} }
} }
@ -46,12 +45,11 @@ namespace osu.Game.Rulesets.Objects.Pooling
get => Entry?.LifetimeEnd ?? double.MaxValue; get => Entry?.LifetimeEnd ?? double.MaxValue;
set set
{ {
if (LifetimeEnd == value) return; if (Entry == null && LifetimeEnd != value)
if (Entry == null)
throw new InvalidOperationException($"Cannot modify lifetime of {nameof(PoolableDrawableWithLifetime<TEntry>)} when entry is not set"); throw new InvalidOperationException($"Cannot modify lifetime of {nameof(PoolableDrawableWithLifetime<TEntry>)} when entry is not set");
Entry.LifetimeEnd = value; if (Entry != null)
Entry.LifetimeEnd = value;
} }
} }