mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 12:42:54 +08:00
Use DHO.HitObjectApplied to invalidate computation
This commit is contained in:
parent
f6faf95e33
commit
e43f928588
@ -147,7 +147,10 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
// 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.
|
// when the hit object is not pooled this container is not loaded here and `scrollLength` cannot be computed.
|
||||||
|
@ -15,6 +15,8 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
{
|
{
|
||||||
protected readonly IBindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
|
protected readonly IBindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
|
||||||
|
|
||||||
|
public new ScrollingHitObjectContainer HitObjectContainer => (ScrollingHitObjectContainer)base.HitObjectContainer;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
protected IScrollingInfo ScrollingInfo { get; private set; }
|
protected IScrollingInfo ScrollingInfo { get; private set; }
|
||||||
|
|
||||||
@ -24,17 +26,20 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
Direction.BindTo(ScrollingInfo.Direction);
|
Direction.BindTo(ScrollingInfo.Direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnNewDrawableHitObject(DrawableHitObject drawableHitObject)
|
||||||
|
{
|
||||||
|
drawableHitObject.HitObjectApplied += d => HitObjectContainer.InvalidateHitObject(d);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Given a position in screen space, return the time within this column.
|
/// Given a position in screen space, return the time within this column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual double TimeAtScreenSpacePosition(Vector2 screenSpacePosition) =>
|
public virtual double TimeAtScreenSpacePosition(Vector2 screenSpacePosition) => HitObjectContainer.TimeAtScreenSpacePosition(screenSpacePosition);
|
||||||
((ScrollingHitObjectContainer)HitObjectContainer).TimeAtScreenSpacePosition(screenSpacePosition);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Given a time, return the screen space position within this column.
|
/// Given a time, return the screen space position within this column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual Vector2 ScreenSpacePositionAtTime(double time)
|
public virtual Vector2 ScreenSpacePositionAtTime(double time) => HitObjectContainer.ScreenSpacePositionAtTime(time);
|
||||||
=> ((ScrollingHitObjectContainer)HitObjectContainer).ScreenSpacePositionAtTime(time);
|
|
||||||
|
|
||||||
protected sealed override HitObjectContainer CreateHitObjectContainer() => new ScrollingHitObjectContainer();
|
protected sealed override HitObjectContainer CreateHitObjectContainer() => new ScrollingHitObjectContainer();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user