public void ReturnToPreviousScreen() { if (isTransitioningScreens || !previousScreen || (appMenu && appMenu.BeganValidDrag) || previousScreen == splashScreen) { return; } isTransitioningScreens = true; backButton.ResetColor(); Sequence hideSequence = currentScreen.HideReversed(); Sequence showSequence = previousScreen.Show(); navigationHistory.Pop(); currentScreen = navigationHistory.Peek(); navigationHistory.Pop(); previousScreen = navigationHistory.Peek(); navigationHistory.Push(currentScreen); showSequence.OnComplete(() => { isTransitioningScreens = false; }); CheckAppMenuAvailability(hideSequence); CheckBackHeaderAvailability(showSequence, hideSequence); CheckAppHeaderAvailability(showSequence, hideSequence); CheckAppFooterAvailability(showSequence, hideSequence); }
void Start() { appMenu = appCanvas.GetComponentInChildren <AppMenu>(includeInactive: true); appScreens = appCanvas.GetComponentsInChildren <AppScreen>(includeInactive: true); currentScreen = splashScreen; appMenu?.SetUpAnimations(); backHeaderAnimation?.SetUp(); appHeaderAnimation?.SetUp(); appFooterAnimation?.SetUp(); foreach (AppScreen appScreen in appScreens) { appScreen.SetUpAnimations(); if (appScreen != splashScreen) { appScreen.Deactivate(); } } splashScreen.Show(); navigationHistory.Push(currentScreen); CheckAppMenuAvailability(); }
void MoveToScreen(AppScreen nextScreen, bool resetCurrentOnTransitionEnd) { if (isTransitioningScreens || nextScreen == currentScreen || (appMenu && appMenu.BeganValidDrag)) { return; } isTransitioningScreens = true; navigationHistory.Push(nextScreen); Sequence hideSequence = currentScreen.Hide(); Sequence showSequence = nextScreen.Show(); previousScreen = currentScreen; currentScreen = nextScreen; Action <bool> onCompleteAction = (resetScreen) => { isTransitioningScreens = false; if (resetScreen) { previousScreen.ResetAnimations(); } }; showSequence.OnComplete(() => onCompleteAction(resetCurrentOnTransitionEnd)); CheckAppMenuAvailability(hideSequence); CheckBackHeaderAvailability(showSequence, hideSequence); CheckAppHeaderAvailability(showSequence, hideSequence); CheckAppFooterAvailability(showSequence, hideSequence); }