修改track复制步进和撤销模式

Signed-off-by: TRADER_FOER <lhf190@outlook.com>
This commit is contained in:
2026-07-10 14:05:45 +08:00
parent fdc20cd66f
commit a835e8321b
30 changed files with 1501 additions and 367 deletions

View File

@@ -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()