mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 13:15:08 +08:00
Simplify implementation
This commit is contained in:
parent
a9cbabf711
commit
2f786ffc32
@ -84,6 +84,9 @@ namespace osu.Game.Rulesets.Catch.Edit
|
|||||||
double selectionStartTime = SelectedItems.Min(h => h.StartTime);
|
double selectionStartTime = SelectedItems.Min(h => h.StartTime);
|
||||||
double selectionEndTime = SelectedItems.Max(h => h.GetEndTime());
|
double selectionEndTime = SelectedItems.Max(h => h.GetEndTime());
|
||||||
|
|
||||||
|
// the expectation is that even if the objects themselves are reversed temporally,
|
||||||
|
// the position of new combos in the selection should remain the same.
|
||||||
|
// preserve it for later before doing the reversal.
|
||||||
var newComboOrder = hitObjects.Select(obj => obj.NewCombo).ToList();
|
var newComboOrder = hitObjects.Select(obj => obj.NewCombo).ToList();
|
||||||
|
|
||||||
foreach (var h in hitObjects)
|
foreach (var h in hitObjects)
|
||||||
@ -99,15 +102,11 @@ namespace osu.Game.Rulesets.Catch.Edit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// re-order objects again after flipping their times
|
// re-order objects by start time again after reversing, and restore new combo flag positioning
|
||||||
hitObjects = [.. hitObjects.OrderBy(obj => obj.StartTime)];
|
hitObjects = hitObjects.OrderBy(obj => obj.StartTime).ToList();
|
||||||
|
|
||||||
int i = 0;
|
for (int i = 0; i < hitObjects.Count; ++i)
|
||||||
foreach (bool newCombo in newComboOrder)
|
hitObjects[i].NewCombo = newComboOrder[i];
|
||||||
{
|
|
||||||
hitObjects[i].NewCombo = newCombo;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,9 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
|
|
||||||
bool moreThanOneObject = hitObjects.Count > 1;
|
bool moreThanOneObject = hitObjects.Count > 1;
|
||||||
|
|
||||||
|
// the expectation is that even if the objects themselves are reversed temporally,
|
||||||
|
// the position of new combos in the selection should remain the same.
|
||||||
|
// preserve it for later before doing the reversal.
|
||||||
var newComboOrder = hitObjects.Select(obj => obj.NewCombo).ToList();
|
var newComboOrder = hitObjects.Select(obj => obj.NewCombo).ToList();
|
||||||
|
|
||||||
foreach (var h in hitObjects)
|
foreach (var h in hitObjects)
|
||||||
@ -102,15 +105,11 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// re-order objects again after flipping their times
|
// re-order objects by start time again after reversing, and restore new combo flag positioning
|
||||||
hitObjects = [.. hitObjects.OrderBy(obj => obj.StartTime)];
|
hitObjects = hitObjects.OrderBy(obj => obj.StartTime).ToList();
|
||||||
|
|
||||||
int i = 0;
|
for (int i = 0; i < hitObjects.Count; ++i)
|
||||||
foreach (bool newCombo in newComboOrder)
|
hitObjects[i].NewCombo = newComboOrder[i];
|
||||||
{
|
|
||||||
hitObjects[i].NewCombo = newCombo;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user