Fix: update typing record with timer

This commit is contained in:
2019-08-28 11:30:49 +09:00
parent 16850f6eb0
commit cf119e4bf1
+27 -10
View File
@@ -53,13 +53,24 @@ TypingExamination.prototype.create = function() {
if(this.textTimer === null) if(this.textTimer === null)
return; return;
this.textTimer.text = TimeUtil.printHHMMSSFromSec(timeLeftSec); var timeLeft = TimeUtil.printHHMMSSFromSec(timeLeftSec);
if(timeLeft !== this.textTimer.text) {
this.textTimer.text = TimeUtil.printHHMMSSFromSec(timeLeftSec);
this.updateCorrectUnicodeLetterCount();
this.updateTypingRecord();
}
}).bind(this) }).bind(this)
); );
this.realtimeStageTimer.setTimeOverEvent( this.realtimeStageTimer.setTimeOverEvent(
(function() { (function() {
this.textTimer.text = "타임 오버"; this.textTimer.text = "타임 오버";
console.log("Time over"); console.log("Time over");
this.updateCorrectUnicodeLetterCount();
this.updateTypingRecord();
// this.inputTextContent.inputEnabled = false;
}).bind(this) }).bind(this)
); );
@@ -507,6 +518,20 @@ TypingExamination.prototype.onKeyUp = function(event) {
this.highlightTypingContent(notTrimmedInputContent, notTrimmedTypingContent); this.highlightTypingContent(notTrimmedInputContent, notTrimmedTypingContent);
this.updateCorrectUnicodeLetterCount();
this.updateTypingRecord();
if(event.keyCode == Phaser.Keyboard.ENTER)
this.onKeyEnter(trimmedInputContent, trimmedTypingContent, notTrimmedTypingContent);
if(event.keyCode == Phaser.Keyboard.SPACEBAR)
this.onKeyEnter(trimmedInputContent, trimmedTypingContent, notTrimmedTypingContent);
}
TypingExamination.prototype.updateCorrectUnicodeLetterCount = function() {
var notTrimmedInputContent = this.inputTextContent.canvasInput.value();
var notTrimmedTypingContent = this.typingExaminationContents[this.typingIndex];
var correctLetterCount = this.getCorrectLetterCount(notTrimmedInputContent, notTrimmedTypingContent); var correctLetterCount = this.getCorrectLetterCount(notTrimmedInputContent, notTrimmedTypingContent);
if(correctLetterCount === this.correctLetterCountInLine + 1) { if(correctLetterCount === this.correctLetterCountInLine + 1) {
this.correctLetterCountInLine++; this.correctLetterCountInLine++;
@@ -530,14 +555,6 @@ TypingExamination.prototype.onKeyUp = function(event) {
} else { } else {
// console.log("combinationing letter for " + " (" + notTrimmedInputContent[correctLetterCount] + "), correctLetterCount : " + correctLetterCount); // console.log("combinationing letter for " + " (" + notTrimmedInputContent[correctLetterCount] + "), correctLetterCount : " + correctLetterCount);
} }
this.updateTypingRecord();
if(event.keyCode == Phaser.Keyboard.ENTER)
this.onKeyEnter(trimmedInputContent, trimmedTypingContent, notTrimmedTypingContent);
if(event.keyCode == Phaser.Keyboard.SPACEBAR)
this.onKeyEnter(trimmedInputContent, trimmedTypingContent, notTrimmedTypingContent);
} }
TypingExamination.prototype.onKeyEnter = function(trimmedInputContent, trimmedTypingContent, notTrimmedTypingContent) { TypingExamination.prototype.onKeyEnter = function(trimmedInputContent, trimmedTypingContent, notTrimmedTypingContent) {
@@ -720,7 +737,7 @@ TypingExamination.prototype.setTimeTypingStart = function() {
} }
TypingExamination.GAME_TIME_SEC = TimeUtil.MINUTE_SEC * 5; // 5 minutes TypingExamination.GAME_TIME_SEC = 3; //TimeUtil.MINUTE_SEC * 5; // 5 minutes
TypingExamination.SPACE_INDICATOR = "␣"; // "ˇ"; // "ᵔ"; // "ᵕ"; // "ˣ"; // "ᵛ"; // " · "; TypingExamination.SPACE_INDICATOR = "␣"; // "ˇ"; // "ᵔ"; // "ᵕ"; // "ˣ"; // "ᵛ"; // " · ";
TypingExamination.ENTER_INDICATOR = "⏎"; // "↵"; // "↵"; TypingExamination.ENTER_INDICATOR = "⏎"; // "↵"; // "↵";