1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-28 06:12:54 +08:00

We don't need to use Cached just yet.

This was here to support dynamic re-ordering of hit objects and speed adjustment containers, however there needs to be more work done to TimingControlPoints/MultiplierControlPoints in general before this is possible.
This commit is contained in:
smoogipooo 2017-06-16 10:53:02 +09:00
parent 5d7336b235
commit 41c6140435

View File

@ -4,7 +4,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Caching;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -36,8 +35,6 @@ namespace osu.Game.Rulesets.Timing
protected override IComparer<Drawable> DepthComparer => new SpeedAdjustmentContainerReverseStartTimeComparer(); protected override IComparer<Drawable> DepthComparer => new SpeedAdjustmentContainerReverseStartTimeComparer();
private Cached layout = new Cached();
/// <summary> /// <summary>
/// Hit objects that are to be re-processed when <see cref="layout"/> is invalidated. /// Hit objects that are to be re-processed when <see cref="layout"/> is invalidated.
/// </summary> /// </summary>
@ -51,13 +48,11 @@ namespace osu.Game.Rulesets.Timing
public void Add(DrawableHitObject hitObject) public void Add(DrawableHitObject hitObject)
{ {
queuedHitObjects.Enqueue(hitObject); queuedHitObjects.Enqueue(hitObject);
layout.Invalidate();
} }
public override void Add(SpeedAdjustmentContainer speedAdjustment) public override void Add(SpeedAdjustmentContainer speedAdjustment)
{ {
speedAdjustment.VisibleTimeRange.BindTo(VisibleTimeRange); speedAdjustment.VisibleTimeRange.BindTo(VisibleTimeRange);
layout.Invalidate();
base.Add(speedAdjustment); base.Add(speedAdjustment);
} }
@ -65,10 +60,6 @@ namespace osu.Game.Rulesets.Timing
{ {
base.Update(); base.Update();
if (!layout.IsValid)
{
layout.Refresh(() =>
{
// An external count is kept because hit objects that can't be added are re-queued // An external count is kept because hit objects that can't be added are re-queued
int count = queuedHitObjects.Count; int count = queuedHitObjects.Count;
while (count-- > 0) while (count-- > 0)
@ -89,8 +80,6 @@ namespace osu.Game.Rulesets.Timing
target.Add(hitObject); target.Add(hitObject);
} }
});
}
} }
/// <summary> /// <summary>