Fix: code revise
This commit is contained in:
@@ -161,10 +161,8 @@ TypingExamination.prototype.makeTextContents = function() {
|
||||
|
||||
|
||||
// typed done contents
|
||||
var textDoneColor = [ '#99994d', '#88884d', '#77774d', '#66664d' ];
|
||||
// var textDoneColor = [ '#99994d', '#99994d', '#99994d', '#99994d' ];
|
||||
this.textTypingContentsDone = [];
|
||||
this.textTypingRecordsDone = [];
|
||||
this.textDoneLineNumber = [];
|
||||
for(var i = 0; i < TypingExamination.TYPING_CONTENT_DONE_COUNT; i++) {
|
||||
this.textTypingContentsDone[i] = this.makeUnderlineText(
|
||||
TYPING_CONTENT_X,
|
||||
@@ -173,17 +171,15 @@ TypingExamination.prototype.makeTextContents = function() {
|
||||
this.textTypingContentsDone[i].style.fill = TypingExamination.COLOR_DONE_INPUT_STRING;
|
||||
this.textTypingContentsDone[i].style.backgroundColor = TypingExamination.COLOR_CORRECT_INPUT_BACKGROUND_STRING;
|
||||
|
||||
this.textTypingRecordsDone[i] = this.makeLineText(
|
||||
this.textDoneLineNumber[i] = this.makeLineText(
|
||||
LINE_POS_X,
|
||||
TYPING_CONTENT_Y - DONE_OFFSET_Y - i * TEXT_HEIGHT,
|
||||
);
|
||||
}
|
||||
|
||||
// preview contents
|
||||
var textPreviewColor = [ '#999999', '#888888', '#777777', '#666666' ];
|
||||
// var textPreviewColor = [ '#999999', '#999999', '#999999', '#999999' ];
|
||||
this.textTypingContentPreview = [];
|
||||
this.textLineNumber = [];
|
||||
this.textPreviewLineNumber = [];
|
||||
for(var i = 0; i < TypingExamination.TYPING_CONTENT_PREVIEW_COUNT; i++) {
|
||||
this.textTypingContentPreview[i] = this.makeUnderlineText(
|
||||
TYPING_CONTENT_X,
|
||||
@@ -191,7 +187,7 @@ TypingExamination.prototype.makeTextContents = function() {
|
||||
);
|
||||
this.textTypingContentPreview[i].style.fill = TypingExamination.COLOR_NOT_INPUT_STRING;
|
||||
|
||||
this.textLineNumber[i] = this.makeLineText(
|
||||
this.textPreviewLineNumber[i] = this.makeLineText(
|
||||
LINE_POS_X,
|
||||
TYPING_CONTENT_Y + PREVIEW_OFFSET_Y + i * TEXT_HEIGHT,
|
||||
);
|
||||
@@ -374,8 +370,19 @@ TypingExamination.prototype.completeLoadingWriting = function() {
|
||||
var writing = game.cache.getText("writing");
|
||||
var examinationContent = writing.split("\n");
|
||||
|
||||
for(var i = 0; i < examinationContent.length; i++) {
|
||||
var count = examinationContent.length;
|
||||
for(var i = 0; i < count; i++) {
|
||||
// add enter character
|
||||
examinationContent[i] = examinationContent[i].replace(/\r/g, "");
|
||||
/*
|
||||
console.log(examinationContent[i]);
|
||||
if(examinationContent[i] == "\r")
|
||||
examinationContent[i] = examinationContent[i].replace(/\r/g, "");
|
||||
else
|
||||
examinationContent[i] = examinationContent[i].replace(/\r/g, TypingExamination.ENTER_INDICATOR);
|
||||
*/
|
||||
|
||||
// add space indicator character
|
||||
// examinationContent[i] = examinationContent[i].replace(/ /g, TypingExamination.SPACE_INDICATOR);
|
||||
}
|
||||
|
||||
@@ -413,13 +420,13 @@ TypingExamination.prototype.showTypingExaminationContents = function() {
|
||||
var doneIndex = this.typingIndex - i - 1;
|
||||
if(doneIndex < 0) {
|
||||
this.textTypingContentsDone[i].text = "";
|
||||
this.textTypingRecordsDone[i].text = "";
|
||||
this.textDoneLineNumber[i].text = "";
|
||||
} else {
|
||||
this.textTypingContentsDone[i].text = this.typingExaminationContents[doneIndex];
|
||||
// this.textTypingRecordsDone[i].text = NumberUtil.getRecordText(Math.floor(this.typingRecordForLines[doneIndex]));
|
||||
// this.textDoneLineNumber[i].text = NumberUtil.getRecordText(Math.floor(this.typingRecordForLines[doneIndex]));
|
||||
|
||||
var lineNumber = this.typingContentLength - doneIndex;
|
||||
this.textTypingRecordsDone[i].text = NumberUtil.numberWithCommas(lineNumber) + " ";
|
||||
this.textDoneLineNumber[i].text = NumberUtil.numberWithCommas(lineNumber) + " ";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,10 +446,10 @@ TypingExamination.prototype.showTypingExaminationContents = function() {
|
||||
this.textTypingContentPreview[i].text = previewText;
|
||||
|
||||
var lineNumber = this.typingContentLength - this.typingIndex - 1 - i;
|
||||
this.textLineNumber[i].text = NumberUtil.numberWithCommas(lineNumber) + " ";
|
||||
this.textPreviewLineNumber[i].text = NumberUtil.numberWithCommas(lineNumber) + " ";
|
||||
} else {
|
||||
this.textTypingContentPreview[i].text = "";
|
||||
this.textLineNumber[i].text = "";
|
||||
this.textPreviewLineNumber[i].text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -506,8 +513,8 @@ TypingExamination.prototype.showTypingContentHighlight = function(inputContent,
|
||||
for(var i = 0; i < typingContentLength; i++) {
|
||||
var typingChar = typingContent.charAt(i);
|
||||
var inputChar = inputContent.charAt(i);
|
||||
console.log("typingChar : " + typingChar);
|
||||
console.log("inputChar : " + inputChar);
|
||||
// console.log("typingChar : " + typingChar);
|
||||
// console.log("inputChar : " + inputChar);
|
||||
|
||||
// when typingChar is the last letter
|
||||
if(isNaN(inputChar)) {
|
||||
@@ -516,8 +523,8 @@ TypingExamination.prototype.showTypingContentHighlight = function(inputContent,
|
||||
}
|
||||
|
||||
if(typingChar != inputChar) {
|
||||
console.log("inputContent.charAt(" + i + ") : " + inputContent.charCodeAt(i).toString(16) + ", " + inputChar);
|
||||
console.log("typingContent.charAt(" + i + ") : " + typingContent.charCodeAt(i).toString(16) + ", " + typingChar);
|
||||
// console.log("inputContent.charAt(" + i + ") : " + inputContent.charCodeAt(i).toString(16) + ", " + inputChar);
|
||||
// console.log("typingContent.charAt(" + i + ") : " + typingContent.charCodeAt(i).toString(16) + ", " + typingChar);
|
||||
|
||||
this.textNextLetterIndicator.text = typingContent.substring(0, i + 1);
|
||||
this.setCorrectText(typingContent.substring(0, i));
|
||||
|
||||
Reference in New Issue
Block a user