mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 07:32:55 +08:00
Adopt framework change of LifetimeEntry
Override SetLifetimeStart/SetLifetimeEnd separately to track individual assignment. It is necessary to ensure real lifetime is not lost when lifetime is partially updated.
This commit is contained in:
parent
c9e6ca5378
commit
3899e500d3
@ -42,11 +42,22 @@ namespace osu.Game.Rulesets.Objects
|
||||
private double realLifetimeStart = double.MinValue;
|
||||
private double realLifetimeEnd = double.MaxValue;
|
||||
|
||||
public override void SetLifetime(double start, double end)
|
||||
// This method is called even if `start == LifetimeStart` when `KeepAlive` is true (necessary to update `realLifetimeStart`).
|
||||
protected override void SetLifetimeStart(double start)
|
||||
{
|
||||
// This assignment cannot be done in `SetLifetime` because otherwise setting only `LifetimeStart` will make `realLifetimeEnd` to be lost.
|
||||
realLifetimeStart = start;
|
||||
realLifetimeEnd = end;
|
||||
base.SetLifetimeStart(start);
|
||||
}
|
||||
|
||||
protected override void SetLifetimeEnd(double end)
|
||||
{
|
||||
realLifetimeEnd = end;
|
||||
base.SetLifetimeEnd(end);
|
||||
}
|
||||
|
||||
protected override void SetLifetime(double start, double end)
|
||||
{
|
||||
if (keepAlive)
|
||||
base.SetLifetime(double.MinValue, double.MaxValue);
|
||||
else
|
||||
|
@ -100,7 +100,11 @@ namespace osu.Game.Rulesets.Objects.Pooling
|
||||
base.LifetimeStart = start;
|
||||
base.LifetimeEnd = end;
|
||||
|
||||
Entry?.SetLifetime(start, end);
|
||||
if (Entry != null)
|
||||
{
|
||||
Entry.LifetimeStart = start;
|
||||
Entry.LifetimeEnd = end;
|
||||
}
|
||||
}
|
||||
|
||||
private void free()
|
||||
|
Loading…
Reference in New Issue
Block a user