internal void ShowInternal(TransitionParameters parameters = default)
        {
            if (this.hiddenByDefault == true || this.internalManualShow == true)
            {
                if (this.internalManualShow == false)
                {
                    this.Hide(TransitionParameters.Default.ReplaceImmediately(true));
                    this.SetInvisible();
                }

                parameters.RaiseCallback();
                return;
            }

            if (this.objectState <= ObjectState.Initializing)
            {
                Debug.LogWarning("Object is out of state: " + this, this);
                return;
            }

            var cObj         = this;
            var cParams      = parameters;
            var cbParameters = parameters.ReplaceCallbackWithContext(WindowSystem.SetShown, cObj, cParams);

            WindowSystem.ShowInstance(this, cbParameters, internalCall: true);
        }
        public void Show(TransitionParameters parameters = default)
        {
            if (this.objectState <= ObjectState.Initializing)
            {
                if (this.objectState == ObjectState.NotInitialized)
                {
                    this.DoInit();
                }
                else
                {
                    Debug.LogWarning("Object is out of state: " + this, this);
                    return;
                }
            }

            this.internalManualShow = true;

            if (this.objectState == ObjectState.Showing || this.objectState == ObjectState.Shown)
            {
                parameters.RaiseCallback();
                return;
            }

            var cObj         = this;
            var cParams      = parameters;
            var cbParameters = parameters.ReplaceCallbackWithContext(WindowSystem.SetShown, cObj, cParams);

            WindowSystem.ShowInstance(this, cbParameters, internalCall: true);
        }
示例#3
0
        public static void HideAll(System.Predicate <WindowBase> predicate, TransitionParameters parameters = default)
        {
            var currentList   = WindowSystem.instance.currentWindows;
            var count         = currentList.Count;
            var filteredCount = 0;

            for (int i = 0; i < count; ++i)
            {
                var instance = currentList[i].instance;
                if (predicate == null || predicate.Invoke(instance) == true)
                {
                    ++filteredCount;
                }
            }

            var ptr = 0;
            var instanceParameters = parameters.ReplaceCallback(() => {
                ++ptr;
                if (ptr == filteredCount)
                {
                    parameters.RaiseCallback();
                }
            });

            for (int i = 0; i < count; ++i)
            {
                var instance = currentList[i].instance;
                if (predicate == null || predicate.Invoke(instance) == true)
                {
                    instance.Hide(instanceParameters);
                }
            }
        }
示例#4
0
        public void Show(TransitionParameters parameters = default)
        {
            if (this.objectState <= ObjectState.Initializing)
            {
                Debug.LogWarning("Object is out of state: " + this, this);
                return;
            }

            if (this.hiddenByDefault == true && this.window.GetState() == ObjectState.Showing)
            {
                {
                    this.Hide(TransitionParameters.Default.ReplaceImmediately(true));
                    this.SetInvisible();
                }

                parameters.RaiseCallback();
                return;
            }

            var cbParameters = parameters.ReplaceCallback(() => {
                WindowSystem.SetShown(this, parameters);
            });

            WindowSystem.ShowInstance(this, cbParameters);
        }
示例#5
0
        public virtual void Hide(TransitionParameters parameters = default)
        {
            var cbParameters = parameters.ReplaceCallback(() => {
                WindowSystem.SetHidden(this, parameters);
            });

            WindowSystem.HideInstance(this, cbParameters);
        }
示例#6
0
        public override void Hide(TransitionParameters parameters = default)
        {
            var newParameters = parameters.ReplaceCallback(() => {
                this.PushToPool();
                parameters.RaiseCallback();
            });

            base.Hide(newParameters);
        }
 public void ShowHide(bool state, TransitionParameters parameters = default)
 {
     if (state == true)
     {
         this.Show(parameters);
     }
     else
     {
         this.Hide(parameters);
     }
 }
示例#8
0
        public static void ShowInstance(WindowObject instance, TransitionParameters parameters)
        {
            if (instance.objectState == ObjectState.Showing || instance.objectState == ObjectState.Shown)
            {
                parameters.RaiseCallback();
                return;
            }
            instance.SetState(ObjectState.Showing);

            instance.OnShowBeginInternal();
            instance.OnShowBegin();
            WindowSystem.RaiseEvent(instance, WindowEvent.OnShowBegin);

            {
                if (instance.gameObject.activeSelf == false)
                {
                    instance.gameObject.SetActive(true);
                }
                instance.SetVisible();
                instance.SetResetState();

                var animationComplete = false;
                var childsComplete    = false;
                Coroutines.CallInSequence(() => {
                    childsComplete = true;

                    if (animationComplete == true)
                    {
                        parameters.RaiseCallback();
                    }
                }, instance.subObjects, (obj, cb) => {
                    obj.Show(parameters.ReplaceCallback(cb));
                });

                var closureParameters = new ShowHideClosureParameters()
                {
                    instance   = instance,
                    parameters = parameters,
                };
                WindowObjectAnimation.Show(closureParameters, instance, parameters, (cParams) => {
                    animationComplete = true;
                    if (childsComplete == true)
                    {
                        cParams.parameters.RaiseCallback();
                    }
                });
            }
        }
示例#9
0
        public static void HideInstance(WindowObject instance, TransitionParameters parameters)
        {
            if (instance.objectState <= ObjectState.Initializing)
            {
                Debug.LogWarning("Object is out of state: " + instance, instance);
                return;
            }

            if (instance.objectState == ObjectState.Hiding || instance.objectState == ObjectState.Hidden)
            {
                parameters.RaiseCallback();
                return;
            }
            instance.SetState(ObjectState.Hiding);

            instance.OnHideBeginInternal();
            instance.OnHideBegin();
            WindowSystem.RaiseEvent(instance, WindowEvent.OnHideBegin);

            {
                var animationComplete = false;
                var childsComplete    = false;
                Coroutines.CallInSequence(() => {
                    childsComplete = true;

                    if (animationComplete == true)
                    {
                        parameters.RaiseCallback();
                    }
                }, instance.subObjects, (obj, cb) => {
                    obj.Hide(parameters.ReplaceCallback(cb));
                });

                var closureParameters = new ShowHideClosureParameters()
                {
                    instance   = instance,
                    parameters = parameters,
                };
                WindowObjectAnimation.Hide(closureParameters, instance, parameters, (cParams) => {
                    animationComplete = true;
                    if (childsComplete == true)
                    {
                        cParams.parameters.RaiseCallback();
                    }
                });
            }
        }
示例#10
0
        internal static void SetShown(WindowObject instance, TransitionParameters parameters)
        {
            if (instance.objectState != ObjectState.Showing)
            {
                parameters.RaiseCallback();
                return;
            }

            var innerParameters = parameters.ReplaceCallback(null);

            for (int i = 0; i < instance.subObjects.Count; ++i)
            {
                WindowSystem.SetShown(instance.subObjects[i], innerParameters);
            }

            instance.OnShowEndInternal();
            instance.OnShowEnd();
            WindowSystem.RaiseEvent(instance, WindowEvent.OnShowEnd);

            instance.SetState(ObjectState.Shown);

            parameters.RaiseCallback();
        }
        public TransitionParameters ReplaceCallbackWithContext(System.Action <WindowObject, TransitionParameters> callback, WindowObject context, TransitionParameters other)
        {
            var instance = this;

            instance.data.callback   = null;
            instance.contextCallback = callback;
            instance.internalData    = new TransitionInternalData()
            {
                context = context, data = other.data
            };
            return(instance);
        }
示例#12
0
 public static void HideAll(TransitionParameters parameters = default)
 {
     WindowSystem.HideAll(null, parameters);
 }
示例#13
0
 public static void HideAll <T>(TransitionParameters parameters = default) where T : WindowBase
 {
     WindowSystem.HideAll((x) => x is T, parameters);
 }