2024-10-09 02:19:15 +08:00
|
|
|
// 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.
|
|
|
|
|
2024-10-10 03:20:07 +08:00
|
|
|
using System.Collections.Generic;
|
2024-10-09 02:19:15 +08:00
|
|
|
using osu.Game.Screens.Edit.Commands;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Edit
|
|
|
|
{
|
2024-10-10 20:05:50 +08:00
|
|
|
public static class EditorCommandHandlerExtension
|
2024-10-09 02:19:15 +08:00
|
|
|
{
|
|
|
|
public static void SafeSubmit(this EditorCommandHandler? manager, IEditorCommand command, bool commitImmediately = false)
|
|
|
|
{
|
|
|
|
if (manager != null)
|
|
|
|
manager.Submit(command, commitImmediately);
|
|
|
|
else
|
|
|
|
command.Apply();
|
|
|
|
}
|
2024-10-10 03:20:07 +08:00
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
2024-10-09 02:19:15 +08:00
|
|
|
}
|
|
|
|
}
|