Exemplo n.º 1
0
        public void setCurrentPage(UI_PAGE page)
        {
            hideUIPages();
            currentPage       = page;
            currentPageObject = null;
            setTrinusCursor(false);

            Camera mainCam = trinusProcessor.getMainCamera();

            if (mainCam != null)
            {
                Rect camRect = mainCam.rect;
                transform.localScale = new Vector3(trinusUIDefaultScale * camRect.width / 1f, transform.localScale.y, transform.localScale.z);
            }

            if (customUI != null)
            {
                customUI.gameObject.SetActive(false);
            }

            switch (page)
            {
            case UI_PAGE.INTRO:
                if (introPages != null && currentIntroStage < introPages.Length)
                {
                    introPages [currentIntroStage].gameObject.SetActive(true);
                    currentPageObject = introPages [currentIntroStage].gameObject;
                    if (EventSystem.current != null && getCurrentPageChild("ContinueButton"))
                    {
                        EventSystem.current.SetSelectedGameObject(getCurrentPageChild("ContinueButton").gameObject, null);
                    }
                    setTrinusCursor(true);
                }
                break;

            case UI_PAGE.CONNECTION_WAIT:
                if (connectingPage != null)
                {
                    connectingPage.gameObject.SetActive(true);
                    currentPageObject = connectingPage.gameObject;
                    setTrinusCursor(true);
                }
                break;

            case UI_PAGE.GAME:
                if (gamePage != null)
                {
                    gamePage.gameObject.SetActive(true);
                    currentPageObject = gamePage.gameObject;
                }
                break;

            case UI_PAGE.SETTINGS:
                if (mainSettingsPage != null)
                {
                    mainSettingsPage.gameObject.SetActive(true);
                    currentPageObject = mainSettingsPage.gameObject;

                    if (EventSystem.current != null && getCurrentPageChild("FpsToggle"))
                    {
                        EventSystem.current.SetSelectedGameObject(getCurrentPageChild("FpsToggle").gameObject, null);
                    }
                    setTrinusCursor(true);
                }
                break;

            case UI_PAGE.LENS:
                if (lensSettingsPage != null)
                {
                    lensSettingsPage.gameObject.SetActive(true);
                    currentPageObject = lensSettingsPage.gameObject;

                    if (EventSystem.current != null && getCurrentPageChild("SeparationSlider"))
                    {
                        EventSystem.current.SetSelectedGameObject(getCurrentPageChild("SeparationSlider").gameObject, null);
                    }
                    setTrinusCursor(true);
                }
                break;
            }
        }