mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 20:25:39 +08:00
Fix wrong InitialLifetimeOffset is used for a non-pooled DHO.
HitObjectLifetimeEntry's InitialLifetimeOffset is different from DrawableHitObject's InitialLifetimeOffset.
This commit is contained in:
parent
e80c3c317a
commit
67fcfd9dbc
@ -172,7 +172,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
{
|
{
|
||||||
if (initialHitObject != null)
|
if (initialHitObject != null)
|
||||||
{
|
{
|
||||||
lifetimeEntry = new SyntheticHitObjectEntry(initialHitObject);
|
lifetimeEntry = new SyntheticHitObjectEntry(initialHitObject, initialHitObject.StartTime - InitialLifetimeOffset);
|
||||||
ensureEntryHasResult();
|
ensureEntryHasResult();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,7 +227,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
if (hitObject == null)
|
if (hitObject == null)
|
||||||
throw new ArgumentNullException($"Cannot apply a null {nameof(HitObject)}.");
|
throw new ArgumentNullException($"Cannot apply a null {nameof(HitObject)}.");
|
||||||
|
|
||||||
Apply(new SyntheticHitObjectEntry(hitObject));
|
Apply(new SyntheticHitObjectEntry(hitObject, hitObject.StartTime - InitialLifetimeOffset));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -30,12 +30,17 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
/// Creates a new <see cref="HitObjectLifetimeEntry"/>.
|
/// Creates a new <see cref="HitObjectLifetimeEntry"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="hitObject">The <see cref="HitObject"/> to store the lifetime of.</param>
|
/// <param name="hitObject">The <see cref="HitObject"/> to store the lifetime of.</param>
|
||||||
public HitObjectLifetimeEntry(HitObject hitObject)
|
/// <param name="lifetimeStart">The <see cref="LifetimeStart"/>.</param>
|
||||||
|
/// <param name="lifetimeEnd">The <see cref="LifetimeEnd"/>.</param>
|
||||||
|
public HitObjectLifetimeEntry(HitObject hitObject, double lifetimeStart = double.MinValue, double lifetimeEnd = double.MaxValue)
|
||||||
{
|
{
|
||||||
HitObject = hitObject;
|
HitObject = hitObject;
|
||||||
|
|
||||||
startTimeBindable.BindTo(HitObject.StartTimeBindable);
|
startTimeBindable.BindTo(HitObject.StartTimeBindable);
|
||||||
startTimeBindable.BindValueChanged(onStartTimeChanged, true);
|
// Only set initial lifetime if it is not provided
|
||||||
|
startTimeBindable.BindValueChanged(onStartTimeChanged, lifetimeStart == double.MinValue);
|
||||||
|
|
||||||
|
setLifetime(lifetimeStart, lifetimeEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The lifetime start, as set by the hitobject.
|
// The lifetime start, as set by the hitobject.
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects
|
namespace osu.Game.Rulesets.Objects
|
||||||
@ -11,8 +13,8 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal class SyntheticHitObjectEntry : HitObjectLifetimeEntry
|
internal class SyntheticHitObjectEntry : HitObjectLifetimeEntry
|
||||||
{
|
{
|
||||||
public SyntheticHitObjectEntry(HitObject hitObject)
|
public SyntheticHitObjectEntry(HitObject hitObject, double initialLifetimeStart)
|
||||||
: base(hitObject)
|
: base(hitObject, initialLifetimeStart)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user