Fix: multiAlphabet (incompleted)
This commit is contained in:
@@ -378,9 +378,9 @@ var TypingTest = {
|
||||
|
||||
if(event.keyCode == Phaser.Keyboard.ENTER ||
|
||||
event.keyCode == Phaser.Keyboard.SPACEBAR) {
|
||||
console.log("### enter ###");
|
||||
console.log("inputContent : " + inputContent);
|
||||
console.log("typingContent : " + typingContent);
|
||||
// console.log("### enter ###");
|
||||
// console.log("inputContent : " + inputContent);
|
||||
// console.log("typingContent : " + typingContent);
|
||||
|
||||
if(inputContent === typingContent) {
|
||||
this.calculateTypingRecord(typingContent);
|
||||
@@ -440,7 +440,8 @@ var TypingTest = {
|
||||
// console.log("inputLength : " + inputLength + " / " + inputContent);
|
||||
// console.log("typingLength : " + typingLength + " / " + typingContent);
|
||||
var misspelledIndex = -1;
|
||||
for(var i = 0; i < inputLength; i++) {
|
||||
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;
|
||||
@@ -462,21 +463,94 @@ var TypingTest = {
|
||||
}
|
||||
// korean typing test
|
||||
else {
|
||||
// console.log(misspelledIndex + " / " + typingContent[misspelledIndex]);
|
||||
if(inputContent == typingContent)
|
||||
highlightKey = "Enter";
|
||||
else if(typingContent[misspelledIndex] == " ")
|
||||
highlightKey = " ";
|
||||
else {
|
||||
var inputIndex = inputContent.length - 1;
|
||||
var inputLetter = "";
|
||||
var typingLetter = "";
|
||||
var typingNextLetter = "";
|
||||
|
||||
if(misspelledIndex > -1)
|
||||
return "Backspace";
|
||||
console.log("-----");
|
||||
console.log("inputConent : '" + inputContent + "'");
|
||||
console.log("inputIndex : " + inputIndex);
|
||||
console.log("misspelledIndex : " + misspelledIndex);
|
||||
|
||||
var inputIndex = inputContent.length - 1;
|
||||
var inputLetter = inputContent[inputIndex];
|
||||
var typingLetter = typingContent[inputIndex];
|
||||
// console.log("inputLetter : " + inputLetter);
|
||||
// console.log("typingLetter : " + typingLetter);
|
||||
if(inputIndex < 0)
|
||||
inputLetter = "";
|
||||
else if(misspelledIndex > inputIndex)
|
||||
inputLetter = "";
|
||||
else
|
||||
inputLetter = inputContent[misspelledIndex];
|
||||
typingLetter = typingContent[misspelledIndex];
|
||||
if(inputContent.length < typingContent.length)
|
||||
typingNextLetter = typingContent[misspelledIndex + 1];
|
||||
|
||||
var typingAlphabet = "";
|
||||
// var inputLetterAlphabets = StringUtil.toKoreanAlphabets(inputContent[inputIndex]);
|
||||
// var typingLetterAlphabets = StringUtil.toKoreanAlphabets(typingContent[inputIndex]);
|
||||
// console.log("inputLetterAlphabets : " + inputLetterAlphabets);
|
||||
// console.log("typingLetterAlphabets : " + typingLetterAlphabets);
|
||||
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(inputLetterAlphabets.length == 0) {
|
||||
highlightKey = typingLetterAlphabets[0];
|
||||
}
|
||||
else if(inputLetterAlphabets.length == 1) {
|
||||
if(inputLetterAlphabets[0] != typingLetterAlphabets[0])
|
||||
highlightKey = "Backspace";
|
||||
else
|
||||
highlightKey = typingLetterAlphabets[1];
|
||||
}
|
||||
else if(inputLetterAlphabets.length == 2) {
|
||||
if(StringUtil.isMultiLetterJongsung(typingLetterAlphabets[1])) {
|
||||
var jungsungAlphabets = StringUtil.getMultiLettersFromJongsung(typingLetterAlphabets[1]);
|
||||
if(inputLetterAlphabets[1] == jungsungAlphabets[0])
|
||||
highlightKey = jungsungAlphabets[1];
|
||||
else
|
||||
highlightKey = "Backspace";
|
||||
}
|
||||
else {
|
||||
if(inputLetterAlphabets[1] != typingLetterAlphabets[1])
|
||||
highlightKey = "Backspace";
|
||||
else {
|
||||
if(typingLetterAlphabets.length == 3)
|
||||
highlightKey = typingLetterAlphabets[2];
|
||||
else
|
||||
highlightKey = typingNextLetterAlphabets[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(inputLetterAlphabets.length == 3) {
|
||||
if(StringUtil.hasJongsung(typingLetterAlphabet)) {
|
||||
if(inputLetterAlphabets[2] == typingLetterAlphabets[2])
|
||||
highlightKey = typingNextLetterAlphabet[0]; // next letter chosung
|
||||
else {
|
||||
// 알바 -> 앏
|
||||
if(StringUtil.isMultiLetterJongsung(inputLetterAlphabets[2])) {
|
||||
var jongsungAlphabets = StringUtil.getMultiLettersFromJongsung(inputLetterAlphabets[2]);
|
||||
if(typingLetterAlphabet[2] == jongsungAlphabets[0] && typingNextLetterAlphabet[0] == jongsungAlphabets[1])
|
||||
highlightKey = typingNextLetterAlphabet[1]; // next letter jungsung
|
||||
else
|
||||
highlightKey = "Backspace";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
highlightKey = "`";
|
||||
}
|
||||
|
||||
// highlightKey = "ㄱ";
|
||||
}
|
||||
}
|
||||
|
||||
if(highlightKey == " ")
|
||||
|
||||
Reference in New Issue
Block a user