protected virtual IEnumerator DoTask() { try { this.running = true; yield return null;//wait one frame while (this.transitions.Count > 0) { Transition transition = this.transitions.Find(e => Check(e)); if (transition != null) { this.transitions.Remove(transition); var result = Executors.RunOnCoroutine(transition.TransitionTask()); yield return result.WaitForDone(); IWindowManager manager = transition.Window.WindowManager; var current = manager.Current; if (manager.Activated && current != null && !current.Activated && !this.transitions.Exists((e) => e.Window.WindowManager.Equals(manager))) { IAsyncTask activate = (current as Window).Activate(transition.AnimationDisabled).Start(); yield return activate.WaitForDone(); } } else { yield return null; } } } finally { this.running = false; this.taskResult = null; } }
IEnumerator Start() { Executors.RunAsync(() => { Debug.LogFormat("RunAsync "); }); Executors.RunAsync(() => { #if NETFX_CORE Task.Delay(1000).Wait(); #endif Executors.RunOnMainThread(() => { Debug.LogFormat("RunOnMainThread Time:{0} frame:{1}", Time.time, Time.frameCount); }, true); }); Executors.RunOnMainThread(() => { Debug.LogFormat("RunOnMainThread 2 Time:{0} frame:{1}", Time.time, Time.frameCount); }, false); Asynchronous.IAsyncResult result = Executors.RunOnCoroutine(DoRun()); yield return(result.WaitForDone()); Debug.LogFormat("============finished============="); }
public void Execute(Transition transition) { this.transitions.Add(transition); if (!this.running) { this.taskResult = Executors.RunOnCoroutine(this.DoTask()); } }
public void Shutdown() { if (this.taskResult != null) { this.taskResult.Cancel(); this.running = false; this.taskResult = null; } this.transitions.Clear(); }
public static void Dispose() { if (result != null) { result.Cancel(); result = null; } if (luaEnv != null) { luaEnv.Dispose(); luaEnv = null; } wait = null; }