Game Development Reference
In-Depth Information
break;
case Page.SERVERSCORE:
ServerScorePage(); //Creating server score page
break;
}
//Creating the Restart Button
if (GUI.Button(new Rect((Screen.width - 240)*0.5, (Screen.
height*0.1) + 320, 240, 30), "RESTART")) {
b_isClickRestart = true;
Restart();
}
} else {
//If we clicked on the restart button - just put the
Loading... text here
GUI.Box(new Rect(Screen.width*0.1, Screen.height*0.1,
Screen.width * 0.8, Screen.height * 0.8), "", GUI.skin.
GetStyle("Box2"));
GUI.Label(new Rect((Screen.width-150)*0.5, (Screen.
height-50)*0.5, 150, 50), "LOADING...", GUI.skin.
GetStyle("Text1"));
}
}
}
4. Then, create the new GameoverPage() funcion:
//Creating Gameover Page GUI
private function GameoverPage() : void {
//Creating the background box
GUI.Box(new Rect(Screen.width*0.1, Screen.height*0.1, Screen.
width * 0.8, Screen.height * 0.8), "GAMEOVER", GUI.skin.
GetStyle("Box2"));
//Creating Text Label to show the final score of the player
GUI.Label(new Rect((Screen.width - 400)*0.5, (Screen.height*0.1)
+ 50, 400, 25), "Final Score: " + TimeScoreUI.int_currentScore.
ToString(), GUI.skin.GetStyle("Text1"));
//If the user didn't click submit, we create the submit button
and text field for the player to submit the score
if (b_isClickSubmit == false) {
GUI.Label(new Rect((Screen.width - 300)*0.5, (Screen.
height*0.1) + 80, 300, 25), "Enter Your Name", GUI.skin.
GetStyle("Text1"));
//Creating the input text field to get the player name
userName = GUI.TextField(new Rect((Screen.width - 240)*0.5,
(Screen.height*0.1) + 120, 240, 40), userName, 8);
//Submit button
 
Search WWH ::




Custom Search