void OnGUI() { //set demensions of the buttons float buttonW = Screen.width / 3; float buttonH = Screen.height / 15; GUIStyle style = new GUIStyle(GUI.skin.button); style.fontSize = (int)(buttonH / 2); //set the prebuilt button float halfScreenW = (Screen.width / 2) - buttonW / 2; float halfScreenH = 5 * Screen.height / 12; if (GUI.Button(new Rect(halfScreenW, halfScreenH, buttonW, buttonH), "Original", style)) { Application.LoadLevel("LevelSelectPreMenu"); } //set the random button halfScreenW = (Screen.width / 2) - buttonW / 2; halfScreenH = 6 * Screen.height / 12; if (GUI.Button(new Rect(halfScreenW, halfScreenH, buttonW, buttonH), "Random", style)) { GlobalFlags.setRandLevel(true); Application.LoadLevel("game"); } halfScreenW = (Screen.width / 2) - buttonW / 2; halfScreenH = 7 * Screen.height / 12; if (GUI.Button(new Rect(halfScreenW, halfScreenH, buttonW, buttonH), "Infinite", style)) { GlobalFlags.setRandLevel(true); GlobalFlags.infiniteRandomMode = true; Application.LoadLevel("game"); } //set the user made button // halfScreenW = (Screen.width/2) - buttonW/2; // halfScreenH = 7 * Screen.height/12 + 0; // if (GUI.Button(new Rect(halfScreenW,halfScreenH,buttonW,buttonH),"User Made", style)){ // Application.LoadLevel("LevelSelectUserMenu"); // } //set the option button halfScreenW = (Screen.width / 2) - buttonW / 2; halfScreenH = 10 * Screen.height / 12 + 0; if (GUI.Button(new Rect(halfScreenW, halfScreenH, buttonW, buttonH), "Options", style)) { Application.LoadLevel("OptionsMenu"); } }
void OnGUI() { //button dimensions float buttonW = Screen.width / 4.8f;; float buttonH = Screen.height / 6; float halfScreenW = (Screen.width) - (buttonW * 1.1f); //float halfScreenH = Screen.height/13; float halfScreenH = buttonH / 3; GUIStyle style = new GUIStyle(GUI.skin.button); style.fontSize = (int)(buttonH / 3.5f); GUI.skin = skin; if (GUI.Button(new Rect(halfScreenW, halfScreenH, buttonW, buttonH), "||", style)) { paused = true; GlobalFlags.setPaused(true); } if (paused) { //if paused build the menu buttonW = Screen.width / 2; buttonH = Screen.height / 10; style.alignment = TextAnchor.UpperCenter; GUI.Box(backWindow, "Pause Menu", style); //title the menu style.alignment = TextAnchor.MiddleCenter; // set the resume button and functionality halfScreenW = (Screen.width / 2) - buttonW / 2; halfScreenH = Screen.height / 3; if (GUI.Button(new Rect(halfScreenW, halfScreenH, buttonW, buttonH), "Resume", style)) { paused = false; GlobalFlags.setPaused(false); GlobalFlags.bandAidFixToDefeatAllOtherBandAidFixes = true; } //set the restart button and functionality halfScreenW = (Screen.width / 2) - buttonW / 2; halfScreenH = Screen.height / 3 + buttonH * 1.5f; if (GUI.Button(new Rect(halfScreenW, halfScreenH, buttonW, buttonH), "Restart", style)) { Application.LoadLevel("game"); GlobalFlags.canFire = true; GlobalFlags.trianglesStatic = true; GlobalFlags.setPaused(false); GlobalFlags.updateControlPoints = true; } //set the back to menu button and functionality halfScreenW = (Screen.width / 2) - buttonW / 2; halfScreenH = Screen.height / 3 + buttonH * 3; if (!GlobalFlags.getRandLevel()) { if (GUI.Button(new Rect(halfScreenW, halfScreenH, buttonW, buttonH), "Back To Menu", style)) { Application.LoadLevel("LevelSelectPreMenu"); GlobalFlags.setPaused(false); GlobalFlags.canFire = true; GlobalFlags.trianglesStatic = true; GlobalFlags.updateControlPoints = true; } } else { if (GUI.Button(new Rect(halfScreenW, halfScreenH, buttonW, buttonH), "Back To Menu", style)) { //GlobalFlags.canFire = true; GlobalFlags.setRandLevel(false); GlobalFlags.infiniteRandomMode = false; Application.LoadLevel("ModeSelectMenu"); GlobalFlags.setPaused(false); GlobalFlags.updateControlPoints = true; } } } }