Пример #1
0
        public void UndoAction()
        {
            if (_undoStack.Count != 0)
            {
                var action = _undoStack.Pop();
                _redoStack.Push(action);

                action.Undo();

                if (OnUndo != null)
                {
                    OnUndo();
                }
            }
        }
Пример #2
0
    private void ApplyEvent(FiniteStack <HistoryEvent> apply)
    {
        if (apply.count <= 0)
        {
            return;
        }

        HistoryEvent next = apply.Pop();

        next.Restore(data.songData);
        data.currentPattern = next.pattern;
        view.UpdatePatternData();
        Debug.Log("Next line is " + next.position.line);
        view.SetSelection(next.position);
    }
Пример #3
0
 // Load last saved level from redo tack and rebuild level
 private void Redo()
 {
     // See if there is anything on the redo stack
     if (_redoStack.Count > 0)
     {
         // If so, push it to the redo stack
         _undoStack.Push(_levelEditor.GetLevel());
     }
     // Get the last level entry
     int[,,] redoLevel = _redoStack.Pop();
     if (redoLevel != null)
     {
         // Set level to the previous state
         _levelEditor.SetLevel(redoLevel);
     }
 }
Пример #4
0
 // Load last saved level from redo tack and rebuild level
 void Redo()
 {
     // See if there is anything on the redo stack
     if (redoStack.Count > 0)
     {
         // If so, push it to the redo stack
         undoStack.Push(level);
     }
     // Get the last level entry
     int[,,] redoLevel = redoStack.Pop();
     if (redoLevel != null)
     {
         // Set level and rebuild the level
         level = redoLevel;
         RebuildLevel();
     }
 }
Пример #5
0
        // Goes forward to the previously selected directory (inverse of DirectoryBackward)
        public void DirectoryForward()
        {
            // See if there is anything on the redo stack
            if (_forwardStack.Count > 0)
            {
                // If so, push it to the backward stack
                _backwardStack.Push(_currentPath);
            }
            // Get the last level entry
            string forwardPath = _forwardStack.Pop();

            if (forwardPath != null)
            {
                // Set path and update the file browser
                _currentPath = forwardPath;
                UpdateFileBrowser();
            }
        }
Пример #6
0
    // Returns to the previously selected directory (inverse of DirectoryForward)
    public void DirectoryBackward()
    {
        // See if there is anything on the backward stack
        if (_backwardStack.Count > 0)
        {
            // If so, push it to the forward stack
            _forwardStack.Push(currentPath);
        }

        // Get the last path entry
        string backPath = _backwardStack.Pop();

        if (backPath != null)
        {
            // Set path and update the file browser
            currentPath = backPath;
            UpdateFileBrowser();
        }
    }