public List <UndoAction> RedoAction() { List <UndoAction> ret = new List <UndoAction>(); if (redoStack.Count > 0) { UndoAction act = redoStack.Last.Value; redoStack.RemoveLast(); undoStack.AddLast(act); ret.Add(act); if (act.UndoType == CombatManager.UndoAction.UndoTypes.UndoGroupStart) { while (true) { if (redoStack.Count == 0) { break; } act = redoStack.Last.Value; redoStack.RemoveLast(); undoStack.AddLast(act); ret.Add(act); if (act.UndoType == CombatManager.UndoAction.UndoTypes.UndoGroupEnd) { break; } } } } return(ret); }
public void AddToUndo(UndoAction act) { if (!IsOwned) { if (redoStack.Count > 0) { tempRedoStack = redoStack; redoStack = new LinkedList <CombatManager.UndoAction>(); } if (undoStack.Count == 0 || !undoStack.Last.Value.Equals(act)) { undoStack.AddLast(act); } while (undoStack.Count > 5000) { undoStack.RemoveFirst(); } } }