Example #1
0
    public void ActivatePreviousView()
    {
        if (_navigationHistoryStack.Count == 0)
        {
            Application.Quit();
            return;
        }

        var prevPresenter = _navigationHistoryStack.Pop();

        OnViewTransition?.Invoke(_active.ViewGameObject, prevPresenter.ViewGameObject, UiTransitionType.Backward);
        _active.HideView();
        _active = prevPresenter;
        _active.DisplayView(null);

        HandleHistoryNavigation();
    }
Example #2
0
    public void ActivateView(ViewType viewType, IDictionary args = null)
    {
        if (!_presenters.TryGetValue(viewType, out var requestedPresenter))
        {
            Debug.LogError($"Requested view {viewType} was not found");
            return;
        }

        if (_active != null)
        {
            _active.HideView();
            _navigationHistoryStack.Push(_active);

            OnViewTransition?.Invoke(_active.ViewGameObject, requestedPresenter.ViewGameObject, UiTransitionType.Forward);
        }

        _active = requestedPresenter;
        _active.DisplayView(args);

        HandleHistoryNavigation();
    }