1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-11 02:33:21 +08:00
osu-lazer/osu.Game/Screens/Edit/EditorCommandHandlerExtension.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
1009 B
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Game.Screens.Edit.Commands;
namespace osu.Game.Screens.Edit
{
2024-10-10 20:05:50 +08:00
public static class EditorCommandHandlerExtension
{
public static void SafeSubmit(this EditorCommandHandler? manager, IEditorCommand command, bool commitImmediately = false)
{
if (manager != null)
manager.Submit(command, commitImmediately);
else
command.Apply();
}
public static void SafeSubmit(this EditorCommandHandler? manager, IEnumerable<IEditorCommand> commands, bool commitImmediately = false)
{
if (manager != null)
manager.Submit(commands, commitImmediately);
else
{
foreach (var command in commands)
command.Apply();
}
}
}
}