1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-19 14:23:14 +08:00

Remove various scrolling container optimisations (removing when not alive).

This commit is contained in:
smoogipooo 2017-08-09 16:19:09 +09:00
parent ef29d9c093
commit d83c218e08
4 changed files with 15 additions and 8 deletions

View File

@ -32,6 +32,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
} }
} }
public override bool RemoveWhenNotAlive => false;
protected DrawableScrollingHitObject(TObject hitObject) protected DrawableScrollingHitObject(TObject hitObject)
: base(hitObject) : base(hitObject)
{ {

View File

@ -27,6 +27,8 @@ namespace osu.Game.Rulesets.Timing
/// </summary> /// </summary>
internal Axes ScrollingAxes; internal Axes ScrollingAxes;
public override bool RemoveWhenNotAlive => false;
/// <summary> /// <summary>
/// The control point that defines the speed adjustments for this container. This is set by the <see cref="SpeedAdjustmentContainer"/>. /// The control point that defines the speed adjustments for this container. This is set by the <see cref="SpeedAdjustmentContainer"/>.
/// </summary> /// </summary>

View File

@ -34,6 +34,8 @@ namespace osu.Game.Rulesets.Timing
/// </summary> /// </summary>
public Axes ScrollingAxes { get; internal set; } public Axes ScrollingAxes { get; internal set; }
public override bool RemoveWhenNotAlive => false;
/// <summary> /// <summary>
/// The <see cref="MultiplierControlPoint"/> that defines the speed adjustments. /// The <see cref="MultiplierControlPoint"/> that defines the speed adjustments.
/// </summary> /// </summary>

View File

@ -7,6 +7,7 @@ using System.Linq;
using OpenTK.Input; using OpenTK.Input;
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.Transforms; using osu.Framework.Graphics.Transforms;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
@ -154,7 +155,7 @@ namespace osu.Game.Rulesets.UI
/// 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 List<DrawableHitObject> queuedHitObjects = new List<DrawableHitObject>(); private readonly List<DrawableHitObject> queuedHitObjects = new List<DrawableHitObject>();
private readonly List<SpeedAdjustmentContainer> speedAdjustments = new List<SpeedAdjustmentContainer>(); private readonly Container<SpeedAdjustmentContainer> speedAdjustments;
private readonly Axes scrollingAxes; private readonly Axes scrollingAxes;
@ -165,6 +166,8 @@ namespace osu.Game.Rulesets.UI
public ScrollingHitObjectContainer(Axes scrollingAxes) public ScrollingHitObjectContainer(Axes scrollingAxes)
{ {
this.scrollingAxes = scrollingAxes; this.scrollingAxes = scrollingAxes;
AddInternal(speedAdjustments = new Container<SpeedAdjustmentContainer> { RelativeSizeAxes = Axes.Both });
} }
/// <summary> /// <summary>
@ -176,9 +179,7 @@ namespace osu.Game.Rulesets.UI
speedAdjustment.ScrollingAxes = scrollingAxes; speedAdjustment.ScrollingAxes = scrollingAxes;
speedAdjustment.VisibleTimeRange.BindTo(VisibleTimeRange); speedAdjustment.VisibleTimeRange.BindTo(VisibleTimeRange);
speedAdjustment.Reversed.BindTo(Reversed); speedAdjustment.Reversed.BindTo(Reversed);
speedAdjustments.Add(speedAdjustment); speedAdjustments.Add(speedAdjustment);
AddInternal(speedAdjustment);
} }
public override IEnumerable<DrawableHitObject> Objects => speedAdjustments.SelectMany(s => s.Children); public override IEnumerable<DrawableHitObject> Objects => speedAdjustments.SelectMany(s => s.Children);
@ -210,11 +211,11 @@ namespace osu.Game.Rulesets.UI
var hitObject = queuedHitObjects[i]; var hitObject = queuedHitObjects[i];
var target = adjustmentContainerFor(hitObject); var target = adjustmentContainerFor(hitObject);
if (target != null) if (target == null)
{ continue;
target.Add(hitObject);
queuedHitObjects.RemoveAt(i); target.Add(hitObject);
} queuedHitObjects.RemoveAt(i);
} }
} }