1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 15:22:55 +08:00

Fix combo not reversing properly depending on the order of selection

This commit is contained in:
Arthur Araujo 2024-03-26 12:10:40 -03:00
parent 10683de578
commit 01a72d5afa
2 changed files with 18 additions and 16 deletions

View File

@ -76,17 +76,15 @@ namespace osu.Game.Rulesets.Catch.Edit
public override bool HandleReverse()
{
var hitObjects = EditorBeatmap.SelectedHitObjects;
var hitObjects = EditorBeatmap.SelectedHitObjects
.OfType<CatchHitObject>()
.OrderBy(obj => obj.StartTime)
.ToList();
double selectionStartTime = SelectedItems.Min(h => h.StartTime);
double selectionEndTime = SelectedItems.Max(h => h.GetEndTime());
var newComboOrder = hitObjects
.OfType<CatchHitObject>()
.Select(obj => obj.NewCombo)
.ToList();
newComboOrder.Reverse();
var newComboOrder = hitObjects.Select(obj => obj.NewCombo).ToList();
foreach (var h in hitObjects)
{
@ -101,10 +99,13 @@ namespace osu.Game.Rulesets.Catch.Edit
}
}
// re-order objects again after flipping their times
hitObjects = [.. hitObjects.OrderBy(obj => obj.StartTime)];
int i = 0;
foreach (bool newCombo in newComboOrder)
{
hitObjects.OfType<CatchHitObject>().ToList()[i].NewCombo = newCombo;
hitObjects[i].NewCombo = newCombo;
i++;
}

View File

@ -78,19 +78,17 @@ namespace osu.Game.Rulesets.Osu.Edit
public override bool HandleReverse()
{
var hitObjects = EditorBeatmap.SelectedHitObjects;
var hitObjects = EditorBeatmap.SelectedHitObjects
.OfType<OsuHitObject>()
.OrderBy(obj => obj.StartTime)
.ToList();
double endTime = hitObjects.Max(h => h.GetEndTime());
double startTime = hitObjects.Min(h => h.StartTime);
bool moreThanOneObject = hitObjects.Count > 1;
var newComboOrder = hitObjects
.OfType<OsuHitObject>()
.Select(obj => obj.NewCombo)
.ToList();
newComboOrder.Reverse();
var newComboOrder = hitObjects.Select(obj => obj.NewCombo).ToList();
foreach (var h in hitObjects)
{
@ -104,10 +102,13 @@ namespace osu.Game.Rulesets.Osu.Edit
}
}
// re-order objects again after flipping their times
hitObjects = [.. hitObjects.OrderBy(obj => obj.StartTime)];
int i = 0;
foreach (bool newCombo in newComboOrder)
{
hitObjects.OfType<OsuHitObject>().ToList()[i].NewCombo = newCombo;
hitObjects[i].NewCombo = newCombo;
i++;
}