Game Development Reference
In-Depth Information
// Load
_localHiscore.LoadUserData();
_page = PAGE.LOCALSCORE;
}
…
}
// C# user:
…
void Gameover ()
{
…
if (_clickSubmit == false) {
…
if (GUI.Button(_buttonRect1, "SUBMIT")) {
…
_user.score = HitPoint.CURRENT_SCORE;
_localHiscore.SaveUserData(_user);
}
}
if (GUI.Button(_buttonRect2, "LOCAL HI-SCORE")) {
// Load
_localHiscore.LoadUserData();
_page = PAGE.LOCALSCORE;
}
…
}
6. Finally, we will go to the
LocalHiscore()
function to add the code to show
the high-score table data, as shown in the following highlighted code:
// Unity JavaScript user:
…
private function LocalHiscore ()
{
CreateBackgroundBox("LOCAL HI-SCORE");
if (_localHiscore.userLength > 0) {
_scrollLocal = GUI.BeginScrollView (new Rect