public void OnWindowTransitionEnd(UIWindow window, UIWindow.VisualState state) { // Destroy the modal box when hidden if (state == UIWindow.VisualState.Hidden) { Destroy(this.gameObject); } }
public void OnTransitionComplete(UIWindow window, UIWindow.VisualState state) { if (state == UIWindow.VisualState.Shown) { StartCoroutine("AutoHide"); } else { StopCoroutine("AutoHide"); } }
public void OnTransitionBegin(UIWindow window, UIWindow.VisualState state, bool instant) { if (!this.IsActive() || window == null) { return; } // Check if we are receiving hide event and we are not showing the overlay to begin with, return if (state == UIWindow.VisualState.Hidden && !this.IsVisible()) { return; } // Prepare transition duration float duration = (instant) ? 0f : window.transitionDuration; TweenEasing easing = window.transitionEasing; // Showing a window if (state == UIWindow.VisualState.Shown) { // Increase the window count so we know when to hide the overlay this.m_WindowsCount += 1; // Check if the overlay is already visible if (this.IsVisible() && !this.m_Transitioning) { // Bring the window forward UIUtility.BringToFront(window.gameObject); // Break return; } // Bring the overlay forward UIUtility.BringToFront(this.gameObject); // Bring the window forward UIUtility.BringToFront(window.gameObject); // Transition this.StartAlphaTween(1f, duration, easing); // Toggle block raycast on this.m_CanvasGroup.blocksRaycasts = true; } // Hiding a window else { // Decrease the window count this.m_WindowsCount -= 1; // Never go below 0 if (this.m_WindowsCount < 0) { this.m_WindowsCount = 0; } // Check if we still have windows using the overlay if (this.m_WindowsCount > 0) { return; } // Transition this.StartAlphaTween(0f, duration, easing); // Toggle block raycast on this.m_CanvasGroup.blocksRaycasts = false; } }