/// <summary> /// Unregisters the sub component. /// </summary> /// <param name="subComponent">Sub component.</param> public void UnregisterSubComponent(WindowObjectElement subComponent, System.Action callback = null) { #if UNITY_EDITOR if (Application.isPlaying == false) return; #endif var sendCallback = true; //Debug.Log("UNREGISTER: " + subComponent + " :: " + this.GetComponentState() + "/" + subComponent.GetComponentState()); this.subComponents.Remove(subComponent); switch (this.GetComponentState()) { case WindowObjectState.Shown: // after OnShowEnd subComponent.OnHideBegin(() => { subComponent.OnHideEnd(); subComponent.OnDeinit(); if (callback != null) callback(); }); sendCallback = false; break; case WindowObjectState.Hiding: // after OnHideBegin subComponent.OnHideBegin(null); sendCallback = false; if (callback != null) callback(); break; case WindowObjectState.Hidden: // after OnHideEnd subComponent.OnHideBegin(() => { subComponent.OnHideEnd(); subComponent.OnDeinit(); if (callback != null) callback(); }); sendCallback = false; break; } if (sendCallback == true && callback != null) callback(); }
/// <summary> /// Unregisters the sub component. /// </summary> /// <param name="subComponent">Sub component.</param> public void UnregisterSubComponent(WindowObjectElement subComponent, System.Action callback = null) { var sendCallback = true; //Debug.Log("UNREGISTER: " + subComponent + " :: " + this.GetComponentState() + "/" + subComponent.GetComponentState()); this.subComponents.Remove(subComponent); switch (this.GetComponentState()) { case WindowObjectState.Shown: // after OnShowEnd subComponent.OnHideBegin(() => { subComponent.OnHideEnd(); subComponent.OnDeinit(); if (callback != null) { callback(); } }); sendCallback = false; break; case WindowObjectState.Hiding: // after OnHideBegin subComponent.OnHideBegin(null); sendCallback = false; if (callback != null) { callback(); } break; case WindowObjectState.Hidden: // after OnHideEnd subComponent.OnHideBegin(() => { subComponent.OnHideEnd(); subComponent.OnDeinit(); if (callback != null) { callback(); } }); sendCallback = false; break; } if (sendCallback == true && callback != null) { callback(); } }
/// <summary> /// Unregisters the sub component. /// </summary> /// <param name="subComponent">Sub component.</param> public void UnregisterSubComponent(WindowObjectElement subComponent) { switch (this.GetComponentState()) { case WindowObjectState.Shown: // after OnShowEnd subComponent.OnHideBegin(() => { subComponent.OnHideEnd(); subComponent.OnDeinit(); }); break; case WindowObjectState.Hiding: // after OnHideBegin subComponent.OnHideBegin(null); break; case WindowObjectState.Hidden: // after OnHideEnd subComponent.OnHideBegin(() => { subComponent.OnHideEnd(); subComponent.OnDeinit(); }); break; } this.subComponents.Remove(subComponent); }