mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09:00
Fix not removing queued hit objects.
This commit is contained in:
parent
a95aa90adc
commit
e54abe8d0a
@ -87,7 +87,10 @@ namespace osu.Game.Rulesets.Timing
|
|||||||
RelativeChildOffset = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)VisibleTimeRange : 0, (ScrollingAxes & Axes.Y) > 0 ? (float)VisibleTimeRange : 0);
|
RelativeChildOffset = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)VisibleTimeRange : 0, (ScrollingAxes & Axes.Y) > 0 ? (float)VisibleTimeRange : 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
RelativeChildSize = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)VisibleTimeRange : 1, (ScrollingAxes & Axes.Y) > 0 ? (float)VisibleTimeRange : 1);
|
RelativeChildSize = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)VisibleTimeRange : 1, (ScrollingAxes & Axes.Y) > 0 ? (float)VisibleTimeRange : 1);
|
||||||
|
RelativeChildOffset = Vector2.Zero;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override double LifetimeStart => ControlPoint.StartTime - VisibleTimeRange;
|
public override double LifetimeStart => ControlPoint.StartTime - VisibleTimeRange;
|
||||||
|
@ -170,7 +170,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Hit objects that are to be re-processed on the next update.
|
/// Hit objects that are to be re-processed on the next update.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Queue<DrawableHitObject<TObject, TJudgement>> queuedHitObjects = new Queue<DrawableHitObject<TObject, TJudgement>>();
|
private readonly List<DrawableHitObject<TObject, TJudgement>> queuedHitObjects = new List<DrawableHitObject<TObject, TJudgement>>();
|
||||||
|
|
||||||
private readonly Axes scrollingAxes;
|
private readonly Axes scrollingAxes;
|
||||||
|
|
||||||
@ -208,14 +208,15 @@ namespace osu.Game.Rulesets.UI
|
|||||||
if (!(hitObject is IScrollingHitObject))
|
if (!(hitObject is IScrollingHitObject))
|
||||||
throw new InvalidOperationException($"Hit objects added to a {nameof(ScrollingHitObjectContainer)} must implement {nameof(IScrollingHitObject)}.");
|
throw new InvalidOperationException($"Hit objects added to a {nameof(ScrollingHitObjectContainer)} must implement {nameof(IScrollingHitObject)}.");
|
||||||
|
|
||||||
queuedHitObjects.Enqueue(hitObject);
|
queuedHitObjects.Add(hitObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Remove(DrawableHitObject<TObject, TJudgement> hitObject)
|
public override bool Remove(DrawableHitObject<TObject, TJudgement> hitObject)
|
||||||
{
|
{
|
||||||
foreach (var c in InternalChildren.OfType<SpeedAdjustmentContainer>())
|
bool removed = InternalChildren.OfType<SpeedAdjustmentContainer>().Any(c => c.Remove(hitObject));
|
||||||
c.Remove(hitObject);
|
removed = removed || queuedHitObjects.Remove(hitObject);
|
||||||
return true;
|
|
||||||
|
return removed;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
@ -225,22 +226,16 @@ namespace osu.Game.Rulesets.UI
|
|||||||
// Todo: At the moment this is going to re-process every single Update, however this will only be a null-op
|
// Todo: At the moment this is going to re-process every single Update, however this will only be a null-op
|
||||||
// when there are no SpeedAdjustmentContainers available. This should probably error or something, but it's okay for now.
|
// when there are no SpeedAdjustmentContainers available. This should probably error or something, but it's okay for now.
|
||||||
|
|
||||||
// An external count is kept because hit objects that can't be added are re-queued
|
for (int i = queuedHitObjects.Count - 1; i >= 0; i--)
|
||||||
int count = queuedHitObjects.Count;
|
|
||||||
while (count-- > 0)
|
|
||||||
{
|
{
|
||||||
var hitObject = queuedHitObjects.Dequeue();
|
var hitObject = queuedHitObjects[i];
|
||||||
|
|
||||||
var target = adjustmentContainerFor(hitObject);
|
var target = adjustmentContainerFor(hitObject);
|
||||||
if (target == null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
// We can't add this hit object to a speed adjustment container yet, so re-queue it
|
target.Add(hitObject);
|
||||||
// for re-processing when the layout next invalidated
|
queuedHitObjects.RemoveAt(i);
|
||||||
queuedHitObjects.Enqueue(hitObject);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target.Add(hitObject);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user