Exemplo n.º 1
0
        public void RedoAction()
        {
            var objectDropperEvent = RedoQueue.Pop();

            objectDropperEvent.Redo();
            UndoQueue.Push(objectDropperEvent);
        }
Exemplo n.º 2
0
 public void RunAction(IUserAction action)
 {
     UndoQueue.Add(action);
     action.Apply();
     if (RedoQueue.Count != 0)
     {
         RedoQueue.Clear();
     }
 }
Exemplo n.º 3
0
        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;
            }
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
 public void AddNewAction(ObjectDropperEvent objectDropperEvent)
 {
     UndoQueue.Push(objectDropperEvent);
 }