mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 14:46:38 +09:00
Split transaction handling code out into base class
This commit is contained in:
@ -68,19 +68,20 @@ namespace osu.Game.Screens.Edit
|
||||
toRemove.Sort();
|
||||
toAdd.Sort();
|
||||
|
||||
editorBeatmap.ApplyBatchChanges(eb =>
|
||||
{
|
||||
// Apply the changes.
|
||||
for (int i = toRemove.Count - 1; i >= 0; i--)
|
||||
eb.RemoveAt(toRemove[i]);
|
||||
editorBeatmap.BeginChange();
|
||||
|
||||
if (toAdd.Count > 0)
|
||||
{
|
||||
IBeatmap newBeatmap = readBeatmap(newState);
|
||||
foreach (var i in toAdd)
|
||||
eb.Insert(i, newBeatmap.HitObjects[i]);
|
||||
}
|
||||
});
|
||||
// Apply the changes.
|
||||
for (int i = toRemove.Count - 1; i >= 0; i--)
|
||||
editorBeatmap.RemoveAt(toRemove[i]);
|
||||
|
||||
if (toAdd.Count > 0)
|
||||
{
|
||||
IBeatmap newBeatmap = readBeatmap(newState);
|
||||
foreach (var i in toAdd)
|
||||
editorBeatmap.Insert(i, newBeatmap.HitObjects[i]);
|
||||
}
|
||||
|
||||
editorBeatmap.EndChange();
|
||||
}
|
||||
|
||||
private string readString(byte[] state) => Encoding.UTF8.GetString(state);
|
||||
|
Reference in New Issue
Block a user