mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 03:25:11 +08:00
Merge remote-tracking branch 'upstream/master' into container-collection-readonlylist
This commit is contained in:
commit
0322e66c25
@ -8,9 +8,10 @@ using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
public class ReverseDepthFillFlowContainer<T> : FillFlowContainer<T> where T : Drawable
|
||||
public class ReverseChildIDFillFlowContainer<T> : FillFlowContainer<T> where T : Drawable
|
||||
{
|
||||
protected override IComparer<Drawable> DepthComparer => new ReverseCreationOrderDepthComparer();
|
||||
protected override int Compare(Drawable x, Drawable y) => CompareReverseChildID(x, y);
|
||||
|
||||
protected override IEnumerable<Drawable> FlowingChildren => base.FlowingChildren.Reverse();
|
||||
}
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// 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
|
||||
{
|
||||
/// <summary>
|
||||
/// Compares two hit objects by their start time, falling back to creation order if their start time is equal.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,11 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Caching;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using OpenTK;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
@ -55,7 +53,22 @@ namespace osu.Game.Rulesets.Timing
|
||||
/// </summary>
|
||||
internal MultiplierControlPoint ControlPoint;
|
||||
|
||||
protected override IComparer<Drawable> 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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="DrawableTimingSection"/>.
|
||||
|
@ -33,7 +33,20 @@ namespace osu.Game.Rulesets.Timing
|
||||
set { visibleTimeRange.BindTo(value); }
|
||||
}
|
||||
|
||||
protected override IComparer<Drawable> 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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hit objects that are to be re-processed on the next update.
|
||||
@ -116,27 +129,5 @@ namespace osu.Game.Rulesets.Timing
|
||||
/// <param name="time">The time to find the active <see cref="SpeedAdjustmentContainer"/> at.</param>
|
||||
/// <returns>The <see cref="SpeedAdjustmentContainer"/> active at <paramref name="time"/>. Null if there are no speed adjustments.</returns>
|
||||
private SpeedAdjustmentContainer adjustmentContainerAt(double time) => Children.FirstOrDefault(c => c.CanContain(time)) ?? Children.LastOrDefault();
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Screens.Menu
|
||||
/// </summary>
|
||||
public Drawable CentreTarget;
|
||||
|
||||
protected override IComparer<Drawable> DepthComparer => new ReverseCreationOrderDepthComparer();
|
||||
protected override int Compare(Drawable x, Drawable y) => CompareReverseChildID(x, y);
|
||||
|
||||
protected override IEnumerable<Drawable> FlowingChildren => base.FlowingChildren.Reverse();
|
||||
|
||||
|
@ -27,7 +27,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
iconsContainer = new ReverseDepthFillFlowContainer<ModIcon>
|
||||
iconsContainer = new ReverseChildIDFillFlowContainer<ModIcon>
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
|
@ -70,7 +70,7 @@ namespace osu.Game.Screens.Select.Options
|
||||
Scale = new Vector2(1, 0),
|
||||
Colour = Color4.Black.Opacity(0.5f),
|
||||
},
|
||||
buttonsContainer = new ReverseDepthFillFlowContainer<BeatmapOptionsButton>
|
||||
buttonsContainer = new ReverseChildIDFillFlowContainer<BeatmapOptionsButton>
|
||||
{
|
||||
Height = height,
|
||||
RelativePositionAxes = Axes.X,
|
||||
|
@ -190,7 +190,6 @@
|
||||
<Compile Include="Rulesets\Objects\Drawables\IScrollingHitObject.cs" />
|
||||
<Compile Include="Rulesets\Judgements\Judgement.cs" />
|
||||
<Compile Include="Rulesets\Objects\HitObjectParser.cs" />
|
||||
<Compile Include="Rulesets\Objects\HitObjectStartTimeComparer.cs" />
|
||||
<Compile Include="Rulesets\Objects\Types\IHasCombo.cs" />
|
||||
<Compile Include="Rulesets\Objects\Types\IHasEndTime.cs" />
|
||||
<Compile Include="Rulesets\Objects\Types\IHasDistance.cs" />
|
||||
@ -476,7 +475,7 @@
|
||||
<Compile Include="Overlays\Direct\DirectListPanel.cs" />
|
||||
<Compile Include="Database\OnlineWorkingBeatmap.cs" />
|
||||
<Compile Include="Database\BeatmapOnlineInfo.cs" />
|
||||
<Compile Include="Graphics\Containers\ReverseDepthFillFlowContainer.cs" />
|
||||
<Compile Include="Graphics\Containers\ReverseChildIDFillFlowContainer.cs" />
|
||||
<Compile Include="Database\RankStatus.cs" />
|
||||
<Compile Include="Overlays\SearchableList\SearchableListHeader.cs" />
|
||||
<Compile Include="Overlays\SearchableList\HeaderTabControl.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user