public void RedoAction() { var objectDropperEvent = RedoQueue.Pop(); objectDropperEvent.Redo(); UndoQueue.Push(objectDropperEvent); }
public void RunAction(IUserAction action) { UndoQueue.Add(action); action.Apply(); if (RedoQueue.Count != 0) { RedoQueue.Clear(); } }
private void StartTurn(TurnTransaction turn) { this.currentTurn = turn; this._UndoQueue = turn.UndoQueue; // Only reset Redoqueue if we're restoring a turn that already has one, otherwise we're just undoing over turn boundaries if (turn.RedoQueue.Count > 0) { this._RedoQueue = turn.RedoQueue; } }
public bool Redo() { if (RedoQueue.Count == 0) { return(false); } var action = RedoQueue[RedoQueue.Count - 1]; RedoQueue.RemoveAt(RedoQueue.Count - 1); action.Apply(); UndoQueue.Add(action); return(true); }
public bool Undo() { if (UndoQueue.Count == 0) { return(false); } var action = UndoQueue[UndoQueue.Count - 1]; UndoQueue.RemoveAt(UndoQueue.Count - 1); action.Undo(); RedoQueue.Add(action); return(true); }
public void AddNewAction(ObjectDropperEvent objectDropperEvent) { UndoQueue.Push(objectDropperEvent); }