public AppearanceParameters(AppearanceParameters other)
        {
            this.replaceCallback = other.replaceCallback;
            this.callback        = other.callback;

            this.replaceDelay = other.replaceDelay;
            this.delay        = other.delay;

            this.replaceImmediately = other.replaceImmediately;
            this.immediately        = other.immediately;

            this.replaceResetAnimation = other.replaceResetAnimation;
            this.resetAnimation        = other.resetAnimation;

            this.replaceIncludeChilds = other.replaceIncludeChilds;
            this.includeChilds        = other.includeChilds;

            this.replaceChildsBehaviourMode = other.replaceChildsBehaviourMode;
            this.childsBehaviourMode        = other.childsBehaviourMode;

            this.replaceForced = other.replaceForced;
            this.forced        = other.forced;

            this.replaceManual = other.replaceManual;
            this.manual        = other.manual;
        }
Exemple #2
0
 public void ShowExcludeChilds(System.Action callback = null, bool resetAnimation = true)
 {
     this.Show(AppearanceParameters.Default()
               .ReplaceCallback(callback: callback)
               .ReplaceResetAnimation(resetAnimation: resetAnimation)
               .ReplaceIncludeChilds(includeChilds: false));
 }
Exemple #3
0
        /*public string GetCustomTag(int custom) {
         *
         *      return string.Format("{0}_{1}", this.GetInstanceID(), custom);
         *
         * }*/

        #region Manual Events
        public void HideExcludeChilds(System.Action callback = null, bool immediately = false)
        {
            this.Hide(AppearanceParameters.Default()
                      .ReplaceCallback(callback: callback)
                      .ReplaceImmediately(immediately: immediately)
                      .ReplaceIncludeChilds(includeChilds: false));
        }
Exemple #4
0
        private void DoShowBeginManualControl(AppearanceParameters parameters)
        {
            if (this.GetComponentState() == WindowObjectState.NotInitialized ||
                this.GetComponentState() == WindowObjectState.Initializing ||
                this.GetComponentState() == WindowObjectState.Initialized)
            {
                this.RefreshComponentState();
                parameters.Call();
                return;
            }

            if (this.IsStateReadyToShow() == false &&
                parameters.GetForced(defaultValue: false) == false)
            {
                this.RefreshComponentState();
                parameters.Call();
                return;
            }

            for (int i = 0; i < this.subComponents.Count; ++i)
            {
                var sub = this.subComponents[i] as WindowComponentBase;
                sub.DoShowBeginManualControl(parameters.ReplaceCallback(null));
            }

            //WindowSystem.RunSafe(this.OnShowBegin);
            //WindowSystem.RunSafe(this.OnShowBegin, parameters);

            this.RefreshComponentState();
            parameters.Call();
        }
Exemple #5
0
        private void Hide_INTERNAL(AppearanceParameters parameters)
        {
            WindowSystem.GetHistoryTracker().Add(this, parameters, HistoryTrackerEventType.HideManual);

            this.manualShowHideControl = true;

            //parameters = parameters.ReplaceManual(manual: true);

            var callback         = parameters.GetCallback(null);
            var parametersResult = parameters.ReplaceCallback(() => {
                if (this.GetComponentState() != WindowObjectState.Hiding)
                {
                    if (callback != null)
                    {
                        callback.Invoke();
                    }
                    return;
                }

                this.DoHideEnd_INTERNAL(parameters);
                if (callback != null)
                {
                    callback.Invoke();
                }
            });

            parametersResult = parametersResult.ReplaceForced(forced: true);

            this.DoHideBegin_INTERNAL(parametersResult);
        }
Exemple #6
0
        public override void DoHideEnd(AppearanceParameters parameters)
        {
            if (this == null)
            {
                return;
            }

            if (this.GetComponentState() == WindowObjectState.NotInitialized ||
                this.GetComponentState() == WindowObjectState.Initializing ||
                this.GetComponentState() == WindowObjectState.Initialized)
            {
                //parameters.Call();
                return;
            }

            if (this.manualShowHideControl == true)
            {
                this.DoHideEndManualControl(parameters);
                return;
            }

            WindowSystem.GetHistoryTracker().Add(this, HistoryTrackerEventType.HideEnd);

            WindowSystem.GetEvents().Raise(this, WindowEventType.OnHideEnd);

            this.DoHideEnd_INTERNAL(parameters);
        }
Exemple #7
0
        public override void DoHideBegin(AppearanceParameters parameters)
        {
            if (this == null)
            {
                parameters.Call();
                return;
            }

            if (this.GetComponentState() == WindowObjectState.NotInitialized ||
                this.GetComponentState() == WindowObjectState.Initializing ||
                this.GetComponentState() == WindowObjectState.Initialized)
            {
                this.RefreshComponentState();
                parameters.Call();
                return;
            }

            if (parameters.GetManual(false) == true)
            {
                this.Hide(parameters);
                return;
            }

            if (this.manualShowHideControl == true)
            {
                this.DoHideBeginManualControl(parameters);
                return;
            }

            WindowSystem.GetHistoryTracker().Add(this, parameters, HistoryTrackerEventType.HideBegin);

            this.DoHideBegin_INTERNAL(parameters);
        }
Exemple #8
0
        public void Hide(AppearanceParameters parameters)
        {
            if ((this.GetComponentState() == WindowObjectState.Hidden ||
                 this.GetComponentState() == WindowObjectState.Hiding) &&
                parameters.GetForced(defaultValue: false) == false)
            {
                return;
            }

            this.eventsHistoryTracker.Add(this, parameters, HistoryTrackerEventType.HideManual);

            this.manualShowHideControl = true;

            var callback = parameters.callback;

            parameters.callback = () => {
                if (this.GetComponentState() != WindowObjectState.Hiding)
                {
                    if (callback != null)
                    {
                        callback.Invoke();
                    }
                    return;
                }

                this.DoHideEnd_INTERNAL(parameters);
                if (callback != null)
                {
                    callback.Invoke();
                }
            };

            this.DoHideBegin_INTERNAL(parameters);
        }
Exemple #9
0
 public void Add(WindowObject component, AppearanceParameters parameters, HistoryTrackerEventType eventType)
 {
     if (WindowSystemLogger.IsActiveComponents() == true)
     {
         var stack = new StackTrace();
         this.items.Add(new Item(stack.GetFrames(), parameters, eventType));
     }
 }
Exemple #10
0
        private void DoHideBeginAnimation_INTERNAL(System.Action callback, AppearanceParameters parameters)
        {
            if (TweenerGlobal.instance == null)
            {
                return;
            }

            var resetAnimation = parameters.GetResetAnimation(defaultValue: false);
            var immediately    = parameters.GetImmediately(defaultValue: false);
            var delay          = parameters.GetDelay(defaultValue: 0f);

            System.Action callbackInner = () => {
                if (this.animation != null)
                {
                    if (resetAnimation == true)
                    {
                        this.SetResetState();
                    }

                    if (immediately == true)
                    {
                        this.animation.SetOutState(this.animationInputParams, this.GetWindow(), this);
                        callback.Invoke();
                    }
                    else
                    {
                        this.animation.Play(this.GetWindow(), this.animationInputParams, this, false, callback);
                    }
                }
                else
                {
                    callback.Invoke();
                }
            };

            if (TweenerGlobal.instance != null)
            {
                var tag = this.GetTag();
                TweenerGlobal.instance.removeTweens(tag);
                if (immediately == false && delay > 0f)
                {
                    TweenerGlobal.instance.addTween(this, delay, 0f, 0f).tag(tag).onComplete(() => {
                        callbackInner.Invoke();
                    }).onCancel((obj) => {
                        callbackInner.Invoke();
                    });
                }
                else
                {
                    callbackInner.Invoke();
                }
            }
            else
            {
                callbackInner.Invoke();
            }
        }
        /// <summary>
        /// Raises the show begin event.
        /// </summary>
        /// <param name="callback">Callback.</param>
        public virtual void DoShowBegin(AppearanceParameters parameters)
        {
            this.OnShowBegin();
            this.OnShowBegin(parameters);
                        #pragma warning disable
            this.OnShowBegin(parameters.callback, parameters.resetAnimation);
                        #pragma warning restore

            parameters.Call();
        }
        /// <summary>
        /// Raises the hide begin event.
        /// </summary>
        /// <param name="callback">Callback.</param>
        public virtual void DoHideBegin(AppearanceParameters parameters)
        {
            this.OnHideBegin();
            this.OnHideBegin(parameters);
                        #pragma warning disable
            this.OnHideBegin(parameters.callback, parameters.immediately);
                        #pragma warning restore

            parameters.Call();
        }
		public void Add(WindowComponentBase component, AppearanceParameters parameters, HistoryTrackerEventType eventType) {
			
			if (WindowSystemLogger.IsActiveComponents() == true) {

				var stack = new StackTrace();
				this.items.Add(new Item(stack.GetFrames(), parameters, eventType));

			}

		}
Exemple #14
0
        public override void DoHideEnd(AppearanceParameters parameters)
        {
            if (this.manualShowHideControl == true)
            {
                return;
            }

            this.eventsHistoryTracker.Add(this, HistoryTrackerEventType.HideEnd);

            this.DoHideEnd_INTERNAL(parameters);
        }
Exemple #15
0
 public void ShowHide(bool state, AppearanceParameters parameters)
 {
     if (state == true)
     {
         this.Show(parameters);
     }
     else if (state == false)
     {
         this.Hide(parameters);
     }
 }
        public override void DoShowEnd(AppearanceParameters parameters)
        {
            if (this.manualShowHideControl == true || this.showOnStart == false)
            {
                return;
            }

            WindowSystem.GetHistoryTracker().Add(this, HistoryTrackerEventType.ShowEnd);

            this.DoShowEnd_INTERNAL(parameters);
        }
Exemple #17
0
        public override void DoHideBegin(AppearanceParameters parameters)
        {
            if (this.manualShowHideControl == true)
            {
                parameters.Call();
                return;
            }

            this.eventsHistoryTracker.Add(this, parameters, HistoryTrackerEventType.HideBegin);

            this.DoHideBegin_INTERNAL(parameters);
        }
Exemple #18
0
        public void Hide(AppearanceParameters parameters)
        {
            if (this.IsStateReadyToHide() == false &&
                parameters.GetForced(defaultValue: false) == false)
            {
                this.RefreshComponentState();
                parameters.Call();
                return;
            }

            this.Hide_INTERNAL(parameters);
        }
        public override void DoHideEnd(AppearanceParameters parameters)
        {
            if (this.manualShowHideControl == true)
            {
                return;
            }

            WindowSystem.GetHistoryTracker().Add(this, HistoryTrackerEventType.HideEnd);

            WindowSystem.GetEvents().Raise(this, WindowEventType.OnHideEnd);

            this.DoHideEnd_INTERNAL(parameters);
        }
        /// <summary>
        /// Raises the hide end event.
        /// You can override this method but call it's base.
        /// </summary>
        public virtual void DoHideEnd(AppearanceParameters parameters)
        {
            var includeChilds = parameters.GetIncludeChilds(defaultValue: true);

            if (includeChilds == true)
            {
                for (int i = 0; i < this.subComponents.Count; ++i)
                {
                    this.subComponents[i].DoHideEnd(parameters);
                }
            }

            this.SetComponentState(WindowObjectState.Hidden);
            this.OnHideEnd();
            this.OnHideEnd(parameters);
        }
Exemple #21
0
        /// <summary>
        /// Raises the hide end event.
        /// You can override this method but call it's base.
        /// </summary>
        public virtual void DoHideEnd(AppearanceParameters parameters)
        {
            var includeChilds = parameters.GetIncludeChilds(defaultValue: true);

            if (includeChilds == true)
            {
                for (int i = 0; i < this.subComponents.Count; ++i)
                {
                    (this.subComponents[i] as IWindowEventsController).DoHideEnd(parameters);
                }
            }

            this.SetComponentState(WindowObjectState.Hidden);
            WindowSystem.RunSafe(this.OnHideEnd);
            WindowSystem.RunSafe(this.OnHideEnd, parameters);
        }
Exemple #22
0
        private void RunChilds_INTERNAL(
            AppearanceParameters parameters,
            System.Action onResult,
            System.Action <System.Action, AppearanceParameters> onInstance,
            System.Action <WindowObjectElement, AppearanceParameters> onChildInstance
            )
        {
            var childsBehaviour = parameters.GetChildsBehaviourMode(this.childsHideMode);

            if (childsBehaviour == ChildsBehaviourMode.Simultaneously)
            {
                #region Childs Simultaneously
                var           counter  = 0;
                System.Action callback = () => {
                    ++counter;
                    if (counter < 2)
                    {
                        return;
                    }

                    onResult.Invoke();
                };

                //this.DoHideBeginAnimation_INTERNAL(callback, parameters);
                onInstance.Invoke(callback, parameters);

                ME.Utilities.CallInSequence(callback, this.subComponents, (e, c) => {
                    //e.DoHideBegin(parameters.ReplaceCallback(c));
                    onChildInstance.Invoke(e, parameters.ReplaceCallback(c));
                });
                #endregion
            }
            else if (childsBehaviour == ChildsBehaviourMode.Consequentially)
            {
                #region Childs Consequentially
                ME.Utilities.CallInSequence(() => {
                    //this.DoHideBeginAnimation_INTERNAL(onResult, parameters);
                    onInstance.Invoke(onResult, parameters);
                }, this.subComponents, (e, c) => {
                    //e.DoHideBegin(parameters.ReplaceCallback(c));
                    onChildInstance.Invoke(e, parameters.ReplaceCallback(c));
                }, waitPrevious: true);
                #endregion
            }
        }
Exemple #23
0
        public virtual void DoHideBegin(AppearanceParameters parameters)
        {
            this.SetComponentState(WindowObjectState.Hiding);
            WindowSystem.RunSafe(this.OnHideBegin);
            WindowSystem.RunSafe(this.OnHideBegin, parameters);

            var includeChilds = parameters.GetIncludeChilds(defaultValue: true);

            if (includeChilds == true)
            {
                var callback = parameters.callback;
                ME.Utilities.CallInSequence(callback, this.subComponents, (item, cb) => (item as IWindowEventsController).DoHideBegin(parameters.ReplaceCallback(cb)));
            }
            else
            {
                parameters.Call();
            }
        }
Exemple #24
0
        public override void DoShowBegin(AppearanceParameters parameters)
        {
            if (parameters.GetManual(false) == true)
            {
                this.Show(parameters);
                return;
            }

            if (this.manualShowHideControl == true || this.showOnStart == false)
            {
                parameters.Call();
                return;
            }

            this.eventsHistoryTracker.Add(this, parameters, HistoryTrackerEventType.ShowBegin);

            this.DoShowBegin_INTERNAL(parameters);
        }
        public override void DoHideBegin(AppearanceParameters parameters)
        {
            if (parameters.GetManual(false) == true)
            {
                this.Hide(parameters);
                return;
            }

            if (this.manualShowHideControl == true)
            {
                parameters.Call();
                return;
            }

            WindowSystem.GetHistoryTracker().Add(this, parameters, HistoryTrackerEventType.HideBegin);

            this.DoHideBegin_INTERNAL(parameters);
        }
Exemple #26
0
        public override void DoShowBegin(AppearanceParameters parameters)
        {
            if (parameters.GetManual(false) == true)
            {
                this.Show(parameters);
                return;
            }

            if (this.manualShowHideControl == true || this.showOnStart == false)
            {
                this.DoShowBeginManualControl(parameters);
                return;
            }

            WindowSystem.GetHistoryTracker().Add(this, parameters, HistoryTrackerEventType.ShowBegin);

            parameters = parameters.ReplaceResetAnimation(resetAnimation: true);
            this.DoShowBegin_INTERNAL(parameters);
        }
Exemple #27
0
        private void DoHideEndManualControl(AppearanceParameters parameters)
        {
            if (this.IsStateReadyToHide() == false &&
                parameters.GetForced(defaultValue: false) == false)
            {
                //parameters.Call();
                return;
            }

            for (int i = 0; i < this.subComponents.Count; ++i)
            {
                var sub = this.subComponents[i] as WindowComponentBase;
                sub.DoHideEndManualControl(parameters.ReplaceCallback(null));
            }

            //WindowSystem.RunSafe(this.OnHideEnd);
            //WindowSystem.RunSafe(this.OnHideEnd, parameters);

            //parameters.Call();
        }
        public virtual void DoHideBegin(AppearanceParameters parameters)
        {
            this.SetComponentState(WindowObjectState.Hiding);
            this.OnHideBegin();
            this.OnHideBegin(parameters);
                        #pragma warning disable
            this.OnHideBegin(parameters.callback, parameters.immediately);
                        #pragma warning restore

            var includeChilds = parameters.GetIncludeChilds(defaultValue: true);
            if (includeChilds == true)
            {
                var callback = parameters.callback;
                ME.Utilities.CallInSequence(callback, this.subComponents, (item, cb) => item.DoHideBegin(parameters.ReplaceCallback(cb)));
            }
            else
            {
                parameters.Call();
            }
        }
        public void Show(AppearanceParameters parameters)
        {
            if (this.IsStateReadyToShow() == false &&
                parameters.GetForced(defaultValue: false) == false)
            {
                parameters.Call();
                return;
            }

            WindowSystem.GetHistoryTracker().Add(this, parameters, HistoryTrackerEventType.ShowManual);

            this.manualShowHideControl = true;

            //parameters = parameters.ReplaceManual(manual: true);

            var callback         = parameters.GetCallback(null);
            var parametersResult = parameters.ReplaceCallback(() => {
                if (this.GetComponentState() != WindowObjectState.Showing)
                {
                    if (callback != null)
                    {
                        callback.Invoke();
                    }
                    return;
                }

                this.DoShowEnd_INTERNAL(parameters);
                if (callback != null)
                {
                    callback.Invoke();
                }
            });

            parametersResult = parametersResult.ReplaceForced(forced: true);

            this.DoShowBegin_INTERNAL(parametersResult);
        }
Exemple #30
0
        public void Show(AppearanceParameters parameters)
        {
            if ((this.GetComponentState() == WindowObjectState.Shown ||
                 this.GetComponentState() == WindowObjectState.Showing) &&
                parameters.GetForced(defaultValue: false) == false)
            {
                parameters.Call();
                return;
            }

            this.eventsHistoryTracker.Add(this, parameters, HistoryTrackerEventType.ShowManual);

            this.manualShowHideControl = true;

            //parameters = parameters.ReplaceManual(manual: true);

            var callback = parameters.callback;

            parameters.callback = () => {
                if (this.GetComponentState() != WindowObjectState.Showing)
                {
                    if (callback != null)
                    {
                        callback.Invoke();
                    }
                    return;
                }

                this.DoShowEnd_INTERNAL(parameters);
                if (callback != null)
                {
                    callback.Invoke();
                }
            };

            this.DoShowBegin_INTERNAL(parameters);
        }
		public AppearanceParameters(AppearanceParameters other) {

			this.replaceCallback = other.replaceCallback;
			this.callback = other.callback;
			
			this.replaceDelay = other.replaceDelay;
			this.delay = other.delay;
			
			this.replaceImmediately = other.replaceImmediately;
			this.immediately = other.immediately;

			this.replaceResetAnimation = other.replaceResetAnimation;
			this.resetAnimation = other.resetAnimation;

			this.replaceIncludeChilds = other.replaceIncludeChilds;
			this.includeChilds = other.includeChilds;

			this.replaceChildsBehaviourMode = other.replaceChildsBehaviourMode;
			this.childsBehaviourMode = other.childsBehaviourMode;
			
			this.replaceForced = other.replaceForced;
			this.forced = other.forced;

		}
		public void DoHideBegin(AppearanceParameters parameters) {
			
			this.DoHideBegin(this.transition, this.transitionParameters, parameters);
			
		}
		public void DoHideBegin(TransitionBase transition, TransitionInputParameters transitionParameters, AppearanceParameters parameters) {
			
			parameters.Call();

		}
		public void ShowHide(bool state, AppearanceParameters parameters) {
			
			if (state == true) {
				
				this.Show(parameters);
				
			} else if (state == false) {
				
				this.Hide(parameters);
				
			}

		}
		private void DoHideEnd_INTERNAL(AppearanceParameters parameters) {

			base.DoHideEnd(parameters);
			
		}
		public override void DoHideEnd(AppearanceParameters parameters) {
			
			if (this.manualShowHideControl == true) {
				
				return;
				
			}
			
			this.eventsHistoryTracker.Add(this, HistoryTrackerEventType.HideEnd);

			this.DoHideEnd_INTERNAL(parameters);
			
		}
		public override void DoHideBegin(AppearanceParameters parameters) {

			if (this.manualShowHideControl == true) {
				
				parameters.Call();
				return;
				
			}
			
			this.eventsHistoryTracker.Add(this, parameters, HistoryTrackerEventType.HideBegin);

			this.DoHideBegin_INTERNAL(parameters);

		}
		private void DoHideBeginAnimation_INTERNAL(System.Action callback, AppearanceParameters parameters) {

			if (TweenerGlobal.instance == null) return;

			var resetAnimation = parameters.GetResetAnimation(defaultValue: false);
			var immediately = parameters.GetImmediately(defaultValue: false);
			var delay = parameters.GetDelay(defaultValue: 0f);

			System.Action callbackInner = () => {
				
				if (this.animation != null) {
					
					if (resetAnimation == true) this.SetResetState();
					
					if (immediately == true) {
						
						this.animation.SetOutState(this.animationInputParams, this.GetWindow(), this);
						callback.Invoke();
						
					} else {
						
						this.animation.Play(this.GetWindow(), this.animationInputParams, this, false, callback);
						
					}
					
				} else {
					
					callback.Invoke();
					
				}

			};

			if (TweenerGlobal.instance != null) {
				
				var tag = this.GetTag();
				TweenerGlobal.instance.removeTweens(tag);
				if (immediately == false && delay > 0f) {

					TweenerGlobal.instance.addTween(this, delay, 0f, 0f).tag(tag).onComplete(() => {

						callbackInner.Invoke();

					}).onCancel((obj) => {
						
						callbackInner.Invoke();

					});

				} else {

					callbackInner.Invoke();

				}

			} else {

				callbackInner.Invoke();

			}

		}
		public void DoHideEnd(AppearanceParameters parameters) { }
		public void DoShowBegin(TransitionBase transition, TransitionInputParameters transitionParameters, AppearanceParameters parameters) {

			var needToPlay = (this.id > 0 || this.playType == PlayType.Replace);

			if (this.playType == PlayType.Replace) WindowSystem.AudioStop(null, this.clipType, this.id);

			if (transition != null) {

				if (needToPlay == true) {

					WindowSystem.AudioPlay(this.window, this.clipType, this.id, this.playType == PlayType.Replace);
					transition.SetResetState(transitionParameters, this.window, null);
					transition.Play(this.window, transitionParameters, null, forward: true, callback: () => {
						
						parameters.Call();
						
					});

				}

			} else {

				if (needToPlay == true) WindowSystem.AudioPlay(this.window, this.clipType, this.id, this.playType == PlayType.Replace);
				parameters.Call();

			}
			
		}
		public void Hide(AppearanceParameters parameters) {
			
			if ((this.GetComponentState() == WindowObjectState.Hidden ||
			    this.GetComponentState() == WindowObjectState.Hiding) &&
			    parameters.GetForced(defaultValue: false) == false) {
				
				return;
				
			}

			this.eventsHistoryTracker.Add(this, parameters, HistoryTrackerEventType.HideManual);

			this.manualShowHideControl = true;

			var callback = parameters.callback;
			parameters.callback = () => {
				
				if (this.GetComponentState() != WindowObjectState.Hiding) {
					
					if (callback != null) callback.Invoke();
					return;

				}
				
				this.DoHideEnd_INTERNAL(parameters);
				if (callback != null) callback.Invoke();

			};

			this.DoHideBegin_INTERNAL(parameters);

		}
			public Item(StackFrame[] stack, AppearanceParameters parameters, HistoryTrackerEventType eventType) : this(stack, eventType) {
				
				this.parameters = parameters;
				
			}
		private void DoHideBegin_INTERNAL(AppearanceParameters parameters) {
			
			if ((this.GetComponentState() == WindowObjectState.Hiding ||
			    this.GetComponentState() == WindowObjectState.Hidden) &&
			    parameters.GetForced(defaultValue: false) == false) {
				
				parameters.Call();
				return;
				
			}

			this.SetComponentState(WindowObjectState.Hiding);
			
			var parametersCallback = parameters.callback;
			System.Action onResult = () => {

				parameters = parameters.ReplaceCallback(parametersCallback);
				parameters.Call();

			};
			
			this.OnHideBegin();
			this.OnHideBegin(parameters);
			#pragma warning disable
			this.OnHideBegin(parameters.callback, parameters.resetAnimation);
			#pragma warning restore

			var includeChilds = parameters.GetIncludeChilds(defaultValue: true);
			#region Include Childs
			if (includeChilds == false) {

				// without childs
				this.DoHideBeginAnimation_INTERNAL(onResult, parameters);
				return;
				
			}
			#endregion
			
			var childsBehaviour = parameters.GetChildsBehaviourMode(this.childsHideMode);
			if (childsBehaviour == ChildsBehaviourMode.Simultaneously) {
				
				#region Childs Simultaneously
				var counter = 0;
				System.Action callback = () => {
					
					++counter;
					if (counter < 2) return;
					
					onResult.Invoke();
					
				};
				
				this.DoHideBeginAnimation_INTERNAL(callback, parameters);
				
				ME.Utilities.CallInSequence(callback, this.subComponents, (e, c) => {
					
					e.DoHideBegin(parameters.ReplaceCallback(c));
					
				});
				#endregion
				
			} else if (childsBehaviour == ChildsBehaviourMode.Consequentially) {
				
				#region Childs Consequentially
				ME.Utilities.CallInSequence(() => {
					
					this.DoHideBeginAnimation_INTERNAL(onResult, parameters);
					
				}, this.subComponents, (e, c) => {
					
					e.DoHideBegin(parameters.ReplaceCallback(c));
					
				}, waitPrevious: true);
				#endregion
				
			}

		}
Exemple #44
0
        /// <summary>
        /// Unregisters the sub component.
        /// </summary>
        /// <param name="subComponent">Sub component.</param>
        public virtual void UnregisterSubComponent(WindowObjectElement subComponent, System.Action callback = null, bool immediately = true)
        {
                        #if UNITY_EDITOR
            if (Application.isPlaying == false)
            {
                return;
            }
                        #endif

            var sendCallback = true;

            //Debug.Log("UNREGISTER: " + subComponent + " :: " + this.GetComponentState() + "/" + subComponent.GetComponentState());

            subComponent.rootComponent = null;
            this.subComponents.Remove(subComponent);

            var controller = (subComponent as IWindowEventsController);

            switch (subComponent.GetComponentState())
            {
            case WindowObjectState.Showing:
            case WindowObjectState.Shown:

                // after OnShowEnd
                controller.DoWindowClose();
                controller.DoWindowInactive();
                controller.DoHideBegin(AppearanceParameters.Default().ReplaceForced(forced: true).ReplaceImmediately(immediately));
                controller.DoHideEnd(AppearanceParameters.Default().ReplaceForced(forced: true).ReplaceImmediately(immediately));
                controller.DoWindowUnload();
                controller.DoDeinit(() => { if (callback != null)
                                            {
                                                callback();
                                            }
                                    });

                sendCallback = false;

                break;

            case WindowObjectState.Hiding:

                // after OnHideBegin
                controller.DoWindowClose();
                controller.DoWindowInactive();
                controller.DoHideEnd(AppearanceParameters.Default().ReplaceForced(forced: true).ReplaceImmediately(immediately));
                controller.DoWindowUnload();
                controller.DoDeinit(() => { if (callback != null)
                                            {
                                                callback();
                                            }
                                    });

                sendCallback = false;

                break;

            case WindowObjectState.Hidden:

                // after OnHideEnd
                controller.DoWindowClose();
                controller.DoWindowInactive();
                controller.DoWindowUnload();
                controller.DoDeinit(() => { if (callback != null)
                                            {
                                                callback();
                                            }
                                    });

                sendCallback = false;

                break;
            }

            if (sendCallback == true && callback != null)
            {
                callback();
            }
        }
		public void DoShowEnd(AppearanceParameters parameters) { }