public override IEnumerator PlayReverse(NavScreen currentScreen, NavScreen previousScreen) { currentScreen.OnHiding(); if (previousScreen != null) { var currentScreenIndex = previousScreen.RectTransform.GetSiblingIndex(); previousScreen.RectTransform.SetSiblingIndex(currentScreenIndex); previousScreen.OnShowing(); } float progress = 0f; while (progress < 1) { progress += speed; progress = Mathf.Clamp01(progress); UpdateScreenPosition(currentScreen, 0f, 1f, progress); if (previousScreen != null) { UpdateScreenPosition(previousScreen, -0.3f, 0f, progress); } yield return(null); } currentScreen.OnHidden(); if (previousScreen != null) { previousScreen.OnShown(); } }
public override IEnumerator PlayReverse(NavScreen currentScreen, NavScreen previousScreen) { currentScreen.OnHiding(); currentScreen.CanvasGroup.interactable = false; currentScreen.CanvasGroup.blocksRaycasts = false; if (previousScreen != null) { var currentScreenIndex = currentScreen.RectTransform.GetSiblingIndex(); previousScreen.RectTransform.SetSiblingIndex(currentScreenIndex); previousScreen.OnShowing(); previousScreen.CanvasGroup.alpha = 1f; } float progress = 0f; do { progress += speed; progress = Mathf.Clamp01(progress); UpdateScreenFade(currentScreen.CanvasGroup, 1f, 0f, progress); yield return(null); } while (progress < 1f); currentScreen.OnHidden(); if (previousScreen != null) { previousScreen.OnShown(); previousScreen.CanvasGroup.interactable = true; previousScreen.CanvasGroup.blocksRaycasts = true; } }
public override IEnumerator Play(NavScreen currentScreen, NavScreen nextScreen) { nextScreen.RectTransform.SetAsLastSibling(); nextScreen.OnShowing(); if (currentScreen != null) { currentScreen.OnHiding(); } float progress = 0f; while (progress < 1) { progress += speed; progress = Mathf.Clamp01(progress); UpdateScreenPosition(nextScreen, 1f, 0f, progress); if (currentScreen != null) { UpdateScreenPosition(currentScreen, 0f, -0.3f, progress); } yield return(null); } nextScreen.OnShown(); if (currentScreen != null) { currentScreen.OnHidden(); } }
public override IEnumerator Play(NavScreen currentScreen, NavScreen nextScreen) { nextScreen.RectTransform.SetAsLastSibling(); nextScreen.OnShowing(); if (currentScreen != null) { currentScreen.OnHiding(); currentScreen.CanvasGroup.interactable = false; currentScreen.CanvasGroup.blocksRaycasts = false; } float progress = 0f; do { progress += speed; progress = Mathf.Clamp01(progress); UpdateScreenFade(nextScreen.CanvasGroup, 0f, 1f, progress); yield return(null); } while (progress < 1f); nextScreen.OnShown(); nextScreen.CanvasGroup.interactable = true; nextScreen.CanvasGroup.blocksRaycasts = true; if (currentScreen != null) { currentScreen.OnHidden(); currentScreen.CanvasGroup.alpha = 0f; } }