Fix: time bug

This commit is contained in:
2018-10-31 23:17:38 +09:00
parent 9c91dcbe22
commit 8efad4357f
+24 -22
View File
@@ -169,39 +169,33 @@ var Game = {
startGame: function() { startGame: function() {
this.playingStageNo = 1; this.playingStageNo = 1;
// this.leftTimeSec = 0; // INIT_LEFT_TIME_MIN * 60;
// this.score = 0;
// this.updateScore();
this.startStage(); this.startStage();
}, },
startStage: function() { startStage: function() {
var bonusTime = this.getBonusTime(); var bonusTime = this.getBonusTime();
if(this.playingStageNo == 1) this.showStageNotice(this.playingStageNo + "단계 시작 (제한 시간 : " + bonusTime + "초)");
this.showStageNotice(this.playingStageNo + "단계 시작 (제한 시간 : " + bonusTime + "초)");
else if(bonusTime == 0) this.clearedMeatCount = 0;
this.activatedMeatCount = this.getStageMeatCount();
this.serveMeats();
this.stageTimer.start();
},
startNextStage: function() {
var bonusTime = this.getBonusTime();
if(bonusTime == 0)
this.showStageNotice(this.playingStageNo + "단계 시작"); this.showStageNotice(this.playingStageNo + "단계 시작");
else else
this.showStageNotice(this.playingStageNo + "단계 시작 (보너스 +" + bonusTime + "초)"); this.showStageNotice(this.playingStageNo + "단계 시작 (보너스 +" + bonusTime + "초)");
// this.leftTimeSec += bonusTime;
this.stageTimer.start();
// this.stageTimer.add(bonusTime);
// this.updateLeftTime();
// if(this.playingStageNo == 1)
// this.timeEvent = game.time.events.loop(1000, this.updateLeftTime, this);
this.activatedMeatCount = this.getStageMeatCount();
this.clearedMeatCount = 0; this.clearedMeatCount = 0;
this.activatedMeatCount = this.getStageMeatCount();
this.serveMeats(); this.serveMeats();
}, },
startNextStage: function() {
},
setClickEnable: function(value) { setClickEnable: function(value) {
this.isEnableClick = value; this.isEnableClick = value;
@@ -249,7 +243,7 @@ var Game = {
showStageNotice: function(text) { showStageNotice: function(text) {
this.stageNoticeText.alpha = 0; this.stageNoticeText.alpha = 0;
this.stageNoticeText.text = text; this.stageNoticeText.text = text;
this.animateTextAlpha(this.stageNoticeText, 1, 0, 1000, Phaser.Easing.Linear.None); this.animateTextAlpha(this.stageNoticeText, 1, 0, Phaser.Timer.SECOND * 2, Phaser.Easing.Linear.None);
}, },
@@ -341,7 +335,7 @@ var Game = {
this.showStageNotice(this.playingStageNo + "단계 완료"); this.showStageNotice(this.playingStageNo + "단계 완료");
this.playingStageNo++; this.playingStageNo++;
var startStageTimeEvent = game.time.events.add(Phaser.Timer.SECOND * 1, this.startStage, this); var startStageTimeEvent = game.time.events.add(Phaser.Timer.SECOND * 1, this.startNextStage, this);
this.gameTimeEvents[this.gameTimeEvents.length + 1] = startStageTimeEvent; this.gameTimeEvents[this.gameTimeEvents.length + 1] = startStageTimeEvent;
}, },
@@ -355,6 +349,14 @@ var Game = {
gameOver: function() { gameOver: function() {
for(var i = 0; i < this.gameTimeEvents.length; i++) {
game.time.events.remove(this.gameTimeEvents[i]);
}
this.gameTimeEvents = [];
var gameOverText = new GameOverText();
game.time.events.add(Phaser.Timer.SECOND * 2, this.goResult, this);
}, },
goResult: function() { goResult: function() {
@@ -371,7 +373,7 @@ Game.INIT_LEFT_TIME_MIN = 2;
Game.MAX_MEAT_COUNT = 20; Game.MAX_MEAT_COUNT = 20;
Game.HEAT_PLATE_HANDLE_WIDTH = 440; Game.HEAT_PLATE_HANDLE_WIDTH = 440;
Game.HEAT_PLATE_START_OFFSET_Y = 80; Game.HEAT_PLATE_START_OFFSET_Y = 80;
Game.HEAT_PLATE_HEIGHT = 220; Game.HEAT_PLATE_HEIGHT = 220;