public void OnGUI() { GUI.skin = guiSkin; GUIStyle backgroundStyle = new GUIStyle(); backgroundStyle.normal.background = background; GUI.Label(new Rect(0, 0, Screen.width, Screen.height), "", backgroundStyle); GUIStyle menuButton = new GUIStyle(guiSkin.button); menuButton.fontSize = (int)(originalFontSize * (Screen.height / nativeResY)); //Credtis if (Credits != null) { TitlePos.width = Credits.width * CreditsScale; TitlePos.height = Credits.height * CreditsScale; TitlePos.x = Screen.width / 2 - TitlePos.width / 2; TitlePos.y = CreditsHeight; GUI.DrawTexture(TitlePos, Credits); } float buttonWidth = Screen.width * buttonWidthPercent; float buttonHeight = Screen.height * buttonHeightPercent; if (FirstLaunch) { alpha = MenuFade.FadeIn(fadeSpeed, fadeTexture, alpha); if (alpha <= 0) { FirstLaunch = false; } } else if (GUI.Button(new Rect(Screen.width * buttonDisplacementPercentX, Screen.height * buttonDisplacementPercent, buttonWidth, buttonHeight), "Go Back", menuButton)) { pushedGoBack = true; } if (pushedGoBack) { alpha = MenuFade.FadeOut(fadeSpeed, fadeTexture, alpha); if (alpha >= 1) { SceneManager.LoadScene(backButtonIndex); } } }
// Use this for initialization void Start() { // a bool inicializada começa como falsa. bool test = false; //Os gameobjects a seguir sao inicializados para conseguir componentes de outros scripts utilizando //as variaveis ja declaradas. GameObject n = GameObject.Find ("NovoJogo"); novojogo = n.GetComponent<ScriptNovoJogo> (); GameObject f = GameObject.Find ("screenfader"); Fade = f.GetComponent<MenuFade> (); //tudo que pertence ao loading e inativo no inicio do jogo. background.SetActive (false); text1.renderer.enabled = false; progressbar.SetActive (false); }
private int LoadProgress = 0; //Por onde começa o progresso do loading. // Use this for initialization void Start() { // a bool inicializada começa como falsa. bool test = false; //Os gameobjects a seguir sao inicializados para conseguir componentes de outros scripts utilizando //as variaveis ja declaradas. GameObject n = GameObject.Find("NovoJogo"); novojogo = n.GetComponent <ScriptNovoJogo> (); GameObject f = GameObject.Find("screenfader"); Fade = f.GetComponent <MenuFade> (); //tudo que pertence ao loading e inativo no inicio do jogo. background.SetActive(false); text1.renderer.enabled = false; progressbar.SetActive(false); }
void OnGUI() { GUI.skin = guiSkin; GUIStyle backgroundStyle = new GUIStyle(); backgroundStyle.normal.background = background; GUI.Label(new Rect(0, 0, Screen.width, Screen.height), "", backgroundStyle); GUIStyle menuButton = new GUIStyle(guiSkin.button); menuButton.fontSize = (int)(originalFontSize * (Screen.height / nativeResY)); //Title if (title != null) { TitlePos.width = title.width * TitleScale; TitlePos.height = title.height * TitleScale; TitlePos.x = Screen.width / 2 - TitlePos.width / 2; TitlePos.y = TitleHeight; GUI.DrawTexture(TitlePos, title); } float buttonWidth = Screen.width * buttonWidthPercent; float buttonHeight = Screen.height * buttonHeightPercent; if (GUI.Button(new Rect(Screen.width * horizontalButtonDisp - buttonWidth / 2, Screen.height * verticalButtonDisp + buttonHeight * 1 + spacing, buttonWidth, buttonHeight), "New Game", menuButton)) { if (NoOtherButtonsPushed()) { pushedNewGame = true; } } if (GUI.Button(new Rect(Screen.width * horizontalButtonDisp - buttonWidth / 2, Screen.height * verticalButtonDisp + buttonHeight * 2 + 2 * spacing, buttonWidth, buttonHeight), "Credits", menuButton)) { if (NoOtherButtonsPushed()) { creditsPushed = true; } } if (GUI.Button(new Rect(Screen.width * horizontalButtonDisp - buttonWidth / 2, Screen.height * verticalButtonDisp + buttonHeight * 3 + 3 * spacing, buttonWidth, buttonHeight), "Quit", menuButton)) { if (NoOtherButtonsPushed()) { pushedQuit = true; } } if (pushedNewGame) { alpha = MenuFade.FadeOut(fadeOutSpeed, fadeTexture, alpha); if (alpha >= 1) { SceneManager.LoadScene(newGameIndex); } } if (creditsPushed) { alpha = MenuFade.FadeOut(fadeOutSpeed, fadeTexture, alpha); if (alpha >= 1) { SceneManager.LoadScene(creditsIndex); } } if (pushedQuit) { Application.Quit(); pushedQuit = false; } }