Fix: show english alphabet pronounce in typing practice
This commit is contained in:
@@ -48,6 +48,14 @@ var TypingPractice = {
|
||||
.addColor(TypingPractice.COLOR_CONTENT_INPUT, 0);
|
||||
this.textTypingContent.anchor.set(0.5);
|
||||
|
||||
this.pronounceText = this.makeDefaultText(game.world.centerX, TYPING_CONTENT_Y + 80);
|
||||
this.pronounceText.style.fill = MainColor.LIGHT_CHOCO_STRING;
|
||||
this.pronounceText.addColor(MainColor.CHOCO_STRING, 2);
|
||||
this.pronounceText.setShadow(1, 1, 'rgba(0, 0, 0, 1)', 1);
|
||||
// this.pronounceText.stroke = MainColor.BLACK_STRING;
|
||||
// this.pronounceText.strokeThickness = 1;
|
||||
|
||||
|
||||
this.textTypingBracket = game.add.text(game.world.centerX, TYPING_CONTENT_Y, "[ ]", textStyleBasic)
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
|
||||
.addColor(TypingPractice.COLOR_BRACKET, 0);
|
||||
@@ -192,6 +200,18 @@ var TypingPractice = {
|
||||
},
|
||||
|
||||
|
||||
makeDefaultText: function(x, y) {
|
||||
var defaultText = game.add.text(x, y, "");
|
||||
defaultText.anchor.set(0.5, 0.5);
|
||||
// defaultText.font = "Nanum Gothic Coding";
|
||||
defaultText.font = "Times New Roman";
|
||||
defaultText.fontSize = 26;
|
||||
defaultText.fontWeight = "normal";
|
||||
defaultText.style.fill = "white";
|
||||
|
||||
return defaultText;
|
||||
},
|
||||
|
||||
loadPracticeContent: function() {
|
||||
var appName = "";
|
||||
if(isTypingTestApp())
|
||||
@@ -283,6 +303,35 @@ var TypingPractice = {
|
||||
return testContent;
|
||||
},
|
||||
|
||||
isEnglishAlphabet: function(letter) {
|
||||
var patternEnglishAlphabet = /[a-zA-Z]/;
|
||||
if(patternEnglishAlphabet.test(letter))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
},
|
||||
|
||||
getPronounce: function(letter) {
|
||||
var pronounceArray = [
|
||||
"에이", "비", "씨", "디", "이", "에프", "지", "에이치", "아이",
|
||||
"제이", "케이", "엘", "엠", "엔", "오", "피", "큐", "알",
|
||||
"에스", "티", "유", "브이", "더블유", "엑스", "와이", "지(제트)"
|
||||
];
|
||||
|
||||
var lowercaseLetter = letter.toLowerCase();
|
||||
var letterIndex = lowercaseLetter.charCodeAt(0) - "a".charCodeAt(0);
|
||||
return pronounceArray[letterIndex];
|
||||
},
|
||||
|
||||
showPronounceText: function(letter) {
|
||||
if(!this.isEnglishAlphabet(letter)) {
|
||||
this.pronounceText.text = "";
|
||||
return;
|
||||
}
|
||||
|
||||
this.pronounceText.text = letter.toUpperCase() + " " + this.getPronounce(letter);
|
||||
},
|
||||
|
||||
showTypingPracticeContents: function() {
|
||||
for(var i = 0; i < TypingPractice.TYPING_CONTENT_DONE_COUNT; i++) {
|
||||
var doneIndex = this.typingIndex - i - 1;
|
||||
@@ -299,6 +348,7 @@ var TypingPractice = {
|
||||
}
|
||||
|
||||
this.textTypingContent.text = this.typingRandomContents[this.typingIndex];
|
||||
this.showPronounceText(this.textTypingContent.text);
|
||||
|
||||
for(var i = 0; i < TypingPractice.TYPING_CONTENT_PREVIEW_COUNT; i++) {
|
||||
var previewIndex = this.typingIndex + i + 1;
|
||||
|
||||
Reference in New Issue
Block a user