Fix: updateRecord before Result
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
var TypingTest = {
|
||||
|
||||
create: function() {
|
||||
this.dbConnectManager = new DBConnectManager();
|
||||
|
||||
var self = this;
|
||||
|
||||
this.initTypingData();
|
||||
@@ -8,7 +10,7 @@ var TypingTest = {
|
||||
|
||||
var experienceAppTimer = new ExperienceAppTimer();
|
||||
experienceAppTimer.setTimeOverListener(
|
||||
(function() { this.gameOver(); }).bind(this)
|
||||
(function() { this.timeOver(); }).bind(this)
|
||||
);
|
||||
|
||||
game.stage.backgroundColor = '#4d4d4d';
|
||||
@@ -164,20 +166,42 @@ var TypingTest = {
|
||||
this.showPlayingWordNumber();
|
||||
},
|
||||
|
||||
gameOver: function() {
|
||||
var gameOverText = new GameOverText();
|
||||
timeOver: function() {
|
||||
var timeOverText = new TimeOverText();
|
||||
this.stopAndGoResult();
|
||||
},
|
||||
|
||||
gameOver: function() {
|
||||
var missionClearText = new MissionClearText();
|
||||
this.stopAndGoResult();
|
||||
},
|
||||
|
||||
stopAndGoResult: function() {
|
||||
this.animalList.stopAnimation();
|
||||
|
||||
sessionStorageManager.setRecord(this.typingRecordTotal);
|
||||
if(!isExperienceMaestroAccount())
|
||||
this.updateResultRecord();
|
||||
|
||||
game.time.events.add(Phaser.Timer.SECOND * 2, this.goResult, this);
|
||||
},
|
||||
|
||||
goResult: function() {
|
||||
sessionStorageManager.setRecord(this.typingRecordTotal);
|
||||
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';
|
||||
},
|
||||
|
||||
|
||||
initTypingData: function() {
|
||||
var typingTextMan = new TypingTextManager();
|
||||
|
||||
@@ -333,7 +357,8 @@ var TypingTest = {
|
||||
this.playNextContent();
|
||||
|
||||
if(this.typingIndex == this.typingContentLength)
|
||||
this.goResult();
|
||||
this.gameOver();
|
||||
// this.goResult();
|
||||
// this.state.start('TypingTestResult');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user