Game Development Reference
In-Depth Information
6. This funcion will create the LOCAL HI-SCORE menu that includes the background
box, the scrolled area to display the user's scores, and the Back buton to go back to
the GAMEOVER page.
7. Finally, we will create the last funcion for the HiScore script, the
ServerScorePage() funcion. This funcion is very similar to the
LocalScorePage() funcion that we created earlier, except that this funcion will
load the score data from the server (we will have to wait unil it is loaded). We will
talk about this in a later step. So right now, we will create the ServerScorePage()
funcion as follows:
//Loading score from server
private function ServerScorePage() : 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), "SERVER HI-SCORE", GUI.skin.
GetStyle("Box2"));
//TODO: Checking is the loader completed
scrollPositionS = GUI.BeginScrollView (new Rect ((Screen.width
- 320)*0.5, (Screen.height*0.1) + 80, 320, 180), scrollPositionS,
new Rect (0, 0, 300, 30*maxUsers));
for (var i: int = 0; i < maxUsers; i++) {
//Setting the number of the user
GUI.Label(new Rect(0, i * 30, 35, 30), (i+1).ToString() +
".");
//TODO: Showing the user name and score here
}
GUI.EndScrollView (); //End Scroll Area
//TODO: If the loader doesn't complete display Loading... text
if (GUI.Button(new Rect((Screen.width - 240)*0.5, (Screen.
height*0.1) + 280, 240, 30), "BACK")) {
e_page = Page.GAMEOVER;
}
}
8. Now, we can go back to Unity and click Play to see our result by leing the
character die or killing all enemies in the scene. We will see something similar
to the following screenshot:
 
Search WWH ::




Custom Search