private void CloseScreen(ScreenController screen, IUIAnimation animation = null) { _navigationStack.Remove(screen); if (animation == null) { GameObject.Destroy(screen.gameObject); return; } animation.AnimateOn(screen.GetComponent <RectTransform>()) .Then(() => GameObject.Destroy(screen.gameObject)); }
public ScreenController OpenScreen <T>(IUIAnimation animation = null) where T : ScreenController { var screen = _screenFactory.Create <T>(); _navigationStack.Add(screen); if (animation != null) { animation.AnimateOn(screen.GetComponent <RectTransform>()); } return(screen); }
private void CloseAll(IUIAnimation animation = null) { foreach (var screen in _navigationStack) { if (animation == null) { GameObject.Destroy(screen.gameObject); continue; } animation.AnimateOn(screen.GetComponent <RectTransform>()) .Then(() => GameObject.Destroy(screen.gameObject)); } _navigationStack.Clear(); }