public void Add(IEditorCommand cmd) { if (cmd == null) { return; } //移除当前命令之后的所有已执行命令 int removeNum = cmdList.Count - currCount; if (removeNum > 0) { cmdList.RemoveRange(currCount, removeNum); } //Modify by liteng for MoveAtlas At 2014/1/4 NotifyBeforeCmdExecute(cmd, removeNum); cmd.Execute(); //Modify by liteng for MoveAtlas At 2014/1/4 NotifyAfterCmdExecute(cmd, removeNum); if (cmd.DontSaved || useUnityUndo) {//命令本身为只执行不保存的或只使用Unity Undo cmdList.Add(cmd); currCount++; } NotifyChange(); }
public void ExecuteCommand(IEditorCommand command) { _compositionChangedByCommand = true; var args = ConstructCommandArgs(); if (command.CanExecute(args)) { command.Execute(args); } _compositionChangedByCommand = false; }
public void Execute(IEditorCommand cmd) { if (cmd == null) { return; } cmd.Execute(); if (currCmdIndx == -1) { cmdList.Clear(); } else { cmdList.RemoveRange(currCmdIndx + 1, cmdList.Count - currCmdIndx - 1); } cmdList.Add(cmd); currCmdIndx++; }