Esempio n. 1
0
 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();
     }
 }
Esempio n. 2
0
        public void Redo()
        {
            IActionQueueItem item = Queue.Next();

            UndoRedoImpl(item, true);
        }
Esempio n. 3
0
        /*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);
        }