mirror of
https://github.com/ppy/osu.git
synced 2025-01-30 06:52:53 +08:00
Make sealed and cleanup comparator
This commit is contained in:
parent
58c8184ad7
commit
783c172b5d
@ -118,8 +118,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual SelectionBlueprintContainer CreateSelectionBlueprintContainer() =>
|
protected virtual Container<SelectionBlueprint> CreateSelectionBlueprintContainer() => new HitObjectOrderedSelectionContainer { RelativeSizeAxes = Axes.Both };
|
||||||
new SelectionBlueprintContainer { RelativeSizeAxes = Axes.Both };
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a <see cref="Components.SelectionHandler"/> which outlines <see cref="DrawableHitObject"/>s and handles movement of selections.
|
/// Creates a <see cref="Components.SelectionHandler"/> which outlines <see cref="DrawableHitObject"/>s and handles movement of selections.
|
||||||
|
@ -9,13 +9,11 @@ using osu.Game.Rulesets.Edit;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Compose.Components
|
namespace osu.Game.Screens.Edit.Compose.Components
|
||||||
{
|
{
|
||||||
public class SelectionBlueprintContainer : Container<SelectionBlueprint>
|
public sealed class HitObjectOrderedSelectionContainer : Container<SelectionBlueprint>
|
||||||
{
|
{
|
||||||
public override void Add(SelectionBlueprint drawable)
|
public override void Add(SelectionBlueprint drawable)
|
||||||
{
|
{
|
||||||
base.Add(drawable);
|
base.Add(drawable);
|
||||||
|
|
||||||
if (Content == this)
|
|
||||||
bindStartTime(drawable);
|
bindStartTime(drawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,7 +22,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
if (!base.Remove(drawable))
|
if (!base.Remove(drawable))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (Content == this)
|
|
||||||
unbindStartTime(drawable);
|
unbindStartTime(drawable);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -65,8 +62,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
|
|
||||||
protected override int Compare(Drawable x, Drawable y)
|
protected override int Compare(Drawable x, Drawable y)
|
||||||
{
|
{
|
||||||
if (!(x is SelectionBlueprint xObj) || !(y is SelectionBlueprint yObj))
|
var xObj = (SelectionBlueprint)x;
|
||||||
return base.Compare(x, y);
|
var yObj = (SelectionBlueprint)y;
|
||||||
|
|
||||||
// Put earlier blueprints towards the end of the list, so they handle input first
|
// Put earlier blueprints towards the end of the list, so they handle input first
|
||||||
int i = yObj.HitObject.StartTime.CompareTo(xObj.HitObject.StartTime);
|
int i = yObj.HitObject.StartTime.CompareTo(xObj.HitObject.StartTime);
|
@ -75,7 +75,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override SelectionBlueprintContainer CreateSelectionBlueprintContainer() => new TimelineSelectionBlueprintContainer { RelativeSizeAxes = Axes.Both };
|
protected override Container<SelectionBlueprint> CreateSelectionBlueprintContainer() => new TimelineSelectionBlueprintContainer { RelativeSizeAxes = Axes.Both };
|
||||||
|
|
||||||
protected override void OnDrag(DragEvent e)
|
protected override void OnDrag(DragEvent e)
|
||||||
{
|
{
|
||||||
@ -195,13 +195,13 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class TimelineSelectionBlueprintContainer : SelectionBlueprintContainer
|
protected class TimelineSelectionBlueprintContainer : Container<SelectionBlueprint>
|
||||||
{
|
{
|
||||||
protected override Container<SelectionBlueprint> Content { get; }
|
protected override Container<SelectionBlueprint> Content { get; }
|
||||||
|
|
||||||
public TimelineSelectionBlueprintContainer()
|
public TimelineSelectionBlueprintContainer()
|
||||||
{
|
{
|
||||||
AddInternal(new TimelinePart<SelectionBlueprint>(Content = new SelectionBlueprintContainer { RelativeSizeAxes = Axes.Both }) { RelativeSizeAxes = Axes.Both });
|
AddInternal(new TimelinePart<SelectionBlueprint>(Content = new HitObjectOrderedSelectionContainer { RelativeSizeAxes = Axes.Both }) { RelativeSizeAxes = Axes.Both });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user