1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:33:30 +08:00

Handle new combo on HandleReverse

This commit is contained in:
Arthur Araujo 2024-03-25 04:19:14 -03:00
parent 77660e57ea
commit 78037fa477
2 changed files with 48 additions and 5 deletions

View File

@ -76,21 +76,44 @@ namespace osu.Game.Rulesets.Catch.Edit
public override bool HandleReverse() public override bool HandleReverse()
{ {
var hitObjects = EditorBeatmap.SelectedHitObjects;
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());
EditorBeatmap.PerformOnSelection(hitObject => var newComboPlaces = hitObjects
{ .OfType<CatchHitObject>()
hitObject.StartTime = selectionEndTime - (hitObject.GetEndTime() - selectionStartTime); .Where(h => h.NewCombo)
.Select(obj => obj.StartTime)
.ToList();
if (hitObject is JuiceStream juiceStream) foreach (var h in hitObjects)
{
h.StartTime = selectionEndTime - (h.GetEndTime() - selectionStartTime);
if (h is JuiceStream juiceStream)
{ {
juiceStream.Path.Reverse(out Vector2 positionalOffset); juiceStream.Path.Reverse(out Vector2 positionalOffset);
juiceStream.OriginalX += positionalOffset.X; juiceStream.OriginalX += positionalOffset.X;
juiceStream.LegacyConvertedY += positionalOffset.Y; juiceStream.LegacyConvertedY += positionalOffset.Y;
EditorBeatmap.Update(juiceStream); EditorBeatmap.Update(juiceStream);
} }
}); }
foreach (var h in hitObjects)
{
if (h is CatchHitObject obj) obj.NewCombo = false;
}
foreach (double place in newComboPlaces)
{
hitObjects
.OfType<CatchHitObject>()
.Where(obj => obj.StartTime == place)
.ToList()
.ForEach(obj => obj.NewCombo = true);
}
return true; return true;
} }

View File

@ -85,6 +85,12 @@ namespace osu.Game.Rulesets.Osu.Edit
bool moreThanOneObject = hitObjects.Count > 1; bool moreThanOneObject = hitObjects.Count > 1;
var newComboPlaces = hitObjects
.OfType<OsuHitObject>()
.Where(h => h.NewCombo)
.Select(obj => obj.StartTime)
.ToList();
foreach (var h in hitObjects) foreach (var h in hitObjects)
{ {
if (moreThanOneObject) if (moreThanOneObject)
@ -97,6 +103,20 @@ namespace osu.Game.Rulesets.Osu.Edit
} }
} }
foreach (var h in hitObjects)
{
if (h is OsuHitObject obj) obj.NewCombo = false;
}
foreach (double place in newComboPlaces)
{
hitObjects
.OfType<OsuHitObject>()
.Where(obj => obj.StartTime == place)
.ToList()
.ForEach(obj => obj.NewCombo = true);
}
return true; return true;
} }