예제 #1
0
            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=============");
        }
예제 #3
0
 public void Execute(Transition transition)
 {
     this.transitions.Add(transition);
     if (!this.running)
     {
         this.taskResult = Executors.RunOnCoroutine(this.DoTask());
     }
 }
예제 #4
0
 public void Shutdown()
 {
     if (this.taskResult != null)
     {
         this.taskResult.Cancel();
         this.running = false;
         this.taskResult = null;
     }
     this.transitions.Clear();
 }
예제 #5
0
        public static void Dispose()
        {
            if (result != null)
            {
                result.Cancel();
                result = null;
            }

            if (luaEnv != null)
            {
                luaEnv.Dispose();
                luaEnv = null;
            }

            wait = null;
        }