Example #1
0
    private IEnumerator OpenSaveMenuCoroutine()
    {
        EventSystem.current.sendNavigationEvents = false;
        // yield return StartCoroutine(ButtonsDissolveOut());

        if (startMenu.gameObject.activeSelf)
        {
            // startMenuBackgroundAnimator.SetBool("fade", false);
        }
        // backgroundAnimator.SetBool("fade", true);

        DissolveController[] dissolves = startMenu.GetComponentsInChildren <DissolveController>();

        for (int i = 0; i < dissolves.Length - 1; i++)
        {
            StartCoroutine(dissolves[i].DissolveOutCoroutine(dissolveDuration));
            yield return(new WaitForSeconds(dissolveOffset));
        }

        yield return(StartCoroutine(dissolves[dissolves.Length - 1].DissolveOutCoroutine(dissolveDuration)));

        startMenu.gameObject.SetActive(false);
        savesMenu.gameObject.SetActive(true);
        chaptersMenu.gameObject.SetActive(false);
        optionsMenu.gameObject.SetActive(false);

        int    lastSaveSelected   = savesMenu.gameObject.GetComponent <SavesMenu>().LastSelected;
        Button lastButtonSelected = savesMenu.gameObject.GetComponent <SavesMenu>().savesButons[lastSaveSelected];

        EventSystem.current.SetSelectedGameObject(lastButtonSelected.gameObject);
        savesMenu.UpdateButtons();

        dissolves = savesMenu.GetComponentsInChildren <DissolveController>();
        for (int i = 0; i < dissolves.Length - 1; i++)
        {
            StartCoroutine(dissolves[i].DissolveInCoroutine(dissolveDuration));
            yield return(new WaitForSeconds(dissolveOffset));
        }

        EventSystem.current.sendNavigationEvents = true;
        yield return(StartCoroutine(dissolves[dissolves.Length - 1].DissolveInCoroutine(dissolveDuration)));

        menuCamera.SetReturnToStartMenu(false);
        menuCamera.SetReturnToSavesMenu(true);

        //yield return StartCoroutine(SavesDissolveIn());
    }
Example #2
0
    void Update()
    {
        // Cancel
        if (Input.GetButtonDown("B_G"))
        {
            if (statsOpen)
            {
                DisplayStatistics();
            }
            // Close the chapter
            else if (chapterMenuIsOpen)
            {
                menuLevels.ResetScreenshots();
                menuLevels.enabled = false;
                chapterMenuIsOpen  = false;
                chapterButtonsPanel.SetActive(true);
                metaDataIcon.gameObject.SetActive(true);
                EventSystem.current.SetSelectedGameObject(chapterButtons[GameManager.Instance.CurrentChapter].gameObject);
                if (menuChapterAnimator != null)
                {
                    menuChapterAnimator.SetBool("open", false);
                }
                menuCamera.SetZoom(false);
            }
            else if (!chapterMenuIsOpen)
            {
                menuCamera.SetReturnToSavesMenu(true);
                menuManager.OpenSaveMenu();
            }
        }

        if (Input.GetButtonDown("Start_G") && !chapterMenuIsOpen)
        {
            DisplayStatistics();
        }

        // leftArrow.GetComponent<Image>().color = new Color(255, 255, 255, 1);
        // rightArrow.GetComponent<Image>().color = new Color(255, 255, 255, 1);

        // if (localIndexCurrentChapter == 0)
        // {
        //     leftArrow.GetComponent<Image>().color = new Color(255, 255, 255, 0);
        // }
        // if (localIndexCurrentChapter >= chaptersName.Count - 1)
        // {
        //     rightArrow.GetComponent<Image>().color = new Color(255, 255, 255, 0);
        // }
        // else if (!chapterButtons[localIndexCurrentChapter + 1].interactable)
        // {
        //     rightArrow.GetComponent<Image>().color = new Color(255, 255, 255, 0);
        // }
    }