void Start() { Screen.orientation = ScreenOrientation.LandscapeLeft; Gameoptions.Start(); Debug.Log("Startup Complete"); GUIScale.SetAspectRatio(); GUIScale.SetGuiMatrix(); }
void OnGUI() { GUIScale.SetGuiMatrix(); GUI.skin.label.fontSize = 36; GUI.skin.button.fontSize = 48; GUI.skin.box.fontSize = 64; GUI.Box(new Rect(GUIScale.virtualWidth * .10f, GUIScale.virtualHeight * .10f, GUIScale.virtualWidth * .80f, GUIScale.virtualHeight * .82f), "Select Gametype"); if (GUI.Button(new Rect(GUIScale.virtualWidth * .20f, GUIScale.virtualHeight * .30f, GUIScale.virtualWidth * .60f, GUIScale.virtualHeight * .10f), "Free Play")) { Gameoptions.TypeGame = 0; Gameoptions.SaveOptions(); Application.LoadLevel(1); } if (GUI.Button(new Rect(GUIScale.virtualWidth * .20f, GUIScale.virtualHeight * .45f, GUIScale.virtualWidth * .60f, GUIScale.virtualHeight * .10f), "Colors")) { Gameoptions.TypeGame = 1; Gameoptions.SaveOptions(); Gameoptions.LoadOptions(); Application.LoadLevel(1); } if (GUI.Button(new Rect(GUIScale.virtualWidth * .20f, GUIScale.virtualHeight * .60f, GUIScale.virtualWidth * .60f, GUIScale.virtualHeight * .10f), "Cinema")) { Gameoptions.TypeGame = 2; Gameoptions.SaveOptions(); Application.LoadLevel(1); } if (GUI.Button(new Rect(GUIScale.virtualWidth * .20f, GUIScale.virtualHeight * .75f, GUIScale.virtualWidth * .60f, GUIScale.virtualHeight * .10f), "Counting")) { Gameoptions.TypeGame = 3; Gameoptions.SaveOptions(); Application.LoadLevel(1); } }
void OnGUI() { GUIScale.SetGuiMatrix(); // Make a background box /* * switch (GUIScale.aspect_ratio) * { * case ASPECT_RATIO.SIXTEENTONINE: * */ GUI.skin.label.fontSize = 36; GUI.skin.button.fontSize = 48; GUI.skin.box.fontSize = 64; GUI.Box(new Rect(GUIScale.virtualWidth * .10f, GUIScale.virtualHeight * .10f, GUIScale.virtualWidth * .80f, GUIScale.virtualHeight * .62f), "Welcome to Toy Chest: Fireworks"); // Make the first button. If it is pressed, Application.Loadlevel (1) will be executed if (GUI.Button(new Rect(GUIScale.virtualWidth * .20f, GUIScale.virtualHeight * .30f, GUIScale.virtualWidth * .60f, GUIScale.virtualHeight * .10f), "Start")) { Application.LoadLevel(3); } // Make the second button. if (GUI.Button(new Rect(GUIScale.virtualWidth * .20f, GUIScale.virtualHeight * .45f, GUIScale.virtualWidth * .60f, GUIScale.virtualHeight * .10f), "Options")) { Application.LoadLevel(2); } if (GUI.Button(new Rect(GUIScale.virtualWidth * .20f, GUIScale.virtualHeight * .60f, GUIScale.virtualWidth * .60f, GUIScale.virtualHeight * .10f), "Exit")) { Application.Quit(); } /* * break; * } */ }
void OnGUI() { GUIScale.SetGuiMatrix(); GUI.skin.label.fontSize = 36; GUI.skin.button.fontSize = 48; GUI.skin.box.fontSize = 64; if (Gameoptions.TypeGame == 0) { _typeText = "Gametype: Free Play"; } else if (Gameoptions.TypeGame == 1) { _typeText = "Gametype: Colors"; } else if (Gameoptions.TypeGame == 2) { _typeText = "Gametype: Cinema"; } else if (Gameoptions.TypeGame == 3) { _typeText = "Gametype: Count"; } if (Gameoptions.Repeat == 0) { _repeatText = "Repeat: Off"; } else { _repeatText = "Repeat: On"; } _colorsText = "Number Colors: " + Gameoptions.NumColors.ToString(); if (Gameoptions.ParentalLock == 0) { _lockText = "Parent Lock: Off"; } else { _lockText = "Parent Lock: On"; } _detailText = "Detail: " + Gameoptions.FireworkDetail.ToString(); GUI.Box(new Rect(GUIScale.virtualWidth * .03f, GUIScale.virtualHeight * .10f, GUIScale.virtualWidth * .94f, GUIScale.virtualHeight * .85f), "Game Options"); if (GUI.Button(new Rect(GUIScale.virtualWidth * .08f, GUIScale.virtualHeight * .20f, GUIScale.virtualWidth * .37f, GUIScale.virtualHeight * .10f), "Test")) { testAudioClip = Microphone.Start(null, false, 4, 44100); } if (GUI.Button(new Rect(GUIScale.virtualWidth * .55f, GUIScale.virtualHeight * .20f, GUIScale.virtualWidth * .37f, GUIScale.virtualHeight * .10f), "Save")) { SavWav.Save("myfile", testAudioClip); } if (GUI.Button(new Rect(GUIScale.virtualWidth * .08f, GUIScale.virtualHeight * .40f, GUIScale.virtualWidth * .37f, GUIScale.virtualHeight * .10f), "Play")) { this.audio.clip = testAudioClip; audio.Play(); } if (GUI.Button(new Rect(GUIScale.virtualWidth * .55f, GUIScale.virtualHeight * .40f, GUIScale.virtualWidth * .37f, GUIScale.virtualHeight * .10f), _lockText)) { Gameoptions.IncrementParentalLock(); } if (GUI.Button(new Rect(GUIScale.virtualWidth * .55f, GUIScale.virtualHeight * .60f, GUIScale.virtualWidth * .37f, GUIScale.virtualHeight * .10f), _detailText)) { Gameoptions.IncrementFireworkDetail(); } if (GUI.Button(new Rect(GUIScale.virtualWidth * .20f, GUIScale.virtualHeight * .80f, GUIScale.virtualWidth * .60f, GUIScale.virtualHeight * .10f), "Back")) { Gameoptions.SaveOptions(); Application.LoadLevel(0); } //GUI.Label(new Rect(5, 5, 100, 100), ChildLock.isEnabled().ToString()); }
void OnGUI() { GUIScale.SetGuiMatrix(); GUI.skin.label.fontSize = 72; GUI.skin.button.fontSize = 48; GUI.skin.box.fontSize = 36; if (Gameoptions.TypeGame == 1) { for (int i = 0; i < Gameoptions.NumColors; i++) { if (_gameState != EDU_GAMESTATES.WAIT) { GUI.enabled = false; } if (GUI.Button(new Rect((GUIScale.virtualWidth / Gameoptions.NumColors) * i, GUIScale.virtualHeight * 0.85f, (GUIScale.virtualWidth / Gameoptions.NumColors), GUIScale.virtualHeight * 0.15f), GetColorString(i)) && _gameState == EDU_GAMESTATES.WAIT) { if (_color == i) { _gameState = EDU_GAMESTATES.CORRECT; _gameStateTimer = 0; _stateStart = true; } else { _gameState = EDU_GAMESTATES.INCORRECT; _gameStateTimer = 0; _stateStart = true; } } } GUI.enabled = true; if (_gameState == EDU_GAMESTATES.PROMPT) { GUI.skin.box.fontSize = 72; GUI.Box(new Rect(GUIScale.virtualWidth * 0.2f, GUIScale.virtualHeight * 0.3f, GUIScale.virtualWidth * 0.6f, 86), "Guess the Color!"); } else if (_gameState == EDU_GAMESTATES.CORRECT) { GUI.skin.box.fontSize = 72; GUI.Box(new Rect(GUIScale.virtualWidth * 0.2f, GUIScale.virtualHeight * 0.3f, GUIScale.virtualWidth * 0.6f, 86), "Thats Right!"); } else if (_gameState == EDU_GAMESTATES.INCORRECT) { GUI.skin.box.fontSize = 72; GUI.Box(new Rect(GUIScale.virtualWidth * 0.2f, GUIScale.virtualHeight * 0.3f, GUIScale.virtualWidth * 0.6f, 86), "Not Quite! Guess again!"); } } if (Gameoptions.TypeGame == 3) { for (int i = 0; i < _countList.Length; i++) { if (_gameState != EDU_GAMESTATES.WAIT) { GUI.enabled = false; } if (GUI.Button(new Rect((GUIScale.virtualWidth / _countList.Length) * i, GUIScale.virtualHeight * 0.85f, (GUIScale.virtualWidth / _countList.Length), GUIScale.virtualHeight * 0.15f), GetArrayString(i)) && _gameState == EDU_GAMESTATES.WAIT) { if (_countList[i] == countTarget) { _gameState = EDU_GAMESTATES.CORRECT; _gameStateTimer = 0; _stateStart = true; } else { _gameState = EDU_GAMESTATES.INCORRECT; _gameStateTimer = 0; _stateStart = true; } } } GUI.enabled = true; if (_gameState == EDU_GAMESTATES.PROMPT) { GUI.skin.box.fontSize = 72; GUI.Box(new Rect(GUIScale.virtualWidth * 0.2f, GUIScale.virtualHeight * 0.3f, GUIScale.virtualWidth * 0.6f, 86), "Count the Fireworks!"); } else if (_gameState == EDU_GAMESTATES.CORRECT) { GUI.skin.box.fontSize = 72; GUI.Box(new Rect(GUIScale.virtualWidth * 0.2f, GUIScale.virtualHeight * 0.3f, GUIScale.virtualWidth * 0.6f, 86), "Thats Right!"); } else if (_gameState == EDU_GAMESTATES.INCORRECT) { GUI.skin.box.fontSize = 72; GUI.Box(new Rect(GUIScale.virtualWidth * 0.2f, GUIScale.virtualHeight * 0.3f, GUIScale.virtualWidth * 0.6f, 86), "Not Quite!"); } } }