diff --git a/osu-framework b/osu-framework index 6f7528255c..40dc967472 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 6f7528255c5d6cde72f1e92de539983bc4bce502 +Subproject commit 40dc96747288fab4ae137e74b0af7452dc8be792 diff --git a/osu.Game/Graphics/Containers/ReverseDepthFillFlowContainer.cs b/osu.Game/Graphics/Containers/ReverseDepthFillFlowContainer.cs index 0b38bf5fe0..781e149078 100644 --- a/osu.Game/Graphics/Containers/ReverseDepthFillFlowContainer.cs +++ b/osu.Game/Graphics/Containers/ReverseDepthFillFlowContainer.cs @@ -8,9 +8,10 @@ using osu.Framework.Graphics.Containers; namespace osu.Game.Graphics.Containers { - public class ReverseDepthFillFlowContainer : FillFlowContainer where T : Drawable + public class ReverseChildIDFillFlowContainer : FillFlowContainer where T : Drawable { - protected override IComparer DepthComparer => new ReverseCreationOrderDepthComparer(); + protected override int Compare(Drawable x, Drawable y) => CompareReverseChildID(x, y); + protected override IEnumerable FlowingChildren => base.FlowingChildren.Reverse(); } } diff --git a/osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs b/osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs deleted file mode 100644 index b089856dcb..0000000000 --- a/osu.Game/Rulesets/Objects/HitObjectStartTimeComparer.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Graphics; -using osu.Game.Rulesets.Objects.Drawables; - -namespace osu.Game.Rulesets.Objects -{ - /// - /// Compares two hit objects by their start time, falling back to creation order if their start time is equal. - /// - public class HitObjectStartTimeComparer : Drawable.CreationOrderDepthComparer - { - public override int Compare(Drawable x, Drawable y) - { - var hitObjectX = x as DrawableHitObject; - var hitObjectY = y as DrawableHitObject; - - // If either of the two drawables are not hit objects, fall back to the base comparer - if (hitObjectX?.HitObject == null || hitObjectY?.HitObject == null) - return base.Compare(x, y); - - // Compare by start time - int i = hitObjectX.HitObject.StartTime.CompareTo(hitObjectY.HitObject.StartTime); - if (i != 0) - return i; - - return base.Compare(x, y); - } - } - - /// - /// Compares two hit objects by their start time, falling back to creation order if their start time is equal. - /// This will compare the two hit objects in reverse order. - /// - public class HitObjectReverseStartTimeComparer : Drawable.ReverseCreationOrderDepthComparer - { - public override int Compare(Drawable x, Drawable y) - { - var hitObjectX = x as DrawableHitObject; - var hitObjectY = y as DrawableHitObject; - - // If either of the two drawables are not hit objects, fall back to the base comparer - if (hitObjectX?.HitObject == null || hitObjectY?.HitObject == null) - return base.Compare(x, y); - - // Compare by start time - int i = hitObjectY.HitObject.StartTime.CompareTo(hitObjectX.HitObject.StartTime); - if (i != 0) - return i; - - return base.Compare(x, y); - } - } -} \ No newline at end of file diff --git a/osu.Game/Rulesets/Timing/DrawableTimingSection.cs b/osu.Game/Rulesets/Timing/DrawableTimingSection.cs index 589ee9991d..74ff721d50 100644 --- a/osu.Game/Rulesets/Timing/DrawableTimingSection.cs +++ b/osu.Game/Rulesets/Timing/DrawableTimingSection.cs @@ -55,7 +55,22 @@ namespace osu.Game.Rulesets.Timing /// internal MultiplierControlPoint ControlPoint; - protected override IComparer DepthComparer => new HitObjectReverseStartTimeComparer(); + protected override int Compare(Drawable x, Drawable y) + { + var xHitObject = x as DrawableHitObject; + var yHitObject = y as DrawableHitObject; + + // If either of the two drawables are not hit objects, fall back to the base comparer + if (xHitObject?.HitObject == null || yHitObject?.HitObject == null) + return base.Compare(x, y); + + // Compare by start time + int i = yHitObject.HitObject.StartTime.CompareTo(xHitObject.HitObject.StartTime); + if (i != 0) + return i; + + return base.Compare(x, y); + } /// /// Creates a new . diff --git a/osu.Game/Rulesets/Timing/SpeedAdjustmentCollection.cs b/osu.Game/Rulesets/Timing/SpeedAdjustmentCollection.cs index 1323bb14a1..22213be740 100644 --- a/osu.Game/Rulesets/Timing/SpeedAdjustmentCollection.cs +++ b/osu.Game/Rulesets/Timing/SpeedAdjustmentCollection.cs @@ -33,7 +33,20 @@ namespace osu.Game.Rulesets.Timing set { visibleTimeRange.BindTo(value); } } - protected override IComparer DepthComparer => new SpeedAdjustmentContainerReverseStartTimeComparer(); + protected override int Compare(Drawable x, Drawable y) + { + var xSpeedAdjust = x as SpeedAdjustmentContainer; + var ySpeedAdjust = y as SpeedAdjustmentContainer; + + // If either of the two drawables are not hit objects, fall back to the base comparer + if (xSpeedAdjust?.ControlPoint == null || ySpeedAdjust?.ControlPoint == null) + return CompareReverseChildID(x, y); + + // Compare by start time + int i = ySpeedAdjust.ControlPoint.StartTime.CompareTo(xSpeedAdjust.ControlPoint.StartTime); + + return i != 0 ? i : CompareReverseChildID(x, y); + } /// /// Hit objects that are to be re-processed on the next update. @@ -116,27 +129,5 @@ namespace osu.Game.Rulesets.Timing /// The time to find the active at. /// The active at . Null if there are no speed adjustments. private SpeedAdjustmentContainer adjustmentContainerAt(double time) => Children.FirstOrDefault(c => c.CanContain(time)) ?? Children.LastOrDefault(); - - /// - /// Compares two speed adjustment containers by their control point start time, falling back to creation order - // if their control point start time is equal. This will compare the two speed adjustment containers in reverse order. - /// - private class SpeedAdjustmentContainerReverseStartTimeComparer : ReverseCreationOrderDepthComparer - { - public override int Compare(Drawable x, Drawable y) - { - var speedAdjustmentX = x as SpeedAdjustmentContainer; - var speedAdjustmentY = y as SpeedAdjustmentContainer; - - // If either of the two drawables are not hit objects, fall back to the base comparer - if (speedAdjustmentX?.ControlPoint == null || speedAdjustmentY?.ControlPoint == null) - return base.Compare(x, y); - - // Compare by start time - int i = speedAdjustmentY.ControlPoint.StartTime.CompareTo(speedAdjustmentX.ControlPoint.StartTime); - - return i != 0 ? i : base.Compare(x, y); - } - } } } diff --git a/osu.Game/Screens/Menu/FlowContainerWithOrigin.cs b/osu.Game/Screens/Menu/FlowContainerWithOrigin.cs index d0972ea84b..071de99209 100644 --- a/osu.Game/Screens/Menu/FlowContainerWithOrigin.cs +++ b/osu.Game/Screens/Menu/FlowContainerWithOrigin.cs @@ -20,7 +20,7 @@ namespace osu.Game.Screens.Menu /// public Drawable CentreTarget; - protected override IComparer DepthComparer => new ReverseCreationOrderDepthComparer(); + protected override int Compare(Drawable x, Drawable y) => CompareReverseChildID(x, y); protected override IEnumerable FlowingChildren => base.FlowingChildren.Reverse(); diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index 921accf6ac..4cbea43ac5 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -27,7 +27,7 @@ namespace osu.Game.Screens.Play.HUD { Children = new Drawable[] { - iconsContainer = new ReverseDepthFillFlowContainer + iconsContainer = new ReverseChildIDFillFlowContainer { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs index f18080d6f5..6345807ea3 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs @@ -70,7 +70,7 @@ namespace osu.Game.Screens.Select.Options Scale = new Vector2(1, 0), Colour = Color4.Black.Opacity(0.5f), }, - buttonsContainer = new ReverseDepthFillFlowContainer + buttonsContainer = new ReverseChildIDFillFlowContainer { Height = height, RelativePositionAxes = Axes.X, diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 06d4da663e..0b5bab2b45 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -190,7 +190,6 @@ -