Exemplo n.º 1
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();
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public void Hide(AppearanceParameters parameters)
        {
            if (this.IsStateReadyToHide() == false &&
                parameters.GetForced(defaultValue: false) == false)
            {
                this.RefreshComponentState();
                parameters.Call();
                return;
            }

            this.Hide_INTERNAL(parameters);
        }
Exemplo n.º 4
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();
        }
Exemplo n.º 5
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 void Hide(AppearanceParameters parameters)
        {
            if (this.IsStateReadyToHide() == false &&
                parameters.GetForced(defaultValue: false) == false)
            {
                parameters.Call();
                return;
            }

            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);
        }
Exemplo n.º 7
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
            }
        }
Exemplo n.º 9
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
            }
        }
Exemplo n.º 10
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
				
			}

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

		}