private void UndoRedoImpl(IActionQueueItem item, bool redo) { if (item != null) { if (ModInfo.sa_ignoreCosts.value || !LoadingExtension.Instsance.m_inStandardGame) { var aitem = item as ActionQueueItem; if (aitem != null) { aitem.DoCost = 0; } } Singleton <SimulationManager> .instance.AddAction(() => { Debug.Log("Action " + item); PerformingAction = true; if (!(redo ? item.Redo() : item.Undo())) { InvalidateAll(); PlayDisabledSound(); } else { PlayEnabledSound(); } PerformingAction = false; }); } else { PlayDisabledSound(); } }
public void Redo() { IActionQueueItem item = Queue.Next(); UndoRedoImpl(item, true); }
/*public void InvalidateQueue() * { * Debug.LogWarning("Invalidate queue"); * Queue.Clear(); * //Invalidator.Instance.Clear(); * WrappersDictionary.CollectGarbage(force: true); * }*/ public void Undo() { IActionQueueItem item = Queue.Previous(); UndoRedoImpl(item, false); }