Game Development Reference
In-Depth Information
}
GUI.EndScrollView (); //End Scroll Area
} else {
//TODO: If the loader doesn't complete display Loading... text
GUI.Label(new Rect((Screen.width-150)*0.5, (Screen.
height*0.1)+120, 150, 50), "LOADING...", GUI.skin.
GetStyle("Text1"));
}
if (GUI.Button(new Rect((Screen.width - 240)*0.5, (Screen.
height*0.1) + 280, 240, 30), "BACK")) {
e_page = Page.GAMEOVER;
}
}
The preceding code will wait for the server to finish loading and display the users'
scoreboard. If the loading didn't finish, the menu will show only the
Loading…
text;
otherwise, it will display the users' names and scores that were returned from the
server database.
11. Finally, go back to Unity editor, click on the
HiScore
game object in the
Hierarchy
to bring up the
Inspector
, then drag-and-drop the
ServerHiScore
script in the
HiScore
game object and click
Play
. When we die or kill all the enemies in the scene,
we will be able to load the
SERVER HI-SCORE
board by clicking on the
SERVER HI-
SCORE
buton, and the
SUBMIT
buton will now submit the score to the server and
save the score to our local machine at the same ime.
We might not get the same image as shown in the preceding screenshot
because the server database will be updated with different users.