Add: practice alphabet
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
var englishBasicWordList = [
|
||||
"a",
|
||||
"s",
|
||||
"d",
|
||||
"f",
|
||||
"j",
|
||||
"k",
|
||||
"l",
|
||||
";",
|
||||
"'"
|
||||
];
|
||||
@@ -0,0 +1,6 @@
|
||||
var englishLeftLowerWordList = [
|
||||
"z",
|
||||
"x",
|
||||
"c",
|
||||
"v"
|
||||
];
|
||||
@@ -0,0 +1,6 @@
|
||||
var englishLeftUpperWordList = [
|
||||
"q",
|
||||
"w",
|
||||
"e",
|
||||
"r"
|
||||
];
|
||||
@@ -0,0 +1,7 @@
|
||||
var englishRightLowerWordList = [
|
||||
"m",
|
||||
"m",
|
||||
",",
|
||||
".",
|
||||
"/"
|
||||
];
|
||||
@@ -0,0 +1,9 @@
|
||||
var englishRightUpperWordList = [
|
||||
"u",
|
||||
"i",
|
||||
"o",
|
||||
"p",
|
||||
"[",
|
||||
"]",
|
||||
"\\"
|
||||
];
|
||||
@@ -0,0 +1,8 @@
|
||||
var englishSecondFingerWordList = [
|
||||
"g",
|
||||
"h",
|
||||
"t",
|
||||
"y",
|
||||
"b",
|
||||
"n"
|
||||
];
|
||||
@@ -0,0 +1,12 @@
|
||||
var englishSentenceList = [
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
];
|
||||
@@ -0,0 +1,12 @@
|
||||
var englishWordList = [
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
];
|
||||
@@ -0,0 +1,11 @@
|
||||
var koreanBasicWordList = [
|
||||
"ㅁ",
|
||||
"ㄴ",
|
||||
"ㅇ",
|
||||
"ㄹ",
|
||||
"ㅓ",
|
||||
"ㅏ",
|
||||
"ㅣ",
|
||||
";",
|
||||
"'"
|
||||
];
|
||||
@@ -0,0 +1,6 @@
|
||||
var koreanLeftLowerWordList = [
|
||||
"ㅋ",
|
||||
"ㅌ",
|
||||
"ㅊ",
|
||||
"ㅍ"
|
||||
];
|
||||
@@ -0,0 +1,6 @@
|
||||
var koreanLeftUpperWordList = [
|
||||
"ㅂ",
|
||||
"ㅈ",
|
||||
"ㄷ",
|
||||
"ㄱ"
|
||||
];
|
||||
@@ -0,0 +1,7 @@
|
||||
var koreanLeftUpperDoubleWordList = [
|
||||
"ㅃ",
|
||||
"ㅉ",
|
||||
"ㄸ",
|
||||
"ㄲ",
|
||||
"ㅆ"
|
||||
];
|
||||
@@ -0,0 +1,6 @@
|
||||
var koreanRightLowerWordList = [
|
||||
"ㅡ",
|
||||
",",
|
||||
".",
|
||||
"/"
|
||||
];
|
||||
@@ -0,0 +1,9 @@
|
||||
var koreanRightUpperWordList = [
|
||||
"ㅕ",
|
||||
"ㅑ",
|
||||
"ㅐ",
|
||||
"ㅔ",
|
||||
"[",
|
||||
"]",
|
||||
"\\"
|
||||
];
|
||||
@@ -0,0 +1,9 @@
|
||||
var koreanRightUpperDoubleWordList = [
|
||||
"ㅕ",
|
||||
"ㅑ",
|
||||
"ㅒ",
|
||||
"ㅖ",
|
||||
"[",
|
||||
"]",
|
||||
"\\"
|
||||
];
|
||||
@@ -0,0 +1,8 @@
|
||||
var koreanSecondFingerWordList = [
|
||||
"ㅎ",
|
||||
"ㅗ",
|
||||
"ㅅ",
|
||||
"ㅛ",
|
||||
"ㅠ",
|
||||
"ㅜ"
|
||||
];
|
||||
@@ -0,0 +1,12 @@
|
||||
var koreanSentenceList = [
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
];
|
||||
@@ -0,0 +1,12 @@
|
||||
var koreanWordList = [
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
];
|
||||
@@ -1,36 +0,0 @@
|
||||
class EnglishKeyMapper extends KeyMapper {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.registerKeyTextData("KeyQ", "q", "Q");
|
||||
this.registerKeyTextData("KeyW", "w", "W");
|
||||
this.registerKeyTextData("KeyE", "e", "E");
|
||||
this.registerKeyTextData("KeyR", "r", "R");
|
||||
this.registerKeyTextData("KeyT", "t", "T");
|
||||
this.registerKeyTextData("KeyY", "y", "Y");
|
||||
this.registerKeyTextData("KeyU", "u", "U");
|
||||
this.registerKeyTextData("KeyI", "i", "I");
|
||||
this.registerKeyTextData("KeyO", "o", "O");
|
||||
this.registerKeyTextData("KeyP", "p", "P");
|
||||
|
||||
this.registerKeyTextData("KeyA", "a", "A");
|
||||
this.registerKeyTextData("KeyS", "s", "S");
|
||||
this.registerKeyTextData("KeyD", "d", "D");
|
||||
this.registerKeyTextData("KeyF", "f", "F");
|
||||
this.registerKeyTextData("KeyG", "g", "G");
|
||||
this.registerKeyTextData("KeyH", "h", "H");
|
||||
this.registerKeyTextData("KeyJ", "j", "J");
|
||||
this.registerKeyTextData("KeyK", "k", "K");
|
||||
this.registerKeyTextData("KeyL", "l", "L");
|
||||
|
||||
this.registerKeyTextData("KeyZ", "z", "Z");
|
||||
this.registerKeyTextData("KeyX", "x", "X");
|
||||
this.registerKeyTextData("KeyC", "c", "C");
|
||||
this.registerKeyTextData("KeyV", "v", "V");
|
||||
this.registerKeyTextData("KeyB", "b", "B");
|
||||
this.registerKeyTextData("KeyN", "n", "N");
|
||||
this.registerKeyTextData("KeyM", "m", "M");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -51,13 +51,13 @@ class TypingPractice {
|
||||
.addColor(textPreviewColor[0], 0);
|
||||
|
||||
|
||||
let keyMapper = null;
|
||||
if(sessionStorageManager.playingAppName.indexOf("korean") > 0)
|
||||
keyMapper = new KoreanKeyMapper();
|
||||
else
|
||||
keyMapper = new EnglishKeyMapper();
|
||||
this.keyMapper = new KeyMapper();
|
||||
new Keyboard(this.keyMapper);
|
||||
|
||||
new Keyboard(keyMapper);
|
||||
game.input.keyboard.processKeyPress = () => {
|
||||
self.checkTypingContents(event);
|
||||
}
|
||||
this.shiftKey = game.input.keyboard.addKey(Phaser.Keyboard.SHIFT);
|
||||
|
||||
|
||||
/*
|
||||
@@ -85,7 +85,7 @@ class TypingPractice {
|
||||
screenBottom.printBottomRightText(sessionStorageManager.playerName);
|
||||
|
||||
|
||||
// this.startGame();
|
||||
this.startGame();
|
||||
// this.countDown();
|
||||
}
|
||||
|
||||
@@ -101,26 +101,36 @@ class TypingPractice {
|
||||
}
|
||||
|
||||
goResult() {
|
||||
this.textTypingContent.clearColors();
|
||||
this.textTypingContent.addColor(TypingPractice.COLOR_CONTENT_RIGHT, 0);
|
||||
this.textTypingContent.text = "= 연습 끝 =";
|
||||
/*
|
||||
sessionStorageManager.record = this.typingRecordTotal;
|
||||
if(sessionStorageManager.record > sessionStorageManager.bestRecord)
|
||||
sessionStorageManager.bestRecord = sessionStorageManager.record;
|
||||
|
||||
location.href = '../../web/client/result.html';
|
||||
*/
|
||||
}
|
||||
|
||||
initTypingData() {
|
||||
this.typingContents = this.getTypingPracticeContents();
|
||||
console.log(this.typingContents);
|
||||
let randomContents = Phaser.ArrayUtils.shuffle(this.typingContents);
|
||||
console.log(randomContents);
|
||||
this.wordCountForStage = TypingPractice.WORD_COUNT_FOR_STAGE;
|
||||
if(isDebugMode())
|
||||
this.wordCountForStage = 3;
|
||||
this.typingRandomContents = randomContents.slice(1, this.wordCountForStage + 1); // start Num, end Num (not index)
|
||||
console.log(this.typingRandomContents);
|
||||
this.typingContentLength = this.typingContents.length;
|
||||
this.typingIndex = 0;
|
||||
|
||||
|
||||
|
||||
this.isTyping = false;
|
||||
this.timeTypingStart = 0;
|
||||
this.timeTypingEnd = 0;
|
||||
// this.timeTypingStart = 0;
|
||||
// this.timeTypingEnd = 0;
|
||||
|
||||
this.typingLetterCountTotal = 0;
|
||||
this.typingRecordTotal = 0;
|
||||
@@ -128,22 +138,48 @@ class TypingPractice {
|
||||
|
||||
|
||||
getTypingPracticeContents() {
|
||||
let TypingPracticeContents = this.loadTestContent();
|
||||
let TypingPracticeContents = this.loadPracticeContent();
|
||||
// console.log('playingStageData.language : ' + playingStageData.language);
|
||||
// console.log('playingStageData.level : ' + playingStageData.level);
|
||||
// console.log('TypingPracticeContents : ' + TypingPracticeContents);
|
||||
|
||||
this.typingRecordForLines = [];
|
||||
this.typingElapsedTime = [];
|
||||
for(let i = 0; i < TypingPracticeContents.length; i++) {
|
||||
this.typingRecordForLines[i] = 0;
|
||||
this.typingElapsedTime[i] = 0;
|
||||
}
|
||||
// this.typingRecordForLines = [];
|
||||
// this.typingElapsedTime = [];
|
||||
// for(let i = 0; i < TypingPracticeContents.length; i++) {
|
||||
// this.typingRecordForLines[i] = 0;
|
||||
// this.typingElapsedTime[i] = 0;
|
||||
// }
|
||||
|
||||
return TypingPracticeContents;
|
||||
}
|
||||
|
||||
loadTestContent() {
|
||||
loadTemporaryContent() {
|
||||
testContent = [
|
||||
"ㅃ",
|
||||
"ㅂ",
|
||||
"ㅈ",
|
||||
"ㅉ",
|
||||
"ㄸ",
|
||||
"ㄷ",
|
||||
"ㄱ",
|
||||
"ㄲ",
|
||||
"ㅅ"
|
||||
];
|
||||
// testContent = [
|
||||
// "a",
|
||||
// "s",
|
||||
// "d",
|
||||
// "f",
|
||||
// "j",
|
||||
// "k",
|
||||
// "l",
|
||||
// ";",
|
||||
// "'"
|
||||
// ];
|
||||
return testContent;
|
||||
}
|
||||
|
||||
loadPracticeContent() {
|
||||
let appName = "";
|
||||
if(isTypingTestStage())
|
||||
appName = sessionStorageManager.playingAppName.substring(5);
|
||||
@@ -213,40 +249,87 @@ class TypingPractice {
|
||||
}
|
||||
|
||||
showTypingPracticeContents() {
|
||||
for(let i = 0; i < TypingPractice.TYPING_CONTENT_DONE_COUNT; i++) {
|
||||
let doneIndex = this.typingIndex - i - 1;
|
||||
if(doneIndex < 0) {
|
||||
this.textTypingContentsDone[i].text = "";
|
||||
this.textTypingRecordsDone[i].text = "";
|
||||
} else {
|
||||
this.textTypingContentsDone[i].text = this.typingRandomContents[doneIndex];
|
||||
this.textTypingRecordsDone[i].text = Math.floor(this.typingRecordForLines[doneIndex]);
|
||||
}
|
||||
}
|
||||
let doneIndex = this.typingIndex - 1;
|
||||
if(doneIndex < 0)
|
||||
this.textTypingContentsDone.text = "";
|
||||
else
|
||||
this.textTypingContentsDone.text = this.typingRandomContents[doneIndex];
|
||||
// for(let i = 0; i < TypingPractice.TYPING_CONTENT_DONE_COUNT; i++) {
|
||||
// let doneIndex = this.typingIndex - i - 1;
|
||||
// if(doneIndex < 0) {
|
||||
// this.textTypingContentsDone.text = "";
|
||||
// } else {
|
||||
// this.textTypingContentsDone.text = this.typingRandomContents[doneIndex];
|
||||
// }
|
||||
// }
|
||||
|
||||
if(this.typingIndex == this.wordCountForStage) {
|
||||
if(this.typingIndex === this.wordCountForStage) {
|
||||
this.textTypingContent.text = "";
|
||||
return;
|
||||
}
|
||||
|
||||
this.textTypingContent.text = this.typingRandomContents[this.typingIndex];
|
||||
|
||||
for(let i = 0; i < TypingPractice.TYPING_CONTENT_PREVIEW_COUNT; i++) {
|
||||
let previewIndex = this.typingIndex + i + 1;
|
||||
if(previewIndex < this.typingRandomContents.length)
|
||||
this.textTypingContentPreview[i].text = this.typingRandomContents[previewIndex];
|
||||
else
|
||||
this.textTypingContentPreview[i].text = "";
|
||||
}
|
||||
let previewIndex = this.typingIndex + 1;
|
||||
if(previewIndex > this.typingRandomContents.length - 1)
|
||||
this.textTypingContentPreview.text = "";
|
||||
else
|
||||
this.textTypingContentPreview.text = this.typingRandomContents[previewIndex];
|
||||
// for(let i = 0; i < TypingPractice.TYPING_CONTENT_PREVIEW_COUNT; i++) {
|
||||
// let previewIndex = this.typingIndex + i + 1;
|
||||
// if(previewIndex < this.typingRandomContents.length)
|
||||
// this.textTypingContentPreview.text = this.typingRandomContents[previewIndex];
|
||||
// else
|
||||
// this.textTypingContentPreview.text = "";
|
||||
// }
|
||||
}
|
||||
|
||||
/*
|
||||
resetTypingContent() {
|
||||
this.textTypingContent.clearColors();
|
||||
this.textTypingContent.addColor(TypingPractice.COLOR_CONTENT_WRONG, 0);
|
||||
this.inputTextContent.canvasInput.value('');
|
||||
this.textTypingContent.addColor(TypingPractice.COLOR_CONTENT_RIGHT, 0);
|
||||
}
|
||||
*/
|
||||
|
||||
getKeyCode(text) {
|
||||
return this.keyMapper.getKeyIDOfText(text);
|
||||
}
|
||||
|
||||
isKeyPressed(inputContent, typingContent) {
|
||||
let inputContentKeyCode = this.getKeyCode(inputContent);
|
||||
let typingContentKeyCode = this.getKeyCode(typingContent);
|
||||
|
||||
if(inputContentKeyCode !== typingContentKeyCode)
|
||||
return false;
|
||||
|
||||
let isShiftInputContent = this.shiftKey.isDown;
|
||||
let isShiftTypingContent = this.keyMapper.isShiftText(typingContent);
|
||||
|
||||
if(isShiftInputContent !== isShiftTypingContent)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
checkTypingContents(evnet) {
|
||||
let inputContent = event.key;
|
||||
let typingContent = this.typingRandomContents[this.typingIndex];
|
||||
|
||||
// if(this.getKeyCode(inputContent) === this.getKeyCode(typingContent)
|
||||
// && this.getShiftTypeOfText(inputContent) === this.getShiftTypeOfText(typingContent)) {
|
||||
// console.log("correct key");
|
||||
// }
|
||||
|
||||
// if(shiftKey.isDown)
|
||||
// console.log(this.shiftKey);
|
||||
if(this.isKeyPressed(inputContent, typingContent)) {
|
||||
this.playNextContent();
|
||||
|
||||
if(this.typingIndex === this.wordCountForStage) {
|
||||
this.goResult();
|
||||
}
|
||||
}
|
||||
/*
|
||||
if(event.keyCode == Phaser.Keyboard.ENTER) {
|
||||
// console.log("### enter ###");
|
||||
let inputContent = this.inputTextContent.canvasInput.value();
|
||||
@@ -270,8 +353,10 @@ class TypingPractice {
|
||||
|
||||
this.showTypingContentHighlight();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
showTypingContentHighlight() {
|
||||
let typingContent = this.typingRandomContents[this.typingIndex];
|
||||
let inputContent = this.inputTextContent.canvasInput.value();
|
||||
@@ -293,7 +378,9 @@ class TypingPractice {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
calculateTypingRecord(typingContent) {
|
||||
// console.log('입력 단어 : ' + this.typingRandomContents[this.typingIndex]);
|
||||
|
||||
@@ -310,17 +397,17 @@ class TypingPractice {
|
||||
|
||||
let typingRecord = (typingContentPlusEnterCount + TypingPractice.TYPING_COUNT_PLUS_ENTER) * 60000 / elapsedTimeMS;
|
||||
|
||||
this.typingElapsedTime[this.typingIndex] = elapsedTimeMS;
|
||||
// this.typingElapsedTime[this.typingIndex] = elapsedTimeMS;
|
||||
this.typingLetterCountTotal += typingContentPlusEnterCount;
|
||||
this.typingRecordForLines[this.typingIndex] = typingRecord;
|
||||
// this.typingRecordForLines[this.typingIndex] = typingRecord;
|
||||
// console.log(this.typingRecordForLines[this.typingIndex]);
|
||||
|
||||
let typingElapsedTimeTotal = 0;
|
||||
for(let i = 0; i <= this.typingIndex; i++) {
|
||||
// console.log('i : ' + i + ' - time : ' + this.typingElapsedTime[i]);
|
||||
typingElapsedTimeTotal += this.typingElapsedTime[i];
|
||||
}
|
||||
this.typingRecordTotal = this.typingLetterCountTotal * 60000 / typingElapsedTimeTotal;
|
||||
// let typingElapsedTimeTotal = 0;
|
||||
// for(let i = 0; i <= this.typingIndex; i++) {
|
||||
// // console.log('i : ' + i + ' - time : ' + this.typingElapsedTime[i]);
|
||||
// typingElapsedTimeTotal += this.typingElapsedTime[i];
|
||||
// }
|
||||
// this.typingRecordTotal = this.typingLetterCountTotal * 60000 / typingElapsedTimeTotal;
|
||||
// console.log(this.typingLetterCountTotal);
|
||||
// console.log(typingElapsedTimeTotal);
|
||||
// console.log(typingRecordTotal);
|
||||
@@ -331,18 +418,20 @@ class TypingPractice {
|
||||
// console.log('typingRecordTotal : ' + typingRecordTotal);
|
||||
// console.log('-----------------------------------');
|
||||
}
|
||||
*/
|
||||
|
||||
playNextContent() {
|
||||
this.typingIndex++;
|
||||
this.showTypingPracticeContents();
|
||||
this.showPlayingWordNumber();
|
||||
this.resetTypingContent();
|
||||
// this.resetTypingContent();
|
||||
}
|
||||
|
||||
showPlayingWordNumber() {
|
||||
this.contentProgressText.print(this.typingIndex + 1, this.wordCountForStage);
|
||||
}
|
||||
|
||||
/*
|
||||
setTimeTypingStart() {
|
||||
this.timeTypingStart = game.time.elapsedSince(0);
|
||||
let timeGap = this.timeTypingStart - this.timeTypingEnd;
|
||||
@@ -356,6 +445,7 @@ class TypingPractice {
|
||||
|
||||
// console.log('time gap : ' + (this.timeTypingStart - this.timeTypingEnd));
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,13 @@ class KeyMapper {
|
||||
this.keyboardKeyMap = {};
|
||||
this.inputKeyMap = {};
|
||||
|
||||
this.registerFunctionKey();
|
||||
this.registerEnglishKey();
|
||||
this.registerKoreanKey();
|
||||
}
|
||||
|
||||
|
||||
registerFunctionKey() {
|
||||
this.registerKeyTextData("Backquote", "`", "~");
|
||||
this.registerKeyTextData("Digit1", "1", "!");
|
||||
this.registerKeyTextData("Digit2", "2", "@");
|
||||
@@ -52,12 +59,73 @@ class KeyMapper {
|
||||
this.registerKeyTextData("korean_english", "한/영", "한/영");
|
||||
this.registerKeyTextData("AltRight", "alt", "alt");
|
||||
this.registerKeyTextData("ControlRight", "ctrl", "ctrl");
|
||||
|
||||
console.log(this.keyboardKeyMap);
|
||||
}
|
||||
|
||||
registerKeyTextData(keyID, normalText, shiftText, shiftHandSide) {
|
||||
this.keyboardKeyMap[keyID] = new KeyTextData(normalText, shiftText, shiftHandSide);
|
||||
registerEnglishKey() {
|
||||
this.registerKeyTextData("KeyQ", "q", "Q");
|
||||
this.registerKeyTextData("KeyW", "w", "W");
|
||||
this.registerKeyTextData("KeyE", "e", "E");
|
||||
this.registerKeyTextData("KeyR", "r", "R");
|
||||
this.registerKeyTextData("KeyT", "t", "T");
|
||||
this.registerKeyTextData("KeyY", "y", "Y");
|
||||
this.registerKeyTextData("KeyU", "u", "U");
|
||||
this.registerKeyTextData("KeyI", "i", "I");
|
||||
this.registerKeyTextData("KeyO", "o", "O");
|
||||
this.registerKeyTextData("KeyP", "p", "P");
|
||||
|
||||
this.registerKeyTextData("KeyA", "a", "A");
|
||||
this.registerKeyTextData("KeyS", "s", "S");
|
||||
this.registerKeyTextData("KeyD", "d", "D");
|
||||
this.registerKeyTextData("KeyF", "f", "F");
|
||||
this.registerKeyTextData("KeyG", "g", "G");
|
||||
this.registerKeyTextData("KeyH", "h", "H");
|
||||
this.registerKeyTextData("KeyJ", "j", "J");
|
||||
this.registerKeyTextData("KeyK", "k", "K");
|
||||
this.registerKeyTextData("KeyL", "l", "L");
|
||||
|
||||
this.registerKeyTextData("KeyZ", "z", "Z");
|
||||
this.registerKeyTextData("KeyX", "x", "X");
|
||||
this.registerKeyTextData("KeyC", "c", "C");
|
||||
this.registerKeyTextData("KeyV", "v", "V");
|
||||
this.registerKeyTextData("KeyB", "b", "B");
|
||||
this.registerKeyTextData("KeyN", "n", "N");
|
||||
this.registerKeyTextData("KeyM", "m", "M");
|
||||
}
|
||||
|
||||
registerKoreanKey() {
|
||||
this.registerKeyTextData("KeyQ", "ㅂ", "ㅃ");
|
||||
this.registerKeyTextData("KeyW", "ㅈ", "ㅉ");
|
||||
this.registerKeyTextData("KeyE", "ㄷ", "ㄸ");
|
||||
this.registerKeyTextData("KeyR", "ㄱ", "ㄲ");
|
||||
this.registerKeyTextData("KeyT", "ㅅ", "ㅆ");
|
||||
this.registerKeyTextData("KeyY", "ㅛ", "ㅛ");
|
||||
this.registerKeyTextData("KeyU", "ㅕ", "ㅕ");
|
||||
this.registerKeyTextData("KeyI", "ㅑ", "ㅑ");
|
||||
this.registerKeyTextData("KeyO", "ㅐ", "ㅒ");
|
||||
this.registerKeyTextData("KeyP", "ㅔ", "ㅖ");
|
||||
|
||||
this.registerKeyTextData("KeyA", "ㅁ", "ㅁ");
|
||||
this.registerKeyTextData("KeyS", "ㄴ", "ㄴ");
|
||||
this.registerKeyTextData("KeyD", "ㅇ", "ㅇ");
|
||||
this.registerKeyTextData("KeyF", "ㄹ", "ㄹ");
|
||||
this.registerKeyTextData("KeyG", "ㅎ", "ㅎ");
|
||||
this.registerKeyTextData("KeyH", "ㅗ", "ㅗ");
|
||||
this.registerKeyTextData("KeyJ", "ㅓ", "ㅓ");
|
||||
this.registerKeyTextData("KeyK", "ㅏ", "ㅏ");
|
||||
this.registerKeyTextData("KeyL", "ㅣ", "ㅣ");
|
||||
|
||||
this.registerKeyTextData("KeyZ", "ㅋ", "ㅋ");
|
||||
this.registerKeyTextData("KeyX", "ㅌ", "ㅌ");
|
||||
this.registerKeyTextData("KeyC", "ㅊ", "ㅊ");
|
||||
this.registerKeyTextData("KeyV", "ㅍ", "ㅍ");
|
||||
this.registerKeyTextData("KeyB", "ㅠ", "ㅠ");
|
||||
this.registerKeyTextData("KeyN", "ㅜ", "ㅜ");
|
||||
this.registerKeyTextData("KeyM", "ㅡ", "ㅡ");
|
||||
}
|
||||
|
||||
|
||||
registerKeyTextData(keyID, normalText, shiftText) {
|
||||
this.keyboardKeyMap[keyID] = new KeyTextData(normalText, shiftText);
|
||||
|
||||
if(this.inputKeyMap[keyID] === undefined)
|
||||
this.inputKeyMap[keyID] = keyID;
|
||||
@@ -84,23 +152,20 @@ class KeyMapper {
|
||||
return this.keyboardKeyMap[keyID].shiftText;
|
||||
}
|
||||
|
||||
getShiftHandSide(keyID) {
|
||||
if(this.keyboardKeyMap[keyID] === undefined) {
|
||||
console.log(keyID);
|
||||
return "?";
|
||||
}
|
||||
return this.keyboardKeyMap[keyID].shiftHandSide;
|
||||
}
|
||||
|
||||
|
||||
|
||||
getKeyIDOfText(text) {
|
||||
return this.inputKeyMap[text];
|
||||
}
|
||||
|
||||
getShiftTypeOfText(text) {
|
||||
isShiftText(text) {
|
||||
let keyID = this.getKeyIDOfText(text);
|
||||
return this.keyboardKeyMap[keyID].shiftHandSide;
|
||||
let keyTextData = this.keyboardKeyMap[keyID];
|
||||
|
||||
if(keyTextData.normalText === text)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@ class Keyboard {
|
||||
this.keyUpReservations = [];
|
||||
|
||||
game.input.keyboard.addCallbacks(this, this.keyDown, this.keyUp, null);
|
||||
// game.input.keyboard.processKeyDown = this.keyDown;
|
||||
// game.input.keyboard.processKeyUp = this.keyUp;
|
||||
|
||||
|
||||
let shiftKey = game.input.keyboard.addKey(Phaser.KeyCode.SHIFT);
|
||||
shiftKey.onDown.add(this.shifted, this);
|
||||
@@ -370,17 +373,17 @@ class Keyboard {
|
||||
}
|
||||
|
||||
|
||||
Keyboard.DEFAULT_KEY_SIZE_PX = 46;
|
||||
Keyboard.BACKSPACE_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 1.5;
|
||||
Keyboard.TAB_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 1.5;
|
||||
Keyboard.CAPS_LOCK_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 1.9;
|
||||
Keyboard.ENTER_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 1.75;
|
||||
Keyboard.SHIFT_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 2.4;
|
||||
Keyboard.CTRL_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 1.7;
|
||||
Keyboard.WINDOW_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX;
|
||||
Keyboard.ALT_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 1.5;
|
||||
Keyboard.CHINESE_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX;
|
||||
Keyboard.SPACE_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 5.9;
|
||||
Keyboard.DEFAULT_KEY_SIZE_PX = 46;
|
||||
Keyboard.BACKSPACE_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 1.5;
|
||||
Keyboard.TAB_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 1.5;
|
||||
Keyboard.CAPS_LOCK_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 1.9;
|
||||
Keyboard.ENTER_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 1.75;
|
||||
Keyboard.SHIFT_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 2.4;
|
||||
Keyboard.CTRL_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 1.7;
|
||||
Keyboard.WINDOW_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX;
|
||||
Keyboard.ALT_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 1.5;
|
||||
Keyboard.CHINESE_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX;
|
||||
Keyboard.SPACE_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 5.9;
|
||||
Keyboard.KOREAN_ENGLISH_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX;
|
||||
|
||||
Keyboard.KEY_GAP_PX = 6;
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
class KoreanKeyMapper extends KeyMapper {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.registerKeyTextData("KeyQ", "ㅂ", "ㅃ");
|
||||
this.registerKeyTextData("KeyW", "ㅈ", "ㅉ");
|
||||
this.registerKeyTextData("KeyE", "ㄷ", "ㄸ");
|
||||
this.registerKeyTextData("KeyR", "ㄱ", "ㄲ");
|
||||
this.registerKeyTextData("KeyT", "ㅅ", "ㅆ");
|
||||
this.registerKeyTextData("KeyY", "ㅛ", "ㅛ");
|
||||
this.registerKeyTextData("KeyU", "ㅕ", "ㅕ");
|
||||
this.registerKeyTextData("KeyI", "ㅑ", "ㅑ");
|
||||
this.registerKeyTextData("KeyO", "ㅐ", "ㅒ");
|
||||
this.registerKeyTextData("KeyP", "ㅔ", "ㅖ");
|
||||
|
||||
this.registerKeyTextData("KeyA", "ㅁ", "ㅁ");
|
||||
this.registerKeyTextData("KeyS", "ㄴ", "ㄴ");
|
||||
this.registerKeyTextData("KeyD", "ㅇ", "ㅇ");
|
||||
this.registerKeyTextData("KeyF", "ㄹ", "ㄹ");
|
||||
this.registerKeyTextData("KeyG", "ㅎ", "ㅎ");
|
||||
this.registerKeyTextData("KeyH", "ㅗ", "ㅗ");
|
||||
this.registerKeyTextData("KeyJ", "ㅓ", "ㅓ");
|
||||
this.registerKeyTextData("KeyK", "ㅏ", "ㅏ");
|
||||
this.registerKeyTextData("KeyL", "ㅣ", "ㅣ");
|
||||
|
||||
this.registerKeyTextData("KeyZ", "ㅋ", "ㅋ");
|
||||
this.registerKeyTextData("KeyX", "ㅌ", "ㅌ");
|
||||
this.registerKeyTextData("KeyC", "ㅊ", "ㅊ");
|
||||
this.registerKeyTextData("KeyV", "ㅍ", "ㅍ");
|
||||
this.registerKeyTextData("KeyB", "ㅠ", "ㅠ");
|
||||
this.registerKeyTextData("KeyN", "ㅜ", "ㅜ");
|
||||
this.registerKeyTextData("KeyM", "ㅡ", "ㅡ");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
var englishLeftUpperWordList = [
|
||||
var englishRightUpperWordList = [
|
||||
"port",
|
||||
"upside",
|
||||
"kid",
|
||||
|
||||
Reference in New Issue
Block a user