Fix: updateRecord before Result
This commit is contained in:
@@ -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
|
||||
@@ -47,7 +49,7 @@ var Game = {
|
||||
(function() {
|
||||
this.setClickEnable(false);
|
||||
|
||||
this.gameOver();
|
||||
this.timeOver();
|
||||
}).bind(this)
|
||||
);
|
||||
|
||||
@@ -540,7 +542,11 @@ var Game = {
|
||||
},
|
||||
|
||||
|
||||
gameOver: function() {
|
||||
timeOver: function() {
|
||||
var timeOverText = new TimeOverText();
|
||||
if(!isExperienceMaestroAccount())
|
||||
this.updateResultRecord();
|
||||
|
||||
this.activatedCardColumnNo = 0;
|
||||
this.activatedCardRowNo = 0;
|
||||
this.initCards();
|
||||
@@ -553,11 +559,20 @@ var Game = {
|
||||
}
|
||||
this.gameTimeEvents = [];
|
||||
|
||||
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';
|
||||
},
|
||||
|
||||
@@ -5,6 +5,8 @@ var Game = {
|
||||
// },
|
||||
|
||||
create: function() {
|
||||
this.dbConnectManager = new DBConnectManager();
|
||||
|
||||
game.physics.enable(this, Phaser.Physics.ARCADE);
|
||||
|
||||
this.indexMissile = 0;
|
||||
@@ -15,7 +17,7 @@ var Game = {
|
||||
|
||||
var experienceAppTimer = new ExperienceAppTimer();
|
||||
experienceAppTimer.setTimeOverListener(
|
||||
(function() { this.gameOver(); }).bind(this)
|
||||
(function() { this.timeOver(); }).bind(this)
|
||||
);
|
||||
|
||||
// keyboard shortcut
|
||||
@@ -39,19 +41,18 @@ var Game = {
|
||||
// contents
|
||||
this.spaceship = new Spaceship();
|
||||
|
||||
this.aliens = [];
|
||||
this.missiles = [];
|
||||
for(var i = 0; i < Game.MAX_MISSILE_COUNT; i++) {
|
||||
var alien = new Missile(this.spaceship,
|
||||
(function() {
|
||||
this.spaceship.alpha = 0;
|
||||
this.spaceship.body.enable = false;
|
||||
|
||||
this.showExplosionParticle();
|
||||
|
||||
this.gameOver();
|
||||
}).bind(this) // onCollisionHandler
|
||||
);
|
||||
this.aliens.push(alien);
|
||||
this.missiles.push(alien);
|
||||
}
|
||||
|
||||
|
||||
@@ -141,20 +142,45 @@ var Game = {
|
||||
return;
|
||||
}
|
||||
|
||||
this.aliens[this.indexMissile].setActive(true);
|
||||
this.missiles[this.indexMissile].setActive(true);
|
||||
// console.log(this.indexMissile);
|
||||
}
|
||||
},
|
||||
|
||||
timeOver: function() {
|
||||
this.spaceship.alpha = 0;
|
||||
this.spaceship.body.enable = false;
|
||||
this.showExplosionParticle();
|
||||
|
||||
var timeOverText = new TimeOverText();
|
||||
this.stopAndGoResult();
|
||||
},
|
||||
|
||||
gameOver: function() {
|
||||
var gameOverText = new GameOverText();
|
||||
this.stopAndGoResult();
|
||||
},
|
||||
|
||||
stopAndGoResult: function() {
|
||||
var recordTime = this.stopWatch.stop();
|
||||
sessionStorageManager.setRecord(recordTime);
|
||||
if(!isExperienceMaestroAccount())
|
||||
this.updateResultRecord();
|
||||
|
||||
game.time.events.add(Game.GAME_OVER_WAIT_TIME_MS, 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';
|
||||
},
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
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)
|
||||
);
|
||||
|
||||
// keyboard shortcut
|
||||
this.keyboardShortcut = new KeyboardShortcut();
|
||||
this.keyboardShortcut.addCallback(
|
||||
@@ -46,7 +43,7 @@ var Game = {
|
||||
Game.GAME_TIME_SEC,
|
||||
(function() {
|
||||
this.setClickEnable(false);
|
||||
this.gameOver();
|
||||
this.timeOver();
|
||||
}).bind(this)
|
||||
);
|
||||
|
||||
@@ -85,6 +82,12 @@ var Game = {
|
||||
this.speechBubble.hideSpeechBubble();
|
||||
|
||||
|
||||
var experienceAppTimer = new ExperienceAppTimer();
|
||||
experienceAppTimer.setTimeOverListener(
|
||||
(function() { this.timeOver(); }).bind(this)
|
||||
);
|
||||
|
||||
|
||||
// bottom ui
|
||||
var screenBottomUI = new ScreenBottomUI();
|
||||
screenBottomUI.printLeftTextWithAppHighestRecord(sessionStorageManager.getAppHighestRecord());
|
||||
@@ -287,8 +290,14 @@ var Game = {
|
||||
},
|
||||
|
||||
|
||||
timeOver: function() {
|
||||
var timeOverText = new TimeOverText();
|
||||
if(!isExperienceMaestroAccount())
|
||||
this.updateResultRecord();
|
||||
this.stopAndGoResult();
|
||||
},
|
||||
|
||||
gameOver: function() {
|
||||
stopAndGoResult: function() {
|
||||
for(var i = 0; i < this.gameTimeEvents.length; i++) {
|
||||
game.time.events.remove(this.gameTimeEvents[i]);
|
||||
}
|
||||
@@ -298,11 +307,20 @@ var Game = {
|
||||
this.meatGroup.children[i].hide();
|
||||
}
|
||||
|
||||
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';
|
||||
},
|
||||
|
||||
@@ -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';
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user