Exemplo n.º 1
0
 /// <summary>
 /// Redo action
 /// </summary>
 public static void Redo()
 {
     if (m_redoList != null && m_redoList.Count > 0)
     {
         MyEditorActionBase editorAction = m_redoList.Pop();
         editorAction.Perform();
         m_undoStack.Push(editorAction);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Undo action
 /// </summary>
 public static void Undo()
 {
     //if there are no actions, there is nothing to UNDO
     if (m_undoStack != null && m_undoStack.Count > 0)
     {
         //rollback last action performed and put it into REDO stack
         MyEditorActionBase editorAction = m_undoStack.Pop();
         editorAction.Rollback();
         m_redoList.Push(editorAction);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Adds action to action history
        /// </summary>
        /// <param name="editorAction"></param>
        public static void AddAction(MyEditorActionBase editorAction)
        {
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("editorAction.Perform()");
            editorAction.Perform();
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("m_redoList.Clear()");
            m_redoList.Clear();
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("m_undoStack.Push()");
            m_undoStack.Push(editorAction);

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("if..");
            //While doing new actions, we must make room for new UNDO operations by removing old REDO actions
            if ((m_redoList != null && m_redoList.Count > 0) && (m_undoStack.Count == MyEditorConstants.MAX_UNDO_REDO_HISTORY_LIMIT))
            {
                // m_redoList.RemoveLast();
            }

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Adds action to action history
        /// </summary>
        /// <param name="editorAction"></param>
        public static void AddAction(MyEditorActionBase editorAction)
        {
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("editorAction.Perform()");
            editorAction.Perform();
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("m_redoList.Clear()");
            m_redoList.Clear();
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("m_undoStack.Push()");
            m_undoStack.Push(editorAction);

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartNextBlock("if..");
            //While doing new actions, we must make room for new UNDO operations by removing old REDO actions
            if ((m_redoList != null && m_redoList.Count > 0) && (m_undoStack.Count == MyEditorConstants.MAX_UNDO_REDO_HISTORY_LIMIT))
            {
               // m_redoList.RemoveLast();
            }

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
        }