Fix: remove useless codes

This commit is contained in:
2019-06-25 12:50:38 +09:00
parent 5638266178
commit 037ee407d2
4 changed files with 16 additions and 314 deletions
+8 -311
View File
@@ -52,29 +52,12 @@ var TypingExamination = {
this.averageTypingSpeedText = new AverageTypingSpeed();
// this.contentProgressText = new ContentProgress();
this.stageTimer = new StageTimer(
TypingExamination.GAME_TIME_SEC,
(function() {
this.setClickEnable(false);
this.timeOver();
}).bind(this)
);
this.stageTimer.setDisplayType(StageTimer.DISPLAY_TYPE_NON_SEC);
// typing content
var typingContentBG = new TypingContentBG();
typingContentBG.makeExaminationContentBG();
this.animalList = new AnimalList(670);
var TYPING_CONTENT_X = 60;
var TYPING_CONTENT_X = 50;
var TYPING_CONTENT_Y = 340;
var RECORD_POSITION_X = 960;
var RECORD_POSITION_X = 970;
var FONT_SIZE = 32;
var TYPING_TEXT_OFFSET_HEIGHT = 40;
@@ -177,6 +160,8 @@ var TypingExamination = {
this.animalList = new AnimalList(670);
// bottom ui
var screenBottomUI = new ScreenBottomUI();
screenBottomUI.printLeftTextWithAppHighestRecord(sessionStorageManager.getAppHighestRecord());
@@ -230,9 +215,6 @@ var TypingExamination = {
this.showTypingExaminationContents();
this.showPlayingWordNumber();
// this.updateKeyboard();
this.stageTimer.start();
},
timeOver: function() {
@@ -406,12 +388,11 @@ var TypingExamination = {
}
this.showTypingContentHighlight(inputContent, typingContent);
// this.updateKeyboard();
},
showTypingContentHighlight: function(inputContent, typingContent) {
console.log(inputContent + "=");
console.log(typingContent + "=");
// console.log(inputContent + "=");
// console.log(typingContent + "=");
this.textTypingContent.clearColors();
this.textTypingContent.addColor(TypingExamination.COLOR_CONTENT_RIGHT, 0);
@@ -426,297 +407,14 @@ var TypingExamination = {
// console.log("inputContent.charAt(i) : " + inputContent.charAt(i));
if(typingContent.charAt(i) != inputContent.charAt(i)) {
console.log("inputContent.charAt(" + i + ") : " + inputContent.charCodeAt(i).toString(16) + ", " + inputContent.charAt(i));
console.log("typingContent.charAt(" + i + ") : " + typingContent.charCodeAt(i).toString(16) + ", " + typingContent.charAt(i));
// console.log("inputContent.charAt(" + i + ") : " + inputContent.charCodeAt(i).toString(16) + ", " + inputContent.charAt(i));
// console.log("typingContent.charAt(" + i + ") : " + typingContent.charCodeAt(i).toString(16) + ", " + typingContent.charAt(i));
this.textTypingContent.addColor(TypingExamination.COLOR_CONTENT_INPUT, i);
return;
}
}
},
/*
updateKeyboard: function() {
var inputContent = this.inputTextContent.canvasInput.value();
var typingContent = this.typingExaminationContents[this.typingIndex];
this.hideHighlightKey(this.highlightKey);
this.highlightKey = this.getHighlioghtKey(inputContent, typingContent);
// console.log(this.highlightKey);
this.showHighlightKey(this.highlightKey);
this.moveHands(this.highlightKey);
},
*/
getHighlioghtKey: function(inputContent, typingContent) {
if(typingContent == undefined)
return undefined;
var highlightKey = "";
var inputIndex = inputContent.length - 1;
var inputLength = inputContent.length;
var typingLength = typingContent.length;
// console.log("inputLength : " + inputLength + " / " + inputContent);
// console.log("typingLength : " + typingLength + " / " + typingContent);
var misspelledIndex = -1;
for(var i = 0; i < typingLength; i++) {
// console.log("inputContent[i] : " + inputContent[i] + ", typingContent[i] : " + typingContent[i]);
if(inputContent[i] != typingContent[i]) {
misspelledIndex = i;
break;
}
}
// over typing
if(inputLength > typingLength) {
highlightKey = "Backspace";
}
// complete typing
else if(inputContent == typingContent) {
highlightKey = "Enter";
}
// english typing test
else if(isEnglishTypingApp()) {
// console.log("===== english");
// console.log("misspelledIndex : " + misspelledIndex);
// console.log("inputIndex : " + inputIndex);
if(misspelledIndex > inputIndex)
highlightKey = typingContent[misspelledIndex];
else
highlightKey = "Backspace";
}
// korean typing test
else {
// console.log(misspelledIndex + " / " + typingContent[misspelledIndex]);
if(typingContent[misspelledIndex] == " ")
highlightKey = " ";
else {
var inputLetter = "";
var typingLetter = "";
var typingNextLetter = "";
// console.log("-----");
// console.log("inputConent : '" + inputContent + "'");
// console.log("inputIndex : " + inputIndex);
// console.log("typingLength : " + typingLength);
// console.log("misspelledIndex : " + misspelledIndex);
if(inputIndex < 0)
inputLetter = "";
else if(misspelledIndex > inputIndex)
inputLetter = "";
else
inputLetter = inputContent[misspelledIndex];
typingLetter = typingContent[misspelledIndex];
if(misspelledIndex <= typingContent.length)
typingNextLetter = typingContent[misspelledIndex + 1];
// console.log("inputLetter : '" + inputLetter + "'");
// console.log("typingLetter : '" + typingLetter + "'");
// console.log("typingNextLetter : '" + typingNextLetter + "'");
// var typingAlphabet = "";
var inputLetterAlphabets = StringUtil.toKoreanAlphabets(inputLetter);
// var typingLetterAlphabets = StringUtil.toKoreanAlphabets(typingLetter);
// var typingNextLetterAlphabets = StringUtil.toKoreanAlphabets(typingNextLetter);
// console.log("inputLetterAlphabets : " + inputLetterAlphabets);
// console.log("typingLetterAlphabets : " + typingLetterAlphabets);
// console.log("typingNextLetterAlphabets : " + typingNextLetterAlphabets);
if(misspelledIndex < inputIndex) {
highlightKey = "Backspace";
}
// typing nothing yet
else if(inputLetterAlphabets.length == 0) {
// highlightKey = typingLetterAlphabets[0];
highlightKey = StringUtil.chosung(typingLetter);
}
// after typing chosung
else if(inputLetterAlphabets.length == 1) {
if(StringUtil.chosung(inputLetter) != StringUtil.chosung(typingLetter))
highlightKey = "Backspace";
else {
if(StringUtil.isMultiAlphabetJungsung(StringUtil.jungsung(typingLetter))) {
// console.log("* multi jungsung");
var jungsungLetter = StringUtil.jungsung(typingLetter);
// console.log("jungsungLetter : " + jungsungLetter);
jungsungAlphabets = StringUtil.getMultiAlphabetFromJungsung(jungsungLetter);
// console.log("jungsungAlphabets : " + jungsungAlphabets);
highlightKey = jungsungAlphabets[0];
// console.log(highlightKey);
} else {
// console.log("* single jungsung");
highlightKey = StringUtil.jungsung(typingLetter);
// console.log(highlightKey);
}
}
}
// after typing jungsung
else if(inputLetterAlphabets.length == 2) {
var typingLetterJungsung = StringUtil.jungsung(typingLetter);
// console.log("* 222");
// inputLetter jungsung == typingLetter jungsung
// inputLetter chosung != typingLetter chosung
if(StringUtil.chosung(inputLetter) != StringUtil.chosung(typingLetter))
highlightKey = "Backspace";
else if(StringUtil.jungsung(inputLetter) == StringUtil.jungsung(typingLetter)) {
if(StringUtil.hasJongsung(typingLetter)) {
// highlightKey = StringUtil.jongsung(typingLetter);
var typingLetterJongsung = StringUtil.jongsung(typingLetter);
// typingLetter jongsung is multi alphabet
if(StringUtil.isMultiAlphabetJongsung(typingLetterJongsung)) {
var typingJongsungAlphabets = StringUtil.getMultiAlphabetFromJongsung(StringUtil.jongsung(typingLetter));
highlightKey = typingJongsungAlphabets[0];
}
// typingLetter jongsung is single alphabet
else {
highlightKey = typingLetterJongsung;
}
} else
highlightKey = StringUtil.chosung(typingNextLetter);
}
// inputLetter jungsung != typingLetter jungsung
else {
if(StringUtil.isMultiAlphabetJungsung(typingLetterJungsung)) {
// console.log("* multi jungsung");
var jungsungAlphabets = StringUtil.getMultiAlphabetFromJungsung(typingLetterJungsung);
// console.log(" * jungsungAlphabets : " + jungsungAlphabets);
if(StringUtil.jungsung(inputLetter) == jungsungAlphabets[0])
highlightKey = jungsungAlphabets[1];
else
highlightKey = "Backspace";
}
// single letter jungsung
else {
// console.log("* single jungsung");
if(StringUtil.jungsung(inputLetter) != typingLetterJungsung)
highlightKey = "Backspace";
else {
if(StringUtil.hasJongsung(typingLetter)) {
// highlightKey = StringUtil.jongsung(typingLetter);
var typingLetterJongsung = StringUtil.jongsung(typingLetter);
if(StringUtil.isMultiAlphabetJongsung(typingLetterJongsung)) {
var jongsungAlphabets = StringUtil.getMultiAlphabetFromJongsung(StringUtil.jongsung(inputLetter));
if(StringUtil.jongsung(typingLetter) == jongsungAlphabets[0] && StringUtil.chosung(typingNextLetter) == jongsungAlphabets[1])
highlightKey = StringUtil.jungsung(typingNextLetter);
else if(StringUtil.jongsung(inputLetter) == jongsungAlphabets[0])
highlightKey = jongsungAlphabets[1];
else
highlightKey = "Backspace";
}
} else
highlightKey = StringUtil.chosung(typingNextLetter);
}
}
}
}
// after typing jongsung
else if(inputLetterAlphabets.length == 3) {
// inputLetter chosung != typingLetter chosung
if(StringUtil.chosung(inputLetter) != StringUtil.chosung(typingLetter))
highlightKey = "Backspace";
// inputLetter jungsung != typingLetter jungsung
else if(StringUtil.jungsung(inputLetter) != StringUtil.jungsung(typingLetter))
highlightKey = "Backspace";
// 입력할 글자에 종성이 있을 경우
else if(StringUtil.hasJongsung(typingLetter)) {
// console.log("has jongsung");
var typingLetterJongsung = StringUtil.jongsung(typingLetter);
// 입력한 글자의 종성과 입력할 글자의 종성이 같은 경우
if(StringUtil.jongsung(inputLetter) == typingLetterJongsung) {
if(inputIndex == typingLength - 1)
highlightKey = "Enter";
else
highlightKey = StringUtil.chosung(typingNextLetter);
}
// 입력한 글자의 종성이 입력할 글자와 다를 경우
else {
if(inputIndex == typingLength - 1)
highlightKey = "Backspace";
// 입력할 글자의 종성이 합성자음일 경우
else if(StringUtil.isMultiAlphabetJongsung(typingLetterJongsung)) {
var inputJongsungAlphabets = StringUtil.getMultiAlphabetFromJongsung(StringUtil.jongsung(inputLetter));
var typingJongsungAlphabets = StringUtil.getMultiAlphabetFromJongsung(StringUtil.jongsung(typingLetter));
// 입력할 글자의 종성과 입력한 글자의 종성이 같은 경우
if(typingLetterJongsung == StringUtil.jongsung(inputLetter))
highlightKey = StringUtil.chosung(typingNextLetter);
else if(StringUtil.jongsung(inputLetter) == typingJongsungAlphabets[0])
highlightKey = typingJongsungAlphabets[1];
else
highlightKey = "Backspace";
}
// 입력할 글자의 종성이 단자음일 경우 : 알바 -> 앏
else {
var inputLetterJongsung = StringUtil.jongsung(inputLetter);
// console.log("*** single jongsung");
// console.log("inputLetter : " + inputLetter);
// console.log("StringUtil.jongsung(inputLetter) : " + StringUtil.jongsung(inputLetter));
// console.log("inputLetterJongsung : " + inputLetterJongsung);
if(StringUtil.isMultiAlphabetJongsung(inputLetterJongsung)) {
var inputJongsungAlphabets = StringUtil.getMultiAlphabetFromJongsung(StringUtil.jongsung(inputLetter));
// console.log("inputJongsungAlphabets : " + inputJongsungAlphabets);
if(StringUtil.jongsung(typingLetter) == inputJongsungAlphabets[0] && StringUtil.chosung(typingNextLetter) == inputJongsungAlphabets[1])
highlightKey = StringUtil.jungsung(typingNextLetter);
else
highlightKey = "Backspace";
}
else {
highlightKey = StringUtil.chosung(typingNextLetter);
}
}
}
}
// 입력할 글자에 종성이 없을 경우
else {
// console.log("inputLetter jongsung : " + StringUtil.jongsung(inputLetter))
// console.log("typingNextLetter chosung : " + StringUtil.chosung(typingNextLetter))
if(StringUtil.hasJongsung(inputLetter)) {
// console.log("### has jongsung");
if(inputIndex == typingLength - 1)
highlightKey = "Backspace";
else {
if(StringUtil.jongsung(inputLetter) == StringUtil.chosung(typingNextLetter)) {
// highlightKey = StringUtil.jungsung(typingNextLetter);
if(StringUtil.isMultiAlphabetJungsung(StringUtil.jungsung(typingNextLetter))) {
// console.log("* multi jungsung");
jungsungAlphabets = StringUtil.getMultiAlphabetFromJungsung(StringUtil.jungsung(typingNextLetter));
highlightKey = jungsungAlphabets[0];
// console.log(highlightKey);
} else {
// console.log("* single jungsung");
highlightKey = StringUtil.jungsung(typingNextLetter);
// console.log(highlightKey);
}
}
else {
highlightKey = "Backspace";
}
}
}
else
highlightKey = "Backspace";
}
}
}
}
if(highlightKey == " ")
highlightKey = "Space";
return highlightKey;
},
calculateTypingRecord: function(typingContent) {
// console.log('입력 단어 : ' + this.typingExaminationContents[this.typingIndex]);
@@ -767,7 +465,6 @@ var TypingExamination = {
this.showTypingExaminationContents();
this.showPlayingWordNumber();
this.resetTypingContent();
// this.updateKeyboard();
},
showPlayingWordNumber: function() {