コード例 #1
0
ファイル: UndoMod.cs プロジェクト: Strdate/UndoMod
 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();
     }
 }
コード例 #2
0
ファイル: UndoMod.cs プロジェクト: Strdate/UndoMod
        public void Redo()
        {
            IActionQueueItem item = Queue.Next();

            UndoRedoImpl(item, true);
        }
コード例 #3
0
ファイル: UndoMod.cs プロジェクト: Strdate/UndoMod
        /*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);
        }