コード例 #1
0
            protected override IEnumerator DoTransition()
            {
                IManageable current = this.Window;

                if (this.manager.IndexOf(current) == 0)
                {
                    if (current.Activated)
                    {
                        IAsyncResult passivate = current.Passivate(this.AnimationDisabled);
                        yield return(passivate.WaitForDone());
                    }

                    if (current.Visibility)
                    {
                        IAsyncResult hide = current.DoHide(this.AnimationDisabled);
                        yield return(hide.WaitForDone());
                    }
                }
                else
                {
                    if (current.Visibility)
                    {
                        IAsyncResult hide = current.DoHide(this.AnimationDisabled);
                        yield return(hide.WaitForDone());
                    }
                }

                if (dismiss)
                {
                    current.DoDismiss();
                }
            }
コード例 #2
0
        public static void Dispose()
        {
            if (result != null)
            {
                result.Cancel();
                result = null;
            }

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

            wait = null;
        }
コード例 #3
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)))
                            {
                                IAsyncResult activate = (current as IManageable).Activate(transition.AnimationDisabled);
                                yield return(activate.WaitForDone());
                            }
                        }
                        else
                        {
                            yield return(null);
                        }
                    }
                }
                finally
                {
                    this.running    = false;
                    this.taskResult = null;
                }
            }
コード例 #4
0
        IEnumerator Start()
        {
            //Executors.Create();

            //int n = Environment.CurrentManagedThreadId;

            //Debug.LogFormat("ThreadId:{0}",n);

            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);

            Loxodon.Framework.Asynchronous.IAsyncResult result = Executors.RunOnCoroutine(DoRun());

            yield return(result.WaitForDone());

            Debug.LogFormat("============finished=============");
        }
コード例 #5
0
            protected override IEnumerator DoTransition()
            {
                IManageable current = this.Window;
                int         layer   = (this.Layer < 0 || current.WindowType == WindowType.DIALOG || current.WindowType == WindowType.PROGRESS) ? 0 : this.Layer;

                if (layer > 0)
                {
                    int visibleCount = this.manager.VisibleCount;
                    if (layer > visibleCount)
                    {
                        layer = visibleCount;
                    }
                }
                this.Layer = layer;

                IManageable previous = (IManageable)this.manager.GetVisibleWindow(layer);

                if (previous != null)
                {
                    //Passivate the previous window
                    if (previous.Activated)
                    {
                        IAsyncResult passivate = previous.Passivate(this.AnimationDisabled);
                        yield return(passivate.WaitForDone());
                    }

                    Func <IWindow, IWindow, ActionType> policy = this.OverlayPolicy;
                    if (policy == null)
                    {
                        policy = this.Overlay;
                    }
                    ActionType actionType = policy(previous, current);
                    switch (actionType)
                    {
                    case ActionType.Hide:
                        previous.DoHide(this.AnimationDisabled);
                        break;

                    case ActionType.Dismiss:
                        previous.DoHide(this.AnimationDisabled).Callbackable().OnCallback((r) =>
                        {
                            previous.DoDismiss();
                        });
                        break;

                    default:
                        break;
                    }
                }

                if (!current.Visibility)
                {
                    IAsyncResult show = current.DoShow(this.AnimationDisabled);
                    yield return(show.WaitForDone());
                }

                if (this.manager.Activated && current.Equals(this.manager.Current))
                {
                    IAsyncResult activate = current.Activate(this.AnimationDisabled);
                    yield return(activate.WaitForDone());
                }
            }