Esempio n. 1
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
            }
        }
Esempio n. 2
0
        private void DoShowBegin_INTERNAL(AppearanceParameters parameters)
        {
            if (this.IsStateReadyToShow() == false &&
                parameters.GetForced(defaultValue: false) == false)
            {
                this.RefreshComponentState();
                parameters.Call();
                return;
            }

            this.SetComponentState(WindowObjectState.Showing);

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

            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::OnShowBegin()");
                        #endif

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

                        #if DEBUGBUILD
            Profiler.EndSample();
                        #endif

            var includeChilds   = parameters.GetIncludeChilds(defaultValue: true);
            var childsBehaviour = parameters.GetChildsBehaviourMode(this.childsShowMode);

            if (childsBehaviour == ChildsBehaviourMode.Consequentially)
            {
                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

            this.RunChilds_INTERNAL(parameters, onResult, this.DoShowBeginAnimation_INTERNAL, (e, p) => e.DoShowBegin(p));

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

            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
            }
        }
Esempio n. 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
            }
        }
Esempio n. 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
				
			}

		}