コード例 #1
0
        /// <summary>
        /// Show the specified onShowEnd.
        /// </summary>
        /// <param name="onShowEnd">On show end.</param>
        public void Show(System.Action onShowEnd, TransitionBase transition, TransitionInputParameters transitionParameters)
        {
            if (this.currentState == WindowObjectState.Showing || this.currentState == WindowObjectState.Shown)
            {
                return;
            }
            this.currentState = WindowObjectState.Showing;

            WindowSystem.AddToHistory(this);

            var counter = 0;

            System.Action callback = () => {
                if (this.currentState != WindowObjectState.Showing)
                {
                    return;
                }

                ++counter;
                if (counter < 5)
                {
                    return;
                }

                this.OnShowEnd();
                this.OnLayoutShowEnd();
                this.modules.OnShowEnd();
                this.events.OnShowEnd();
                this.transition.OnShowEnd();
                if (onShowEnd != null)
                {
                    onShowEnd();
                }

                CanvasUpdater.ForceUpdate();

                this.currentState = WindowObjectState.Shown;
            };

            this.OnLayoutShowBegin(callback);
            this.modules.OnShowBegin(callback);

            if (transition != null)
            {
                this.transition.OnShowBegin(transition, transitionParameters, callback);
            }
            else
            {
                this.transition.OnShowBegin(callback);
            }

            this.events.OnShowBegin(callback);
            this.OnShowBegin(callback);

            this.gameObject.SetActive(true);
        }
コード例 #2
0
        /// <summary>
        /// Hide the specified onHideEnd with specific transition.
        /// Wait while all components, animations, events and modules return the callback.
        /// </summary>
        /// <param name="onHideEnd">On hide end.</param>
        /// <param name="transition">Transition.</param>
        /// <param name="transitionParameters">Transition parameters.</param>
        public bool Hide(System.Action onHideEnd, TransitionBase transition, TransitionInputParameters transitionParameters)
        {
            if (this.currentState == WindowObjectState.Hidden || this.currentState == WindowObjectState.Hiding)
            {
                return(false);
            }
            this.currentState = WindowObjectState.Hiding;

            var counter = 0;

            System.Action callback = () => {
                if (this.currentState != WindowObjectState.Hiding)
                {
                    return;
                }

                ++counter;
                if (counter < 5)
                {
                    return;
                }

                WindowSystem.AddToHistory(this);

                this.Recycle();

                this.OnHideEnd();
                this.OnLayoutHideEnd();
                this.modules.OnHideEnd();
                this.events.OnHideEnd();
                this.transition.OnHideEnd();
                if (onHideEnd != null)
                {
                    onHideEnd();
                }

                this.currentState = WindowObjectState.Hidden;
            };

            this.OnLayoutHideBegin(callback);
            this.modules.OnHideBegin(callback);

            if (transition != null)
            {
                this.transition.OnHideBegin(transition, transitionParameters, callback);
            }
            else
            {
                this.transition.OnHideBegin(callback);
            }

            this.events.OnHideBegin(callback);
            this.OnHideBegin(callback, immediately: false);

            return(true);
        }
コード例 #3
0
        public bool Hide(System.Action onHideEnd)
        {
            if (this.currentState == WindowObjectState.Hidden || this.currentState == WindowObjectState.Hiding)
            {
                return(false);
            }
            this.currentState = WindowObjectState.Hiding;

            var counter = 0;

            System.Action callback = () => {
                if (this.currentState != WindowObjectState.Hiding)
                {
                    return;
                }

                ++counter;
                if (counter < 5)
                {
                    return;
                }

                WindowSystem.AddToHistory(this);

                this.Recycle();

                this.OnHideEnd();
                this.OnLayoutHideEnd();
                this.modules.OnHideEnd();
                this.events.OnHideEnd();
                this.transition.OnHideEnd();
                if (onHideEnd != null)
                {
                    onHideEnd();
                }

                this.events.Clear();

                this.currentState = WindowObjectState.Hidden;
            };

            this.OnLayoutHideBegin(callback);
            this.modules.OnHideBegin(callback);
            this.transition.OnHideBegin(callback);
            this.events.OnHideBegin(callback);
            this.OnHideBegin(callback);

            return(true);
        }
コード例 #4
0
        /// <summary>
        /// Show the specified onShowEnd.
        /// </summary>
        /// <param name="onShowEnd">On show end.</param>
        public void Show(System.Action onShowEnd)
        {
            if (this.currentState == WindowObjectState.Showing || this.currentState == WindowObjectState.Shown)
            {
                return;
            }
            this.currentState = WindowObjectState.Showing;

            WindowSystem.AddToHistory(this);

            var counter = 0;

            System.Action callback = () => {
                if (this.currentState != WindowObjectState.Showing)
                {
                    return;
                }

                ++counter;
                if (counter < 5)
                {
                    return;
                }

                this.OnShowEnd();
                this.OnLayoutShowEnd();
                this.modules.OnShowEnd();
                this.events.OnShowEnd();
                this.transition.OnShowEnd();
                if (onShowEnd != null)
                {
                    onShowEnd();
                }

                this.currentState = WindowObjectState.Shown;
            };

            this.OnLayoutShowBegin(callback);
            this.modules.OnShowBegin(callback);
            this.transition.OnShowBegin(callback);
            this.events.OnShowBegin(callback);
            this.OnShowBegin(callback);

            this.gameObject.SetActive(true);
        }
コード例 #5
0
        private void Show_INTERNAL(System.Action onShowEnd, AttachItem transitionItem)
        {
            if (WindowSystem.IsCallEventsEnabled() == false)
            {
                return;
            }

            if (this.currentState == WindowObjectState.Showing || this.currentState == WindowObjectState.Shown)
            {
                return;
            }
            this.currentState = WindowObjectState.Showing;

            WindowSystem.AddToHistory(this);

            //if (this.gameObject.activeSelf == false) this.gameObject.SetActive(true);
            this.StartCoroutine(this.Show_INTERNAL_YIELD(onShowEnd, transitionItem));
        }
コード例 #6
0
 /// <summary>
 /// Adds to history.
 /// </summary>
 /// <param name="window">Window.</param>
 public static void AddToHistory(WindowBase window)
 {
     WindowSystem.AddToHistory(window, window.GetState());
 }
コード例 #7
0
        private IEnumerator Hide_INTERNAL_YIELD(System.Action onHideEnd, AttachItem transitionItem)
        {
            while (this.paused == true)
            {
                yield return(false);
            }

            this.activeIteration = 0;
            this.SetInactive();

            if (this.preferences.sendActiveState == true)
            {
                WindowSystem.SendActiveStateByWindow(this);
            }

            var parameters = AppearanceParameters.Default();

            var counter = 0;

            System.Action callback = () => {
                if (this.currentState != WindowObjectState.Hiding)
                {
                    return;
                }

                ++counter;
                if (counter < 6)
                {
                    return;
                }

                WindowSystem.AddToHistory(this);

                                #if UNITY_EDITOR
                Profiler.BeginSample("WindowBase::OnHideEnd()");
                                #endif

                this.DoLayoutHideEnd(parameters);
                this.modules.DoHideEnd(parameters);
                this.audio.DoHideEnd(parameters);
                this.events.DoHideEnd(parameters);
                this.transition.DoHideEnd(parameters);
                this.DoHideEnd(parameters);
                if (onHideEnd != null)
                {
                    onHideEnd();
                }

                                #if UNITY_EDITOR
                Profiler.EndSample();
                                #endif

                this.currentState = WindowObjectState.Hidden;

                this.Recycle(setInactive: this.TurnOff());
            };

            parameters = parameters.ReplaceCallback(callback);

                        #if UNITY_EDITOR
            Profiler.BeginSample("WindowBase::OnHideBegin()");
                        #endif

            this.DoLayoutHideBegin(parameters);

            this.modules.DoHideBegin(parameters);

            if (transitionItem != null && transitionItem.audioTransition != null)
            {
                this.audio.DoHideBegin(transitionItem.audioTransition, transitionItem.audioTransitionParameters, parameters);
            }
            else
            {
                this.audio.DoHideBegin(parameters);
            }

            this.events.DoHideBegin(parameters);

            if (transitionItem != null && transitionItem.transition != null)
            {
                this.transition.DoHideBegin(transitionItem.transition, transitionItem.transitionParameters, parameters);
            }
            else
            {
                this.transition.DoHideBegin(parameters);
            }

            this.DoHideBegin(parameters);

                        #if UNITY_EDITOR
            Profiler.EndSample();
                        #endif
        }
コード例 #8
0
        private IEnumerator Hide_INTERNAL_YIELD(System.Action onHideEnd, AttachItem transitionItem)
        {
            while (this.paused == true)
            {
                yield return(false);
            }

            var parameters = AppearanceParameters.Default();

            var counter = 0;

            System.Action callback = () => {
                if (this.currentState != WindowObjectState.Hiding)
                {
                    return;
                }

                ++counter;
                if (counter < 6)
                {
                    return;
                }

                WindowSystem.AddToHistory(this);

                this.Recycle();

                this.DoLayoutHideEnd(parameters);
                this.modules.DoHideEnd(parameters);
                this.audio.DoHideEnd(parameters);
                this.events.DoHideEnd(parameters);
                this.transition.DoHideEnd(parameters);
                this.DoHideEnd(parameters);
                if (onHideEnd != null)
                {
                    onHideEnd();
                }

                this.currentState = WindowObjectState.Hidden;

                if (this != null && this.gameObject != null)
                {
                    this.gameObject.SetActive(false);
                }
            };

            parameters = parameters.ReplaceCallback(callback);

            this.DoLayoutHideBegin(parameters);

            this.modules.DoHideBegin(parameters);

            if (transitionItem != null && transitionItem.audioTransition != null)
            {
                this.audio.DoHideBegin(transitionItem.audioTransition, transitionItem.audioTransitionParameters, parameters);
            }
            else
            {
                this.audio.DoHideBegin(parameters);
            }

            this.events.DoHideBegin(parameters);

            if (transitionItem != null && transitionItem.transition != null)
            {
                this.transition.DoHideBegin(transitionItem.transition, transitionItem.transitionParameters, parameters);
            }
            else
            {
                this.transition.DoHideBegin(parameters);
            }

            this.DoHideBegin(parameters);

            yield return(true);
        }