From 286aa2261d52c74e319360887b42af9c869a69b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A2=E1=84=91=E1=85=B3=E1=86=AF=20=E1=84=82?= =?UTF-8?q?=E1=85=A9=E1=84=90=E1=85=B3=E1=84=87=E1=85=AE=E1=86=A8?= Date: Fri, 17 May 2019 07:24:03 +0900 Subject: [PATCH] Fix: check previous alphabets --- src/game/typing/test/game.js | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/src/game/typing/test/game.js b/src/game/typing/test/game.js index 8aed54c..a9388d6 100644 --- a/src/game/typing/test/game.js +++ b/src/game/typing/test/game.js @@ -490,10 +490,10 @@ var TypingTest = { var typingLetter = ""; var typingNextLetter = ""; - // console.log("-----"); - // console.log("inputConent : '" + inputContent + "'"); - // console.log("inputIndex : " + inputIndex); - // console.log("misspelledIndex : " + misspelledIndex); + console.log("-----"); + console.log("inputConent : '" + inputContent + "'"); + console.log("inputIndex : " + inputIndex); + console.log("misspelledIndex : " + misspelledIndex); if(inputIndex < 0) inputLetter = ""; @@ -505,9 +505,9 @@ var TypingTest = { if(misspelledIndex <= typingContent.length) typingNextLetter = typingContent[misspelledIndex + 1]; - // console.log("inputLetter : '" + inputLetter + "'"); - // console.log("typingLetter : '" + typingLetter + "'"); - // console.log("typingNextLetter : '" + typingNextLetter + "'"); + console.log("inputLetter : '" + inputLetter + "'"); + console.log("typingLetter : '" + typingLetter + "'"); + console.log("typingNextLetter : '" + typingNextLetter + "'"); // var typingAlphabet = ""; var inputLetterAlphabets = StringUtil.toKoreanAlphabets(inputLetter); @@ -517,8 +517,12 @@ var TypingTest = { // console.log("typingLetterAlphabets : " + typingLetterAlphabets); // console.log("typingNextLetterAlphabets : " + typingNextLetterAlphabets); + if(misspelledIndex < inputIndex) { + highlightKey = "Backspace"; + } + // typing nothing yet - if(inputLetterAlphabets.length == 0) { + else if(inputLetterAlphabets.length == 0) { // highlightKey = typingLetterAlphabets[0]; highlightKey = StringUtil.chosung(typingLetter); } @@ -549,7 +553,12 @@ var TypingTest = { var typingLetterJungsung = StringUtil.jungsung(typingLetter); // console.log("* 222"); // inputLetter jungsung == typingLetter jungsung - if(StringUtil.jungsung(inputLetter) == StringUtil.jungsung(typingLetter)) { + + // 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); @@ -603,8 +612,15 @@ var TypingTest = { // 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"; + // 입력할 글자에 종성이 있을 경우 - if(StringUtil.hasJongsung(typingLetter)) { + else if(StringUtil.hasJongsung(typingLetter)) { var typingLetterJongsung = StringUtil.jongsung(typingLetter); // 입력한 글자의 종성과 입력할 글자의 종성이 같은 경우 if(StringUtil.jongsung(inputLetter) == typingLetterJongsung)