Fix: complete TimeUtil, RealtimeStageTimer

This commit is contained in:
2019-08-27 11:44:12 +09:00
parent 5e076c5d40
commit 7b8b53e7ca
5 changed files with 143 additions and 20 deletions
+21 -17
View File
@@ -46,26 +46,22 @@ TypingExamination.prototype.create = function() {
this.averageTypingSpeedText = new AverageTypingSpeed();
this.textTimer = this.makeDefaultText(960, 30);
this.textTimer.anchor.set(1, 0.5);
this.textTimer.fontSize = 30;
this.textTimer = null;
this.realtimeStageTimer = new RealtimeStageTimer(TypingExamination.GAME_TIME_SEC);
this.realtimeStageTimer.setTimeUpdateEvent(
(function(timeLeftSec) {
if(this.textTimer === null)
return;
this.stageTimer = new RealtimeStageTimer(Phaser.Timer.SECOND * 300);
this.stageTimer.setTimeUpdateEvent(
(function(timeLeftMS) {
this.textTimer.text = "남은 시간 : " + Math.floor(timeLeftMS);
this.textTimer.text = TimeUtil.printHHMMSSFromSec(timeLeftSec);
}).bind(this)
);
this.stageTimer.start();
/*
this.stageTimer = new StageTimer(
TypingExamination.GAME_TIME_SEC,
this.realtimeStageTimer.setTimeOverEvent(
(function() {
// this.setClickEnable(false);
this.timeOver();
this.textTimer.text = "타임 오버";
console.log("Time over");
}).bind(this)
);
*/
// bottom ui
@@ -82,6 +78,7 @@ TypingExamination.prototype.fontLoaded = function() {
// this.animalRecordList.hide();
this.animalRecordList.applyLoadedFont();
this.makeStageTimerText();
this.makeTextContents();
}
@@ -96,6 +93,13 @@ TypingExamination.prototype.makeDefaultText = function(x, y) {
return defaultText;
}
TypingExamination.prototype.makeStageTimerText = function() {
this.textTimer = this.makeDefaultText(960, 30);
this.textTimer.anchor.set(1, 0.5);
this.textTimer.fontSize = 30;
this.textTimer.text = TimeUtil.printHHMMSSFromSec(TypingExamination.GAME_TIME_SEC);
}
TypingExamination.prototype.makeUnderlineText = function(x, y) {
var CONTENT_TEXT_WIDTH = 800;
var CONTENT_UNDERLINE_OFFSET_Y = 20; // 17;
@@ -278,7 +282,7 @@ TypingExamination.prototype.startGame = function() {
this.showTypingExaminationContents();
this.showPlayingWordNumber();
// this.stageTimer.start();
this.realtimeStageTimer.start();
}
TypingExamination.prototype.timeOver = function() {
@@ -290,7 +294,7 @@ TypingExamination.prototype.gameOver = function() {
var missionClearText = new MissionClearText();
this.stopAndGoResult();
// this.stageTimer.pause();
this.realtimeStageTimer.pause();
}
TypingExamination.prototype.stopAndGoResult = function() {
@@ -636,7 +640,7 @@ TypingExamination.prototype.setTimeTypingStart = function() {
}
TypingExamination.GAME_TIME_SEC = 60 * 5; // 5 minutes
TypingExamination.GAME_TIME_SEC = TimeUtil.MINUTE_SEC * 5; // 5 minutes
TypingExamination.SPACE_INDICATOR = "␣"; // "ˇ"; // "ᵔ"; // "ᵕ"; // "ˣ"; // "ᵛ"; // " · ";
TypingExamination.ENTER_INDICATOR = "⏎"; // "↵"; // "↵";