mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 15:27:30 +08:00
Add patcher support for breaks
This commit is contained in:
parent
4022a8b06c
commit
58701b17f8
@ -45,6 +45,7 @@ namespace osu.Game.Screens.Edit
|
||||
editorBeatmap.BeginChange();
|
||||
processHitObjects(result, () => newBeatmap ??= readBeatmap(newState));
|
||||
processTimingPoints(() => newBeatmap ??= readBeatmap(newState));
|
||||
processBreaks(() => newBeatmap ??= readBeatmap(newState));
|
||||
processHitObjectLocalData(() => newBeatmap ??= readBeatmap(newState));
|
||||
editorBeatmap.EndChange();
|
||||
}
|
||||
@ -75,6 +76,27 @@ namespace osu.Game.Screens.Edit
|
||||
}
|
||||
}
|
||||
|
||||
private void processBreaks(Func<IBeatmap> getNewBeatmap)
|
||||
{
|
||||
var newBreaks = getNewBeatmap().Breaks.ToArray();
|
||||
|
||||
foreach (var oldBreak in editorBeatmap.Breaks.ToArray())
|
||||
{
|
||||
if (newBreaks.Any(b => b.Equals(oldBreak)))
|
||||
continue;
|
||||
|
||||
editorBeatmap.Breaks.Remove(oldBreak);
|
||||
}
|
||||
|
||||
foreach (var newBreak in newBreaks)
|
||||
{
|
||||
if (editorBeatmap.Breaks.Any(b => b.Equals(newBreak)))
|
||||
continue;
|
||||
|
||||
editorBeatmap.Breaks.Add(newBreak);
|
||||
}
|
||||
}
|
||||
|
||||
private void processHitObjects(DiffResult result, Func<IBeatmap> getNewBeatmap)
|
||||
{
|
||||
findChangedIndices(result, LegacyDecoder<Beatmap>.Section.HitObjects, out var removedIndices, out var addedIndices);
|
||||
|
Loading…
Reference in New Issue
Block a user