@@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.Editor.Commands
|
||||
@@ -14,6 +15,8 @@ namespace Ichni.Editor.Commands
|
||||
/// </summary>
|
||||
public static void ExecuteCommand(ICommand command)
|
||||
{
|
||||
if (command == null) return;
|
||||
|
||||
if (undoStack.Count > 0)
|
||||
{
|
||||
var topCommand = undoStack.Peek();
|
||||
@@ -28,7 +31,14 @@ namespace Ichni.Editor.Commands
|
||||
// 新操作彻底切断原本可能存在的重做未来
|
||||
command.Execute();
|
||||
undoStack.Push(command);
|
||||
redoStack.Clear();
|
||||
redoStack.Clear();
|
||||
}
|
||||
|
||||
public static GameElement ExecuteCreate(Func<GameElement> createAction)
|
||||
{
|
||||
var command = new CreateElementCommand(createAction);
|
||||
ExecuteCommand(command);
|
||||
return command.CreatedElement;
|
||||
}
|
||||
|
||||
public static void Undo()
|
||||
|
||||
Reference in New Issue
Block a user