mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 12:53:11 +08:00
Resolve inner items early in process and rename variable
This commit is contained in:
parent
41fb3371e5
commit
df85092426
@ -41,25 +41,25 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
|
||||
protected override int Compare(Drawable x, Drawable y)
|
||||
{
|
||||
var xObj = (SelectionBlueprint<HitObject>)x;
|
||||
var yObj = (SelectionBlueprint<HitObject>)y;
|
||||
var xObj = ((SelectionBlueprint<HitObject>)x).Item;
|
||||
var yObj = ((SelectionBlueprint<HitObject>)y).Item;
|
||||
|
||||
// Put earlier blueprints towards the end of the list, so they handle input first
|
||||
int i = yObj.Item.StartTime.CompareTo(xObj.Item.StartTime);
|
||||
if (i != 0) return i;
|
||||
int result = yObj.StartTime.CompareTo(xObj.StartTime);
|
||||
if (result != 0) return result;
|
||||
|
||||
// Fall back to end time if the start time is equal.
|
||||
i = yObj.Item.GetEndTime().CompareTo(xObj.Item.GetEndTime());
|
||||
if (i != 0) return i;
|
||||
result = yObj.GetEndTime().CompareTo(xObj.GetEndTime());
|
||||
if (result != 0) return result;
|
||||
|
||||
// As a final fallback, use combo information if available.
|
||||
if (xObj.Item is IHasComboInformation xHasCombo && yObj.Item is IHasComboInformation yHasCombo)
|
||||
if (xObj is IHasComboInformation xHasCombo && yObj is IHasComboInformation yHasCombo)
|
||||
{
|
||||
i = yHasCombo.ComboIndex.CompareTo(xHasCombo.ComboIndex);
|
||||
if (i != 0) return i;
|
||||
result = yHasCombo.ComboIndex.CompareTo(xHasCombo.ComboIndex);
|
||||
if (result != 0) return result;
|
||||
|
||||
i = yHasCombo.IndexInCurrentCombo.CompareTo(xHasCombo.IndexInCurrentCombo);
|
||||
if (i != 0) return i;
|
||||
result = yHasCombo.IndexInCurrentCombo.CompareTo(xHasCombo.IndexInCurrentCombo);
|
||||
if (result != 0) return result;
|
||||
}
|
||||
|
||||
return CompareReverseChildID(y, x);
|
||||
|
Loading…
Reference in New Issue
Block a user