Exemplo n.º 1
0
    public void HideMenuScreen(MenuScreen menuScreen, Action onFinish = null)
    {
        _canvasGroup.interactable = false;
        HideAllPopups();
        //Searching for last inactive menu screen, deactivating current screen and activating last inactive screen
        var screenToShow = _menuScreens.Values.OrderBy(e => e.RootIndex).LastOrDefault(e => !e.IsActive);

        menuScreen.PlayHideAnimation(() => {
            _canvasGroup.interactable = true;
            menuScreen.SetActive(false);
            menuScreen.transform.SetAsFirstSibling();////

            /*
             * if (screenToShow != null) {
             *  screenToShow.SetActive(true);
             * }
             */
            CurrentMenuScreen = screenToShow;
            onFinish?.Invoke();
        });
    }