Resolve inner items early in process and rename variable

This commit is contained in:
Dean Herbert 2021-09-27 14:24:17 +09:00
parent 41fb3371e5
commit df85092426
1 changed files with 11 additions and 11 deletions

View File

@ -41,25 +41,25 @@ public override bool Remove(SelectionBlueprint<HitObject> drawable)
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);