示例#1
0
        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();
            }
        }
示例#2
0
        private void DoHideBegin_INTERNAL(AppearanceParameters parameters)
        {
            if (this.IsStateReadyToHide() == false &&
                parameters.GetForced(defaultValue: false) == false)
            {
                this.RefreshComponentState();
                parameters.Call();
                return;
            }

            this.SetComponentState(WindowObjectState.Hiding);

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

            var window = this.GetWindow();

            if (window != null)
            {
                var canvas = window.GetCanvas();
                if (canvas != null)
                {
                    canvas.pixelPerfect = false;
                }
            }

            var parametersCallback = parameters.callback;

            System.Action onResult = () => {
                if (window != null)
                {
                    var canvas = window.GetCanvas();
                    if (canvas != null)
                    {
                        WindowSystem.ApplyToSettingsInstance(null, canvas, this.GetWindow());
                    }
                }

                if (parametersCallback != null)
                {
                    parametersCallback.Invoke();
                }
            };

                        #if DEBUGBUILD
            Profiler.BeginSample("WindowComponentBase::OnHideBegin()");
                        #endif

            WindowSystem.RunSafe(this.OnHideBegin);
            WindowSystem.RunSafe(this.OnHideBegin, parameters);

                        #if DEBUGBUILD
            Profiler.EndSample();
                        #endif

            var includeChilds = parameters.GetIncludeChilds(defaultValue: true);
            #region Include Childs
            if (includeChilds == false)
            {
                // without childs
                this.DoHideBeginAnimation_INTERNAL(onResult, parameters);
                return;
            }
            #endregion

            this.RunChilds_INTERNAL(parameters, onResult, this.DoHideBeginAnimation_INTERNAL, (e, p) => e.DoHideBegin(p));

            /*
             * 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
             *
             * }*/
        }
        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);

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

            var parametersCallback = parameters.callback;

            System.Action onResult = () => {
                if (parametersCallback != null)
                {
                    parametersCallback.Invoke();
                }
            };

                        #if DEBUGBUILD
            Profiler.BeginSample("WindowComponentBase::OnHideBegin()");
                        #endif

            WindowSystem.RunSafe(this.OnHideBegin);
            WindowSystem.RunSafe(this.OnHideBegin, parameters);

                        #if DEBUGBUILD
            Profiler.EndSample();
                        #endif

            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
            }
        }
示例#4
0
        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
            }
        }
示例#5
0
        private void DoShowBegin_INTERNAL(AppearanceParameters parameters)
        {
            if ((this.GetComponentState() == WindowObjectState.Showing ||
                 this.GetComponentState() == WindowObjectState.Shown) &&
                parameters.GetForced(defaultValue: false) == false)
            {
                parameters.Call();
                return;
            }

            this.SetComponentState(WindowObjectState.Showing);

            var parametersCallback = parameters.callback;

            System.Action onResult = () => {
                parameters = parameters.ReplaceCallback(parametersCallback);
                parameters.Call();
            };

                        #if UNITY_EDITOR
            Profiler.BeginSample("WindowComponentBase::OnShowBegin()");
                        #endif

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

                        #if UNITY_EDITOR
            Profiler.EndSample();
                        #endif

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

            /*var resetAnimation = parameters.GetResetAnimation(defaultValue: true);
             * if (resetAnimation == true) {
             *
             *      if (includeChilds == true) {
             *
             *              this.DoResetState();
             *
             *      } else {
             *
             *              this.SetResetState();
             *
             *      }
             *
             * }*/

            #region Include Childs
            if (includeChilds == false)
            {
                // without childs
                this.DoShowBeginAnimation_INTERNAL(onResult, parameters);
                return;
            }
            #endregion

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

                    onResult.Invoke();
                };

                this.DoShowBeginAnimation_INTERNAL(callback, parameters);

                ME.Utilities.CallInSequence(callback, this.subComponents, (e, c) => {
                    e.DoShowBegin(parameters.ReplaceCallback(c));
                });
                #endregion
            }
            else if (childsBehaviour == ChildsBehaviourMode.Consequentially)
            {
                #region Childs Consequentially
                ME.Utilities.CallInSequence(() => {
                    this.DoShowBeginAnimation_INTERNAL(onResult, parameters);
                }, this.subComponents, (e, c) => {
                    e.DoShowBegin(parameters.ReplaceCallback(c));
                }, waitPrevious: true);
                #endregion
            }
        }
		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
				
			}

		}