Fix: updateRecord before Result

This commit is contained in:
2018-12-25 18:49:34 +09:00
parent 1a2dde8a94
commit 4c1a2a278e
18 changed files with 287 additions and 56 deletions
+25 -3
View File
@@ -1,13 +1,15 @@
var Game = {
create: function() {
this.dbConnectManager = new DBConnectManager();
this.game.stage.backgroundColor = "#000000"; // '#4d4d4d';
sessionStorageManager.setIsNewAppHighestRecord(false);
var experienceAppTimer = new ExperienceAppTimer();
experienceAppTimer.setTimeOverListener(
(function() { this.gameOver(); }).bind(this)
(function() { this.timeOver(); }).bind(this)
);
// keyboard shortcut
@@ -134,14 +136,34 @@ var Game = {
this.alienTimer.start();
},
timeOver: function() {
var timeOverText = new TimeOverText();
this.stopAndGoResult();
},
gameOver: function() {
var gameOverText = new GameOverText();
this.updateResultRecord();
this.stopAndGoResult();
},
stopAndGoResult: function() {
this.alienTimer.stop();
var gameOverText = new GameOverText();
game.time.events.add(Phaser.Timer.SECOND * 2, this.goResult, this);
},
updateResultRecord: function() {
if(sessionStorageManager.getMaestroAccountType() < 100) { // experience account
this.dbConnectManager.updateResultRecord(
sessionStorageManager.getMaestroID(),
sessionStorageManager.getPlayerID(),
sessionStorageManager.getPlayingAppID(),
sessionStorageManager.getRecord()
);
}
},
goResult: function() {
location.href = '../../web/client/result.html';
},