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
+46
View File
@@ -0,0 +1,46 @@
MissionClearText.prototype = Object.create(Phaser.Text.prototype);
MissionClearText.constructor = MissionClearText;
function MissionClearText() {
Phaser.Text.call(
this, game,
game.world.width / 2,
game.world.height / 2 - MissionClearText.MOVE_AMOUNT_PX,
"작업 완료",
MissionClearText.DEFAULT_TEXT_FONT
);
// super(game, 600, 300, "게임 오버", MissionClearText.DEFAULT_TEXT_FONT);
this.anchor.set(0.5);
this.inputEnabled = false;
var grd = this.context.createLinearGradient(0, 0, 0, this.height);
grd.addColorStop(0, '#8ED6FF');
grd.addColorStop(1, '#4C6CB3');
this.fill = grd;
// this.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
this.stroke = '#000';
this.strokeThickness = 10;
this.alpha = 0;
var tweenAlpha = game.add.tween(this);
tweenAlpha.to( { alpha: 1 }, MissionClearText.TWEEN_ALPHA_TIME, Phaser.Easing.Linear.None, true);
var tweenMove = game.add.tween(this);
tweenMove.to( { y: game.world.height / 2 }, MissionClearText.TWEEN_MOVE_TIME, Phaser.Easing.Bounce.Out, true);
game.add.existing(this);
};
MissionClearText.DEFAULT_TEXT_FONT = {
font: "bold 100px Arial",
boundsAlignH: "center", // left, center. right
boundsAlignV: "middle", // top, middle, bottom
fill: "#fff"
};
MissionClearText.MOVE_AMOUNT_PX = 200;
MissionClearText.TWEEN_ALPHA_TIME = 1000;
MissionClearText.TWEEN_MOVE_TIME = 1500;
+46
View File
@@ -0,0 +1,46 @@
TimeOverText.prototype = Object.create(Phaser.Text.prototype);
TimeOverText.constructor = TimeOverText;
function TimeOverText() {
Phaser.Text.call(
this, game,
game.world.width / 2,
game.world.height / 2 - TimeOverText.MOVE_AMOUNT_PX,
"타임 오버",
TimeOverText.DEFAULT_TEXT_FONT
);
// super(game, 600, 300, "게임 오버", TimeOverText.DEFAULT_TEXT_FONT);
this.anchor.set(0.5);
this.inputEnabled = false;
var grd = this.context.createLinearGradient(0, 0, 0, this.height);
grd.addColorStop(0, '#FFD68E');
grd.addColorStop(1, '#B34C00');
this.fill = grd;
// this.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
this.stroke = '#000';
this.strokeThickness = 10;
this.alpha = 0;
var tweenAlpha = game.add.tween(this);
tweenAlpha.to( { alpha: 1 }, TimeOverText.TWEEN_ALPHA_TIME, Phaser.Easing.Linear.None, true);
var tweenMove = game.add.tween(this);
tweenMove.to( { y: game.world.height / 2 }, TimeOverText.TWEEN_MOVE_TIME, Phaser.Easing.Bounce.Out, true);
game.add.existing(this);
};
TimeOverText.DEFAULT_TEXT_FONT = {
font: "bold 100px Arial",
boundsAlignH: "center", // left, center. right
boundsAlignV: "middle", // top, middle, bottom
fill: "#fff"
};
TimeOverText.MOVE_AMOUNT_PX = 200;
TimeOverText.TWEEN_ALPHA_TIME = 1000;
TimeOverText.TWEEN_MOVE_TIME = 1500;
+20 -5
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
@@ -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';
},
+31 -5
View File
@@ -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';
},
+27 -9
View File
@@ -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';
},
+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';
},
+3 -3
View File
@@ -39,9 +39,9 @@ var Result = {
// contents
this.printRecord();
if(sessionStorageManager.getMaestroAccountType() < 100) { // experience account
this.updateResultRecord();
}
// if(sessionStorageManager.getMaestroAccountType() < 100) { // experience account
// this.updateResultRecord();
// }
this.makeRestartButton();
+20 -6
View File
@@ -1,6 +1,8 @@
var TypingPractice = {
create: function() {
this.dbConnectManager = new DBConnectManager();
var self = this;
this.isOnStage = false;
@@ -10,7 +12,7 @@ var TypingPractice = {
var experienceAppTimer = new ExperienceAppTimer();
experienceAppTimer.setTimeOverListener(
(function() { this.gameOver(); }).bind(this)
(function() { this.timeOver(); }).bind(this)
);
game.stage.backgroundColor = '#4d4d4d';
@@ -26,7 +28,7 @@ var TypingPractice = {
self.isOnStage = false;
// self.goResult();
self.gameOver();
self.timeOver();
}));
@@ -130,7 +132,7 @@ var TypingPractice = {
this.moveHands();
},
gameOver: function() {
timeOver: function() {
this.isOnStage = false;
for(var i = 0; i < TypingPractice.TYPING_CONTENT_DONE_COUNT; i++) {
@@ -151,14 +153,26 @@ var TypingPractice = {
this.rightHand.moveToDefaultPosition();
this.animalList.stopAnimation();
var timeOverText = new TimeOverText();
sessionStorageManager.setRecord(this.typingScore.getScore());
this.updateResultRecord();
var gameOverText = new GameOverText();
game.time.events.add(Phaser.Timer.SECOND * 2, this.goResult, this);
},
goResult: function() {
sessionStorageManager.setRecord(this.typingScore.getScore());
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';
},
+31 -6
View File
@@ -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');
}
}
+22 -6
View File
@@ -1,6 +1,8 @@
var WhacAMole = {
create: function() {
this.dbConnectManager = new DBConnectManager();
var self = this;
this.isOnStage = false;
@@ -10,7 +12,7 @@ var WhacAMole = {
var experienceAppTimer = new ExperienceAppTimer();
experienceAppTimer.setTimeOverListener(
(function() { this.gameOver(); }).bind(this)
(function() { this.timeOver(); }).bind(this)
);
game.stage.backgroundColor = '#4d4d4d';
@@ -45,7 +47,7 @@ var WhacAMole = {
self.isOnStage = false;
// self.goResult();
self.gameOver();
self.timeOver();
}));
@@ -155,7 +157,7 @@ var WhacAMole = {
this.showHighlightKey();
},
gameOver: function() {
timeOver: function() {
this.isOnStage = false;
for(var i = 0; i < WhacAMole.TYPING_CONTENT_DONE_COUNT; i++) {
@@ -173,13 +175,27 @@ var WhacAMole = {
this.textTypingContentPreview[i].text = "";
}
var gameOverText = new GameOverText();
var timeOverText = new TimeOverText();
sessionStorageManager.setRecord(this.scoreManager.getScore());
if(!isExperienceMaestroAccount())
this.updateResultRecord();
game.time.events.add(Phaser.Timer.SECOND * 2, this.goResult, this);
},
goResult: function() {
sessionStorageManager.setRecord(this.scoreManager.getScore());
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';
},
+2 -2
View File
@@ -46,7 +46,7 @@
<script src="../../game/lib/util/record_util.js"></script>
<script src="../../game/lib/text/input_type_text.js?update_date=191224"></script>
<script src="../../game/lib/text/game_over_text.js?update_date=191224"></script>
<script src="../../game/lib/text/time_over_text.js?update_date=191225"></script>
<script src="../../game/lib/text/score_board.js?update_date=191224"></script>
<script src="../../game/lib/text/score_text.js?update_date=191224"></script>
<script src="../../game/lib/text/screen_top_ui.js?update_date=191224"></script>
@@ -68,7 +68,7 @@
<script src="../../game/mouse/card_matching/dude_card.js"></script>
<script src="../../game/mouse/card_matching/plus_score.js"></script>
<script src="../../game/mouse/card_matching/game.js"></script>
<script src="../../game/mouse/card_matching/game.js?update_date=191225"></script>
<script src="../../game/mouse/card_matching/main.js"></script>
+2 -1
View File
@@ -46,6 +46,7 @@
<script src="../../game/lib/util/record_util.js"></script>
<script src="../../game/lib/text/input_type_text.js?update_date=191224"></script>
<script src="../../game/lib/text/time_over_text.js?update_date=191225"></script>
<script src="../../game/lib/text/game_over_text.js?update_date=191224"></script>
<script src="../../game/lib/text/score_board.js?update_date=191224"></script>
<script src="../../game/lib/text/score_text.js?update_date=191224"></script>
@@ -65,7 +66,7 @@
<script src="../../game/mouse/dodge/spaceship.js"></script>
<script src="../../game/mouse/dodge/missile.js"></script>
<script src="../../game/mouse/dodge/stop_watch.js"></script>
<script src="../../game/mouse/dodge/game.js"></script>
<script src="../../game/mouse/dodge/game.js?update_date=191225"></script>
<script src="../../game/mouse/dodge/main.js"></script>
+2 -2
View File
@@ -46,7 +46,7 @@
<script src="../../game/lib/util/record_util.js"></script>
<script src="../../game/lib/text/input_type_text.js?update_date=191224"></script>
<script src="../../game/lib/text/game_over_text.js?update_date=191224"></script>
<script src="../../game/lib/text/time_over_text.js?update_date=191225"></script>
<script src="../../game/lib/text/score_board.js?update_date=191224"></script>
<script src="../../game/lib/text/score_text.js?update_date=191224"></script>
<script src="../../game/lib/text/screen_top_ui.js?update_date=191224"></script>
@@ -71,7 +71,7 @@
<script src="../../game/mouse/grilled_meat/plus_score.js"></script>
<script src="../../game/mouse/grilled_meat/speech_bubble.js"></script>
<script src="../../game/mouse/grilled_meat/game.js"></script>
<script src="../../game/mouse/grilled_meat/game.js?update_date=191225"></script>
<script src="../../game/mouse/grilled_meat/main.js"></script>
+1 -1
View File
@@ -43,7 +43,7 @@
<script src="../../game/result/history_board.js"></script>
<script src="../../game/result/ranking_board.js"></script>
<script src="../../game/result/record_board.js"></script>
<script src="../../game/result/result.js"></script>
<script src="../../game/result/result.js?update_date=191225"></script>
<script src="../../game/result/main.js"></script>
+2 -1
View File
@@ -46,6 +46,7 @@
<script src="../../game/lib/util/record_util.js"></script>
<script src="../../game/lib/text/input_type_text.js?update_date=191224"></script>
<script src="../../game/lib/text/time_over_text.js?update_date=191225"></script>
<script src="../../game/lib/text/game_over_text.js?update_date=191224"></script>
<script src="../../game/lib/text/score_board.js?update_date=191224"></script>
<script src="../../game/lib/text/score_text.js?update_date=191224"></script>
@@ -66,7 +67,7 @@
<script src="../../game/mouse/space_invaders/loading.js"></script>
<script src="../../game/mouse/space_invaders/alien.js"></script>
<script src="../../game/mouse/space_invaders/alien_timer.js"></script>
<script src="../../game/mouse/space_invaders/game.js"></script>
<script src="../../game/mouse/space_invaders/game.js?update_date=191225"></script>
<script src="../../game/mouse/space_invaders/main.js"></script>
+2 -2
View File
@@ -48,7 +48,7 @@
<script src="../../game/lib/util/record_util.js"></script>
<script src="../../game/lib/text/input_type_text.js?update_date=191224"></script>
<script src="../../game/lib/text/game_over_text.js?update_date=191224"></script>
<script src="../../game/lib/text/time_over_text.js?update_date=191224"></script>
<script src="../../game/lib/text/score_text.js?update_date=191224"></script>
<script src="../../game/lib/text/screen_top_ui.js?update_date=191224"></script>
<script src="../../game/lib/text/screen_bottom_ui.js?update_date=191224"></script>
@@ -96,7 +96,7 @@
<script src="../../game/typing/practice/define_variables.js"></script>
<script src="../../game/typing/practice/typing_score.js"></script>
<script src="../../game/typing/practice/loading.js"></script>
<script src="../../game/typing/practice/game.js"></script>
<script src="../../game/typing/practice/game.js?update_date=191225"></script>
<script src="../../game/typing/practice/main.js"></script>
+3 -2
View File
@@ -47,7 +47,8 @@
<script src="../../game/lib/util/record_util.js"></script>
<script src="../../game/lib/text/input_type_text.js?update_date=191224"></script>
<script src="../../game/lib/text/game_over_text.js?update_date=191224"></script>
<script src="../../game/lib/text/time_over_text.js?update_date=191225"></script>
<script src="../../game/lib/text/mission_clear_text.js?update_date=191225"></script>
<script src="../../game/lib/text/screen_top_ui.js?update_date=191224"></script>
<script src="../../game/lib/text/screen_bottom_ui.js?update_date=191224"></script>
@@ -90,7 +91,7 @@
<script src="../../game/typing/test/define_variables.js"></script>
<script src="../../game/typing/test/loading.js"></script>
<script src="../../game/typing/test/average_typing_speed.js"></script>
<script src="../../game/typing/test/game.js"></script>
<script src="../../game/typing/test/game.js?update_date=191225"></script>
<script src="../../game/typing/test/main.js"></script>
+2 -2
View File
@@ -48,7 +48,7 @@
<script src="../../game/lib/util/record_util.js"></script>
<script src="../../game/lib/text/input_type_text.js?update_date=191224"></script>
<script src="../../game/lib/text/game_over_text.js?update_date=191224"></script>
<script src="../../game/lib/text/time_over_text.js?update_date=191224"></script>
<script src="../../game/lib/text/score_board.js?update_date=191224"></script>
<script src="../../game/lib/text/score_text.js?update_date=191224"></script>
<script src="../../game/lib/text/screen_top_ui.js?update_date=191224"></script>
@@ -101,7 +101,7 @@
<script src="../../game/typing/whac_a_mole/mole.js"></script>
<script src="../../game/typing/whac_a_mole/hammer.js"></script>
<script src="../../game/typing/whac_a_mole/loading.js"></script>
<script src="../../game/typing/whac_a_mole/game.js"></script>
<script src="../../game/typing/whac_a_mole/game.js?update_date=191225"></script>
<script src="../../game/typing/whac_a_mole/main.js"></script>