/// <summary>If the number of redo actions exceeds the maximum count, the excess actions will are removed. Call this method every time an gameItem is added to the redo list.</summary> protected void CropRedos() { if (redoMaxCount == -1) { return; } while (redos.Count > redoMaxCount) { redos[redos.Count - 1].OnBeforeDiscarded(); redos.CropAt(redos.Count - 1); } }
/// <summary>If the number of undo actions exceeds the maximum count, the excess actions will are removed. Call this method every time an gameItem is added to the undo list.</summary> protected void CropUndos() { if (undoMaxCount == -1 && totalActionMaxCount == -1) { return; } while ( (undoMaxCount != -1 && undos.Count > undoMaxCount) || (totalActionMaxCount != -1 && redos.Count + undos.Count > totalActionMaxCount)) { undos[undos.Count - 1].OnBeforeDiscarded(); undos.CropAt(undos.Count - 1); } }