Fix: inputLetter jongsung single bug
This commit is contained in:
@@ -134,6 +134,9 @@ StringUtil.isMultiAlphabetJungsung = function(alphabet) {
|
||||
};
|
||||
|
||||
StringUtil.getMultiAlphabetFromJungsung = function(alphabet) {
|
||||
if(!StringUtil.isMultiAlphabetJungsung(alphabet))
|
||||
return alphabet;
|
||||
|
||||
var multiJungsungList = new Object();
|
||||
multiJungsungList['ㅘ'] = ['ㅗ', 'ㅏ'];
|
||||
multiJungsungList['ㅙ'] = ['ㅗ', 'ㅐ'];
|
||||
@@ -157,6 +160,9 @@ StringUtil.isMultiAlphabetJongsung = function(alphabet) {
|
||||
};
|
||||
|
||||
StringUtil.getMultiAlphabetFromJongsung = function(alphabet) {
|
||||
if(!StringUtil.isMultiAlphabetJongsung(alphabet))
|
||||
return alphabet;
|
||||
|
||||
var multiJongsungList = new Object();
|
||||
multiJongsungList['ㄲ'] = ['ㄱ', 'ㄱ'];
|
||||
multiJongsungList['ㄳ'] = ['ㄱ', 'ㅅ'];
|
||||
|
||||
@@ -234,7 +234,7 @@ var TypingTest = {
|
||||
var typingTextMan = new TypingTextManager();
|
||||
|
||||
var typingPracticeContents = this.getTypingTestContents();
|
||||
var typingPracticeContents = [ "십년이면 강산도 변한다." , "십년이면 강산도 변한다.", "십년이면 강산도 변한다." ]; // for debug
|
||||
// var typingPracticeContents = [ "십년이면 강산도 변한다." , "십년이면 강산도 변한다.", "십년이면 강산도 변한다." ]; // for debug
|
||||
// var typingPracticeContents = [ "꿰뚫다" , "워머신", "홧김에" ]; // for debug
|
||||
// console.log(typingPracticeContents);
|
||||
typingTextMan.makeTestContents(typingPracticeContents);
|
||||
@@ -386,16 +386,16 @@ var TypingTest = {
|
||||
|
||||
if(event.keyCode == Phaser.Keyboard.ENTER ||
|
||||
event.keyCode == Phaser.Keyboard.SPACEBAR) {
|
||||
console.log("### enter ###");
|
||||
console.log("this.typingIndex : " + this.typingIndex);
|
||||
console.log("inputContent : " + inputContent);
|
||||
console.log("typingContent : " + typingContent);
|
||||
// console.log("### enter ###");
|
||||
// console.log("this.typingIndex : " + this.typingIndex);
|
||||
// console.log("inputContent : " + inputContent);
|
||||
// console.log("typingContent : " + typingContent);
|
||||
|
||||
if(inputContent === typingContent) {
|
||||
this.calculateTypingRecord(typingContent);
|
||||
|
||||
console.log("this.typingIndex : " + this.typingIndex);
|
||||
console.log("this.typingContentLength : " + this.typingContentLength);
|
||||
// console.log("this.typingIndex : " + this.typingIndex);
|
||||
// console.log("this.typingContentLength : " + this.typingContentLength);
|
||||
if(this.typingIndex == this.typingContentLength - 1) {
|
||||
this.isGameOver = true;
|
||||
this.gameOver();
|
||||
@@ -495,10 +495,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 = "";
|
||||
@@ -510,9 +510,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);
|
||||
@@ -626,6 +626,7 @@ var TypingTest = {
|
||||
|
||||
// 입력할 글자에 종성이 있을 경우
|
||||
else if(StringUtil.hasJongsung(typingLetter)) {
|
||||
console.log("has jongsung");
|
||||
var typingLetterJongsung = StringUtil.jongsung(typingLetter);
|
||||
|
||||
// 입력한 글자의 종성과 입력할 글자의 종성이 같은 경우
|
||||
@@ -633,10 +634,11 @@ var TypingTest = {
|
||||
highlightKey = StringUtil.chosung(typingNextLetter);
|
||||
// 입력한 글자의 종성이 입력할 글자와 다를 경우
|
||||
else {
|
||||
var inputJongsungAlphabets = StringUtil.getMultiAlphabetFromJongsung(StringUtil.jongsung(inputLetter));
|
||||
var typingJongsungAlphabets = StringUtil.getMultiAlphabetFromJongsung(StringUtil.jongsung(typingLetter));
|
||||
// 입력할 글자의 종성이 합성자음일 경우
|
||||
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);
|
||||
@@ -647,12 +649,23 @@ var TypingTest = {
|
||||
}
|
||||
// 입력할 글자의 종성이 단자음일 경우 : 알바 -> 앏
|
||||
else {
|
||||
if(StringUtil.jongsung(typingLetter) == inputJongsungAlphabets[0] && StringUtil.chosung(typingNextLetter) == inputJongsungAlphabets[1])
|
||||
highlightKey = StringUtil.jungsung(typingNextLetter);
|
||||
// else if(StringUtil.jongsung(inputLetter) == inputJongsungAlphabets[0])
|
||||
// highlightKey = inputJongsungAlphabets[1];
|
||||
else
|
||||
highlightKey = "Backspace";
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user