Пример #1
0
 public static void EndUndoGroup()
 {
     if (m_undoStack.Count > 0)
     {
         BTUndoGroup oldGroup = m_undoStack.Peek() as BTUndoGroup;
         if (oldGroup != null && oldGroup.IsOpen)
         {
             if (oldGroup.IsEmpty)
             {
                 m_undoStack.Pop();
             }
             else
             {
                 oldGroup.Close();
             }
         }
     }
 }
Пример #2
0
        public static void BeginUndoGroup(string title)
        {
            if (m_undoStack.Count > 0)
            {
                BTUndoGroup oldGroup = m_undoStack.Peek() as BTUndoGroup;
                if (oldGroup != null && oldGroup.IsOpen)
                {
                    Debug.LogWarningFormat("You have to call BTUndoSystem.EndUndoGroup before begining a new group. Old group is '{0}', new group is '{1}'", oldGroup.Title, title);
                    if (oldGroup.IsEmpty)
                    {
                        m_undoStack.Pop();
                    }
                    else
                    {
                        oldGroup.Close();
                    }
                }
            }

            BTUndoGroup group = new BTUndoGroup(title);

            m_undoStack.Push(group);
        }