public void RedoNextCommand() { if (this._RedoQueue.Count == 0 && this.futureTurns.Count > 0) { this.previousTurns.Push(this.EndCurrentTurn()); this.StartTurn(this.futureTurns.Pop()); } if (_RedoQueue.Count > 0) { ICommand command = _RedoQueue.Pop(); RunCommand(command); } }
public void UndoLastCommand() { if (_UndoQueue.Count == 0 && this.previousTurns.Count > 0) { this.StartTurn(this.previousTurns.Pop()); } if (_UndoQueue.Count > 0) { ICommand command = _UndoQueue.Pop(); command.Undo(); _RedoQueue.Push(command); CallListenersForCommand(command); } }
public void UndoAction() { var objectDropperEvent = UndoQueue.Pop(); objectDropperEvent.Undo(); RedoQueue.Push(objectDropperEvent); }