Ejemplo n.º 1
0
 public static void LongEventsUpdate(out bool sceneChanged)
 {
     sceneChanged = false;
     if (LongEventHandler.currentEvent != null)
     {
         if (LongEventHandler.currentEvent.eventActionEnumerator != null)
         {
             LongEventHandler.UpdateCurrentEnumeratorEvent();
         }
         else if (LongEventHandler.currentEvent.doAsynchronously)
         {
             LongEventHandler.UpdateCurrentAsynchronousEvent();
         }
         else
         {
             LongEventHandler.UpdateCurrentSynchronousEvent(out sceneChanged);
         }
     }
     if (LongEventHandler.currentEvent == null && LongEventHandler.eventQueue.Count > 0)
     {
         LongEventHandler.currentEvent = LongEventHandler.eventQueue.Dequeue();
         if (LongEventHandler.currentEvent.eventTextKey == null)
         {
             LongEventHandler.currentEvent.eventText = string.Empty;
         }
         else
         {
             LongEventHandler.currentEvent.eventText = LongEventHandler.currentEvent.eventTextKey.Translate();
         }
     }
 }
Ejemplo n.º 2
0
 private static void UpdateCurrentSynchronousEvent(out bool sceneChanged)
 {
     sceneChanged = false;
     if (LongEventHandler.currentEvent.ShouldWaitUntilDisplayed)
     {
         return;
     }
     try
     {
         if (LongEventHandler.currentEvent.eventAction != null)
         {
             LongEventHandler.currentEvent.eventAction();
         }
         if (!LongEventHandler.currentEvent.levelToLoad.NullOrEmpty())
         {
             SceneManager.LoadScene(LongEventHandler.currentEvent.levelToLoad);
             sceneChanged = true;
         }
         LongEventHandler.currentEvent = null;
         LongEventHandler.eventThread  = null;
         LongEventHandler.levelLoadOp  = null;
         LongEventHandler.ExecuteToExecuteWhenFinished();
     }
     catch (Exception ex)
     {
         Log.Error("Exception from long event: " + ex);
         if (LongEventHandler.currentEvent != null && LongEventHandler.currentEvent.exceptionHandler != null)
         {
             LongEventHandler.currentEvent.exceptionHandler(ex);
         }
         LongEventHandler.currentEvent = null;
         LongEventHandler.eventThread  = null;
         LongEventHandler.levelLoadOp  = null;
     }
 }
Ejemplo n.º 3
0
 public static void QueueLongEvent(IEnumerable action, string textKey, Action <Exception> exceptionHandler = null)
 {
     LongEventHandler.QueuedLongEvent queuedLongEvent = new LongEventHandler.QueuedLongEvent();
     queuedLongEvent.eventActionEnumerator    = action.GetEnumerator();
     queuedLongEvent.eventTextKey             = textKey;
     queuedLongEvent.doAsynchronously         = false;
     queuedLongEvent.exceptionHandler         = exceptionHandler;
     queuedLongEvent.canEverUseStandardWindow = !LongEventHandler.AnyEventWhichDoesntUseStandardWindowNowOrWaiting;
     LongEventHandler.eventQueue.Enqueue(queuedLongEvent);
 }
Ejemplo n.º 4
0
 public static void QueueLongEvent(Action action, string textKey, bool doAsynchronously, Action <Exception> exceptionHandler)
 {
     LongEventHandler.QueuedLongEvent queuedLongEvent = new LongEventHandler.QueuedLongEvent();
     queuedLongEvent.eventAction              = action;
     queuedLongEvent.eventTextKey             = textKey;
     queuedLongEvent.doAsynchronously         = doAsynchronously;
     queuedLongEvent.exceptionHandler         = exceptionHandler;
     queuedLongEvent.canEverUseStandardWindow = !LongEventHandler.AnyEventWhichDoesntUseStandardWindowNowOrWaiting;
     LongEventHandler.eventQueue.Enqueue(queuedLongEvent);
 }
Ejemplo n.º 5
0
 private static void UpdateCurrentEnumeratorEvent()
 {
     try
     {
         float num = Time.realtimeSinceStartup + 0.1f;
         while (LongEventHandler.currentEvent.eventActionEnumerator.MoveNext())
         {
             if (num <= Time.realtimeSinceStartup)
             {
                 return;
             }
         }
         IDisposable disposable = LongEventHandler.currentEvent.eventActionEnumerator as IDisposable;
         if (disposable != null)
         {
             disposable.Dispose();
         }
         LongEventHandler.currentEvent = null;
         LongEventHandler.eventThread  = null;
         LongEventHandler.levelLoadOp  = null;
         LongEventHandler.ExecuteToExecuteWhenFinished();
     }
     catch (Exception ex)
     {
         Log.Error("Exception from long event: " + ex);
         if (LongEventHandler.currentEvent != null)
         {
             IDisposable disposable2 = LongEventHandler.currentEvent.eventActionEnumerator as IDisposable;
             if (disposable2 != null)
             {
                 disposable2.Dispose();
             }
             if (LongEventHandler.currentEvent.exceptionHandler != null)
             {
                 LongEventHandler.currentEvent.exceptionHandler(ex);
             }
         }
         LongEventHandler.currentEvent = null;
         LongEventHandler.eventThread  = null;
         LongEventHandler.levelLoadOp  = null;
     }
 }
Ejemplo n.º 6
0
 private static void UpdateCurrentAsynchronousEvent()
 {
     if (LongEventHandler.eventThread == null)
     {
         LongEventHandler.eventThread = new Thread(delegate
         {
             LongEventHandler.RunEventFromAnotherThread(LongEventHandler.currentEvent.eventAction);
         });
         LongEventHandler.eventThread.Start();
     }
     else if (!LongEventHandler.eventThread.IsAlive)
     {
         bool flag = false;
         if (!LongEventHandler.currentEvent.levelToLoad.NullOrEmpty())
         {
             if (LongEventHandler.levelLoadOp == null)
             {
                 LongEventHandler.levelLoadOp = SceneManager.LoadSceneAsync(LongEventHandler.currentEvent.levelToLoad);
             }
             else if (LongEventHandler.levelLoadOp.isDone)
             {
                 flag = true;
             }
         }
         else
         {
             flag = true;
         }
         if (flag)
         {
             LongEventHandler.currentEvent = null;
             LongEventHandler.eventThread  = null;
             LongEventHandler.levelLoadOp  = null;
             LongEventHandler.ExecuteToExecuteWhenFinished();
         }
     }
 }
Ejemplo n.º 7
0
 private static bool <get_AnyEventWhichDoesntUseStandardWindowNowOrWaiting> m__0(LongEventHandler.QueuedLongEvent x)
 {
     return(!x.UseStandardWindow);
 }