Exemple #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();
        }
Exemple #2
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 #3
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 #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();
        }
        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 #6
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();
            }
        }
        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
            }
        }
Exemple #8
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
            }
        }
Exemple #9
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
            }
        }
        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();
            }
        }
		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
				
			}

		}