mirror of https://github.com/ppy/osu
Use DHO.HitObjectApplied to invalidate computation
This commit is contained in:
parent
f6faf95e33
commit
e43f928588
|
@ -147,7 +147,10 @@ private void flipPositionIfRequired(ref float position)
|
|||
}
|
||||
}
|
||||
|
||||
private void onHitObjectUsageBegin(DrawableHitObject hitObject)
|
||||
/// <summary>
|
||||
/// Make this <see cref="DrawableHitObject"/> lifetime and layout computed in next update.
|
||||
/// </summary>
|
||||
internal void InvalidateHitObject(DrawableHitObject hitObject)
|
||||
{
|
||||
// Lifetime computation is delayed until next update because
|
||||
// when the hit object is not pooled this container is not loaded here and `scrollLength` cannot be computed.
|
||||
|
|
|
@ -15,6 +15,8 @@ public abstract class ScrollingPlayfield : Playfield
|
|||
{
|
||||
protected readonly IBindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
|
||||
|
||||
public new ScrollingHitObjectContainer HitObjectContainer => (ScrollingHitObjectContainer)base.HitObjectContainer;
|
||||
|
||||
[Resolved]
|
||||
protected IScrollingInfo ScrollingInfo { get; private set; }
|
||||
|
||||
|
@ -24,17 +26,20 @@ private void load()
|
|||
Direction.BindTo(ScrollingInfo.Direction);
|
||||
}
|
||||
|
||||
protected override void OnNewDrawableHitObject(DrawableHitObject drawableHitObject)
|
||||
{
|
||||
drawableHitObject.HitObjectApplied += d => HitObjectContainer.InvalidateHitObject(d);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Given a position in screen space, return the time within this column.
|
||||
/// </summary>
|
||||
public virtual double TimeAtScreenSpacePosition(Vector2 screenSpacePosition) =>
|
||||
((ScrollingHitObjectContainer)HitObjectContainer).TimeAtScreenSpacePosition(screenSpacePosition);
|
||||
public virtual double TimeAtScreenSpacePosition(Vector2 screenSpacePosition) => HitObjectContainer.TimeAtScreenSpacePosition(screenSpacePosition);
|
||||
|
||||
/// <summary>
|
||||
/// Given a time, return the screen space position within this column.
|
||||
/// </summary>
|
||||
public virtual Vector2 ScreenSpacePositionAtTime(double time)
|
||||
=> ((ScrollingHitObjectContainer)HitObjectContainer).ScreenSpacePositionAtTime(time);
|
||||
public virtual Vector2 ScreenSpacePositionAtTime(double time) => HitObjectContainer.ScreenSpacePositionAtTime(time);
|
||||
|
||||
protected sealed override HitObjectContainer CreateHitObjectContainer() => new ScrollingHitObjectContainer();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue