public virtual void SetComponentState(WindowObjectState state) { this.currentState = state; if (this == null) return; var go = this.gameObject; if (this.currentState == WindowObjectState.Showing || this.currentState == WindowObjectState.Shown) { if (go != null) go.SetActive(true); } else if (this.currentState == WindowObjectState.Hidden || this.currentState == WindowObjectState.NotInitialized || this.currentState == WindowObjectState.Initializing) { if (go != null && this.NeedToInactive() == true) go.SetActive(false); } }
/// <summary> /// Raises the deinit event. /// You can override this method but call it's base. /// </summary> public virtual void OnDeinit() { this.currentState = WindowObjectState.NotInitialized; }
/// <summary> /// Raises the hide begin event. /// Wait while all sub components return the callback. /// </summary> /// <param name="callback">Callback.</param> /// <param name="immediately">If set to <c>true</c> immediately.</param> private void OnHideBegin_INTERNAL(System.Action callback, bool immediately) { var go = this.gameObject; System.Action callbackInner = () => { this.currentState = WindowObjectState.Hidden; if (go != null) go.SetActive(false); if (callback != null) callback(); }; this.currentState = WindowObjectState.Hiding; if (this.animation != null) { if (immediately == true) { this.animation.SetOutState(this.animationInputParams, this); if (callbackInner != null) callbackInner(); } else { this.animation.Play(this.animationInputParams, this, false, callbackInner); } } else { callbackInner(); } }
/// <summary> /// Raises the show begin event. /// Wait while all sub components return the callback. /// </summary> /// <param name="callback">Callback.</param> /// <param name="resetAnimation">If set to <c>true</c> reset animation.</param> private void OnShowBegin_INTERNAL(System.Action callback, bool resetAnimation, bool immediately = false) { var go = this.gameObject; System.Action callbackInner = () => { this.currentState = WindowObjectState.Shown; if (go != null) go.SetActive(true); if (callback != null) callback(); }; if (go != null) go.SetActive(true); this.currentState = WindowObjectState.Showing; if (this.animation != null) { if (resetAnimation == true) this.SetResetState(); if (immediately == true) { this.animation.SetInState(this.animationInputParams, this); if (callbackInner != null) callbackInner(); } else { this.animation.Play(this.animationInputParams, this, true, callbackInner); } } else { callbackInner(); } }
public HistoryItem(WindowBase window) { this.state = window.GetState(); this.window = window; }
private IEnumerator Hide_INTERNAL_YIELD(System.Action onHideEnd, AttachItem transitionItem) { while (this.paused == true) { yield return(false); } var parameters = AppearanceParameters.Default(); var counter = 0; System.Action callback = () => { if (this.currentState != WindowObjectState.Hiding) { return; } ++counter; if (counter < 6) { return; } WindowSystem.AddToHistory(this); this.Recycle(); this.DoLayoutHideEnd(parameters); this.modules.DoHideEnd(parameters); this.audio.DoHideEnd(parameters); this.events.DoHideEnd(parameters); this.transition.DoHideEnd(parameters); this.DoHideEnd(parameters); if (onHideEnd != null) { onHideEnd(); } this.currentState = WindowObjectState.Hidden; if (this != null && this.gameObject != null) { this.gameObject.SetActive(false); } }; parameters = parameters.ReplaceCallback(callback); this.DoLayoutHideBegin(parameters); this.modules.DoHideBegin(parameters); if (transitionItem != null && transitionItem.audioTransition != null) { this.audio.DoHideBegin(transitionItem.audioTransition, transitionItem.audioTransitionParameters, parameters); } else { this.audio.DoHideBegin(parameters); } this.events.DoHideBegin(parameters); if (transitionItem != null && transitionItem.transition != null) { this.transition.DoHideBegin(transitionItem.transition, transitionItem.transitionParameters, parameters); } else { this.transition.DoHideBegin(parameters); } this.DoHideBegin(parameters); yield return(true); }
internal void Init(float depth, float zDepth, int raycastPriority, int orderInLayer) { this.currentState = WindowObjectState.Initializing; if (this.initialized == false) { this.currentState = WindowObjectState.NotInitialized; Debug.LogError("Can't initialize window instance because of some components were not installed properly.", this); return; } this.SetDepth(depth, zDepth); if (Application.isPlaying == true) { if (this.preferences.IsDontDestroyOnSceneChange() == true) { GameObject.DontDestroyOnLoad(this.gameObject); } } if (this.passParams == true) { if (this.parameters != null && this.parameters.Length > 0) { System.Reflection.MethodInfo methodInfo; if (WindowSystem.InvokeMethodWithParameters(out methodInfo, this, "OnParametersPass", this.parameters) == true) { // Success methodInfo.Invoke(this, this.parameters); } else { // Method not found Debug.LogWarning("Method `OnParametersPass` was not found with input parameters.", this); } } if (this.onParametersPassCall != null) { this.onParametersPassCall(this); } } else { this.OnEmptyPass(); } if (this.setup == false) { this.Setup(this); this.OnPreInit(); this.DoLayoutInit(depth, raycastPriority, orderInLayer); WindowSystem.ApplyToSettingsInstance(this.workCamera, this.GetCanvas()); this.OnModulesInit(); this.OnAudioInit(); this.events.DoInit(); this.OnTransitionInit(); if (WindowSystem.IsCallEventsEnabled() == true) { this.OnInit(); } this.setup = true; } this.currentState = WindowObjectState.Initialized; }