Esempio n. 1
0
 /// <summary>
 /// Push a new state onto the undo/redo buffer, will erase anything after the current undo.
 /// This will use the passed states for undo and redo.
 /// </summary>
 public void pushUndoState(CameraPosition undoState, CameraPosition redoState)
 {
     //Make sure the undo and redo states are sufficiently different, otherwise ignore this new entry
     if ((undoState.Translation - redoState.Translation).length2() > 0.001 || (undoState.LookAt - redoState.LookAt).length2() > 0.001)
     {
         undoRedoBuffer.pushAndSkip(new TwoWayDelegateCommand <CameraPosition, CameraPosition>(redoState, undoState, new TwoWayDelegateCommand <CameraPosition, CameraPosition> .Funcs()
         {
             ExecuteFunc = state =>
             {
                 this.setPosition(state, GuiFrameworkCamerasInterface.CameraTransitionTime);
                 if (OnRedo != null)
                 {
                     OnRedo.Invoke(this);
                 }
             },
             UndoFunc = state =>
             {
                 this.setPosition(state, GuiFrameworkCamerasInterface.CameraTransitionTime);
                 if (OnUndo != null)
                 {
                     OnUndo.Invoke(this);
                 }
             }
         }));
         if (OnUndoRedoChanged != null)
         {
             OnUndoRedoChanged.Invoke(this);
         }
     }
 }
 /// <summary>
 /// Push a new state onto the undo/redo buffer, will erase anything after the current undo.
 /// This will use the passed states for undo and redo.
 /// </summary>
 public void pushUndoState(MusclePosition undoPosition, MusclePosition redoPosition)
 {
     poseUndoRedoBuffer.pushAndSkip(new TwoWayDelegateCommand <MusclePosition, MusclePosition>(redoPosition, undoPosition, new TwoWayDelegateCommand <MusclePosition, MusclePosition> .Funcs()
     {
         ExecuteFunc = position =>
         {
             position.preview();
             if (OnRedo != null)
             {
                 OnRedo.Invoke(this);
             }
         },
         UndoFunc = position =>
         {
             position.preview();
             if (OnUndo != null)
             {
                 OnUndo.Invoke(this);
             }
         }
     }));
     if (OnUndoRedoChanged != null)
     {
         OnUndoRedoChanged.Invoke(this);
     }
 }
 /// <summary>
 /// Push a new state onto the undo/redo buffer, will erase anything after the current undo.
 /// This will use the passed states for undo and redo.
 /// </summary>
 public void pushUndoState(LayerState undoState, LayerState redoState)
 {
     if (!undoState.isTheSameAs(redoState)) //This uses the slightly unreliable isTheSameAs function, but worse case scenerio we end up with a duplicate undo.
     {
         undoRedoBuffers[activeStateName].pushAndSkip(new TwoWayDelegateCommand <LayerState, LayerState>(redoState, undoState, new TwoWayDelegateCommand <LayerState, LayerState> .Funcs()
         {
             ExecuteFunc = state =>
             {
                 state.apply();
                 if (OnRedo != null)
                 {
                     OnRedo.Invoke(this);
                 }
             },
             UndoFunc = state =>
             {
                 state.apply();
                 if (OnUndo != null)
                 {
                     OnUndo.Invoke(this);
                 }
             }
         }));
         if (OnUndoRedoChanged != null)
         {
             OnUndoRedoChanged.Invoke(this);
         }
     }
 }
Esempio n. 4
0
        public static void Redo(string stackId)
        {
            Stack <UndoObject> stack = null;

            if (redos.TryGetValue(stackId, out stack))
            {
                if (stack.Count > 0)
                {
                    var p = stack.Pop();

                    Task.Run(async() =>
                    {
                        await p.Undo(r =>
                        {
                            if (r != null)
                            {
                                AddUndo(r);
                            }
                        });
                    });

                    if (OnRedo != null)
                    {
                        OnRedo.Invoke(stackId, stack.Count);
                    }
                }
            }
        }
Esempio n. 5
0
 void RedoCurrentAction()
 {
     if (!actionsMade[currentRedoStepIndex].isDone)
     {
         actionsMade[currentRedoStepIndex].Redo();
         OnRedo?.Invoke();
     }
 }
    void RedoCurrentAction()
    {
        if (!actionsMade[currentRedoStepIndex].isDone)
        {
            actionsMade[currentRedoStepIndex].Redo();
            OnRedo?.Invoke();

            CheckButtonsInteractability();
        }
    }
Esempio n. 7
0
    public void Redo(HistoryActionContainer actionContainer)
    {
        undoList.Add(actionContainer);
        redoList.Remove(actionContainer);
        actionContainer.action.Result.Redo();

        if (OnRedo != null)
        {
            OnRedo.Invoke(actionContainer);
        }
    }
        public void Redo()
        {
            LevelEditorLogger.Log("Redo");

            if (counter < actionHistory.Count)
            {
                IUndoAction action = actionHistory[counter];
                action.Redo(this);
                counter++;

                OnRedo?.Invoke(action);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Reverts the objects in the object list to the state before the Undo method was invoked.
        /// </summary>
        public void Redo()
        {
            undoIndex++;
            OnRedo?.Invoke(this, new UndoRedoEventArgs(undoIndex));
            string[] objects = new string[programObjects.Count]; //Used for saving the current state of the objects to the objectStates list.
            for (int i = 0; i < objects.Length; i++)
            {
                objects[i] = programObjects[i].ToString();
            }
            int j = undoIndex;

            while (j < objectStates.Count) //Remove the arrays after the current undo index.
            {
                objectStates.RemoveAt(j);
            }
            objectStates.Add(objects);
        }
Esempio n. 10
0
        public static void Redo(string stackId)
        {
            Stack <RedoObject> stack = null;

            if (redos.TryGetValue(stackId, out stack))
            {
                if (redos.Count > 0)
                {
                    var p = stack.Pop();
                    var r = p.Redo();

                    AddUndo(r);

                    if (OnRedo != null)
                    {
                        OnRedo.Invoke(stackId, stack.Count);
                    }
                }
            }
        }