/*public virtual void DeactivateComponents() {

			for (int i = 0; i < this.subComponents.Count; ++i) this.subComponents[i].DeactivateComponents();

            if (this == null) return;
            this.gameObject.SetActive(false);

        }*/

        /// <summary>
        /// Registers the sub component.
        /// If you want to instantiate a new component manualy but wants window events - register this component here.
        /// </summary>
        /// <param name="subComponent">Sub component.</param>
		public virtual void RegisterSubComponent(WindowObjectElement subComponent) {

			//Debug.Log("REGISTER: " + subComponent + " :: " + this.GetComponentState() + "/" + subComponent.GetComponentState());
			switch (this.GetComponentState()) {
				
				case WindowObjectState.Hiding:
					
					if (subComponent.GetComponentState() == WindowObjectState.NotInitialized) {
						
						subComponent.OnInit();
						
					}

					subComponent.SetComponentState(this.GetComponentState());

					break;

				case WindowObjectState.Hidden:
					
					if (subComponent.GetComponentState() == WindowObjectState.NotInitialized) {
						
						subComponent.OnInit();
						
					}

					subComponent.SetComponentState(this.GetComponentState());

					break;

				case WindowObjectState.Initializing:
				case WindowObjectState.Initialized:
					
					if (subComponent.GetComponentState() == WindowObjectState.NotInitialized) {
						
						subComponent.OnInit();
						
					}

	                break;

                case WindowObjectState.Showing:
                    
					// after OnShowBegin
					
					if (subComponent.GetComponentState() == WindowObjectState.NotInitialized) {
						
						subComponent.OnInit();
						
					}

					if (subComponent.showOnStart == true) {

	                    subComponent.OnShowBegin(null);

					}

                    break;

                case WindowObjectState.Shown:

                    // after OnShowEnd
					
					if (subComponent.GetComponentState() == WindowObjectState.NotInitialized) {
						
						subComponent.OnInit();
						
					}

					if (subComponent.showOnStart == true) {

	                    subComponent.OnShowBegin(() => {

	                        subComponent.OnShowEnd();

	                    });

					}

                    break;

            }
			
			if (this.GetWindow() != null) {

                subComponent.Setup(this.GetWindow());
                // subComponent.Setup(this.GetLayoutRoot());

            }

            if (this.subComponents.Contains(subComponent) == false) this.subComponents.Add(subComponent);

        }
Example #2
0
        /*public virtual void DeactivateComponents() {
         *
         *              for (int i = 0; i < this.subComponents.Count; ++i) this.subComponents[i].DeactivateComponents();
         *
         *  if (this == null) return;
         *  this.gameObject.SetActive(false);
         *
         * }*/

        /// <summary>
        /// Registers the sub component.
        /// If you want to instantiate a new component manualy but wants window events - register this component here.
        /// </summary>
        /// <param name="subComponent">Sub component.</param>
        public virtual void RegisterSubComponent(WindowObjectElement subComponent)
        {
            //Debug.Log("REGISTER: " + subComponent + " :: " + this.GetComponentState() + "/" + subComponent.GetComponentState());
            switch (this.GetComponentState())
            {
            case WindowObjectState.Hiding:

                if (subComponent.GetComponentState() == WindowObjectState.NotInitialized)
                {
                    // after OnInit
                    subComponent.OnInit();
                }

                subComponent.SetComponentState(this.GetComponentState());

                break;

            case WindowObjectState.Hidden:

                if (subComponent.GetComponentState() == WindowObjectState.NotInitialized)
                {
                    // after OnInit
                    subComponent.OnInit();
                }

                subComponent.SetComponentState(this.GetComponentState());

                break;

            case WindowObjectState.Initializing:
            case WindowObjectState.Initialized:

                if (subComponent.GetComponentState() == WindowObjectState.NotInitialized)
                {
                    // after OnInit
                    subComponent.OnInit();
                }

                break;

            case WindowObjectState.Showing:

                // after OnShowBegin

                if (subComponent.GetComponentState() == WindowObjectState.NotInitialized)
                {
                    subComponent.OnInit();
                }

                subComponent.OnShowBegin(null);

                break;

            case WindowObjectState.Shown:

                // after OnShowEnd

                if (subComponent.GetComponentState() == WindowObjectState.NotInitialized)
                {
                    subComponent.OnInit();
                }

                subComponent.OnShowBegin(() => {
                    subComponent.OnShowEnd();
                });

                break;
            }

            if (this.GetWindow() != null)
            {
                subComponent.Setup(this.GetWindow());
                // subComponent.Setup(this.GetLayoutRoot());
            }

            if (this.subComponents.Contains(subComponent) == false)
            {
                this.subComponents.Add(subComponent);
            }
        }
        /*public virtual void DeactivateComponents() {

			for (int i = 0; i < this.subComponents.Count; ++i) this.subComponents[i].DeactivateComponents();

            if (this == null) return;
            this.gameObject.SetActive(false);

        }*/

        /// <summary>
        /// Registers the sub component.
        /// If you want to instantiate new component manualy but wants the window events - register this component here.
        /// </summary>
        /// <param name="subComponent">Sub component.</param>
		public virtual void RegisterSubComponent(WindowObjectElement subComponent) {

			switch (this.GetComponentState()) {
				
				case WindowObjectState.Initializing:
				case WindowObjectState.Initialized:
                    // after OnInit
                    subComponent.OnInit();
                    break;

                case WindowObjectState.Showing:
                    // after OnShowBegin
                    subComponent.OnInit();
                    subComponent.OnShowBegin(null);
                    break;

                case WindowObjectState.Shown:
                    // after OnShowEnd
                    subComponent.OnInit();
                    subComponent.OnShowBegin(() => {

                        subComponent.OnShowEnd();

                    });
                    break;

            }
			
			if (this.GetWindow() != null) {

                subComponent.Setup(this.GetWindow());
                // subComponent.Setup(this.GetLayoutRoot());

            }

            if (this.subComponents.Contains(subComponent) == false) this.subComponents.Add(subComponent);

        }