Add: KeyMapper

This commit is contained in:
2018-06-12 17:43:34 +09:00
parent cbe59fa819
commit 7907ae34cf
18 changed files with 603 additions and 282 deletions
@@ -0,0 +1,36 @@
class EnglishKeyMapper extends KeyMapper {
constructor() {
super();
this.registerKeyTextData("q", "q", "Q", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("w", "w", "W", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("e", "e", "E", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("r", "r", "R", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("t", "t", "T", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("y", "y", "Y", KeyTextData.LEFT_HAND);
this.registerKeyTextData("u", "u", "U", KeyTextData.LEFT_HAND);
this.registerKeyTextData("i", "i", "I", KeyTextData.LEFT_HAND);
this.registerKeyTextData("o", "o", "O", KeyTextData.LEFT_HAND);
this.registerKeyTextData("p", "p", "P", KeyTextData.LEFT_HAND);
this.registerKeyTextData("a", "a", "A", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("s", "s", "S", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("d", "d", "D", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("f", "f", "F", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("g", "g", "G", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("h", "h", "H", KeyTextData.LEFT_HAND);
this.registerKeyTextData("j", "j", "J", KeyTextData.LEFT_HAND);
this.registerKeyTextData("k", "k", "K", KeyTextData.LEFT_HAND);
this.registerKeyTextData("l", "l", "L", KeyTextData.LEFT_HAND);
this.registerKeyTextData("z", "z", "Z", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("x", "x", "X", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("c", "c", "C", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("v", "v", "V", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("b", "b", "B", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("n", "n", "N", KeyTextData.LEFT_HAND);
this.registerKeyTextData("m", "m", "M", KeyTextData.LEFT_HAND);
}
}
+13 -5
View File
@@ -51,16 +51,22 @@ class TypingPractice {
.addColor(textPreviewColor[0], 0); .addColor(textPreviewColor[0], 0);
let keyMapper = null;
if(sessionStorageManager.playingAppName.substring("korean") > 0)
keyMapper = new KoreanKeyMapper();
else
keyMapper = new EnglishKeyMapper();
// let keyButton = new KeyButton(100, 400, 100, "A", "align_type"); // let keyButton = new KeyButton(100, 400, 100, "A", "align_type");
new Keyboard(); new Keyboard(keyMapper);
/*
this.hand_left = game.add.image(360, 680, "hand_left"); this.hand_left = game.add.image(370, 680, "hand_left");
this.hand_left.scale.set(2); this.hand_left.scale.set(2);
this.hand_left.anchor.set(0.5); this.hand_left.anchor.set(0.5);
this.hand_right = game.add.image(660, 680, "hand_right"); this.hand_right = game.add.image(630, 680, "hand_right");
this.hand_right.scale.set(2); this.hand_right.scale.set(2);
this.hand_right.anchor.set(0.5); this.hand_right.anchor.set(0.5);
@@ -69,6 +75,8 @@ class TypingPractice {
mask.drawRect(100, 300, 1028, 400); mask.drawRect(100, 300, 1028, 400);
this.hand_left.mask = mask; this.hand_left.mask = mask;
this.hand_right.mask = mask; this.hand_right.mask = mask;
*/
// bottom // bottom
let screenBottom = new ScreenBottom(); let screenBottom = new ScreenBottom();
@@ -78,7 +86,7 @@ class TypingPractice {
screenBottom.printBottomRightText(sessionStorageManager.playerName); screenBottom.printBottomRightText(sessionStorageManager.playerName);
game.input.keyboard.addCallbacks(this, null, null, this.keyPress); // game.input.keyboard.addCallbacks(this, null, null, this.keyPress);
// this.startGame(); // this.startGame();
// this.countDown(); // this.countDown();
} }
+46 -10
View File
@@ -1,8 +1,9 @@
class KeyButton { class KeyButton {
constructor(x, y, width, height, normalText, shiftText, align_type) { constructor(x, y, width, height, normalText, shiftText, alignType) {
this.normalText = normalText; this.normalText = normalText;
this.shiftText = shiftText; this.shiftText = shiftText;
this.alignType = alignType;
this.setting = new RoundRectButtonSetting(x, y, width, height, KeyButton.DEFALUT_ROUND_AMOUNT_PX); this.setting = new RoundRectButtonSetting(x, y, width, height, KeyButton.DEFALUT_ROUND_AMOUNT_PX);
this.setting.strokeWidthPx = 2; this.setting.strokeWidthPx = 2;
@@ -10,9 +11,9 @@ class KeyButton {
this.button = this.makeButtonSprite(this.setting); this.button = this.makeButtonSprite(this.setting);
this.button.inputEnabled = true; this.button.inputEnabled = true;
this.text = this.makeText(this.setting, this.normalText); this.buttonText = this.makeText(this.setting, this.normalText);
if(this.normalText.length > 0) { if(this.normalText.length > 0) {
this.button.addChild(this.text); this.button.addChild(this.buttonText);
} }
} }
@@ -30,22 +31,51 @@ class KeyButton {
} }
makeText(setting, textContent) { makeText(setting, textContent) {
let width = setting.width - setting.strokeWidthPx * 2; let offsetX_px = 4;
let offsetY_px = 5;
let width = setting.width - setting.strokeWidthPx * 2 - offsetX_px;
let height = setting.height - setting.strokeWidthPx * 2; let height = setting.height - setting.strokeWidthPx * 2;
setting.fontStyle.font = "20px Arial"; if(this.alignType === KeyButton.NORMAL_KEY)
let btnText = game.add.text(0, 0, textContent, setting.fontStyle) setting.fontStyle.font = "20px Courier New";
else
setting.fontStyle.font = "11px Courier New";
let btnText = game.add.text(offsetX_px, offsetY_px, textContent, setting.fontStyle)
.setTextBounds(setting.strokeWidthPx, setting.strokeWidthPx, width, height); .setTextBounds(setting.strokeWidthPx, setting.strokeWidthPx, width, height);
// btnText.boundsAlignH = "right"; if(this.alignType === KeyButton.NORMAL_KEY) {
// btnText.boundsAlignV = "bottom"; btnText.boundsAlignH = "center";
btnText.boundsAlignV = "middle";
} else if(this.alignType === KeyButton.LEFT_FUNCTION_KEY) {
btnText.boundsAlignH = "left";
btnText.boundsAlignV = "bottom";
} else if(this.alignType === KeyButton.CENTER_FUNCTION_KEY) {
btnText.boundsAlignH = "center";
btnText.boundsAlignV = "bottom";
} else if(this.alignType === KeyButton.RIGHT_FUNCTION_KEY) {
btnText.boundsAlignH = "right";
btnText.boundsAlignV = "bottom";
}
btnText.lineSpacing = RoundRectButtonSetting.DEFAULT_TEXT_LINE_SPACING_PX; // btnText.lineSpacing = RoundRectButtonSetting.DEFAULT_TEXT_LINE_SPACING_PX;
btnText.text = textContent;
return btnText; return btnText;
} }
onShiftPressed() {
this.buttonText.text = this.shiftText;
}
onShiftUnpressed() {
this.buttonText.text = this.normalText;
}
mouseOut() { mouseOut() {
this.text.fill = this.setting.textColors.out; this.text.fill = this.setting.textColors.out;
this.buttonStroke.tint = this.setting.strokeColors.out; this.buttonStroke.tint = this.setting.strokeColors.out;
@@ -87,4 +117,10 @@ class KeyButton {
KeyButton.NONE_ICON = ""; KeyButton.NONE_ICON = "";
KeyButton.NONE_BUTTON_TEXT = ""; KeyButton.NONE_BUTTON_TEXT = "";
KeyButton.DEFALUT_ROUND_AMOUNT_PX = 10; KeyButton.DEFALUT_ROUND_AMOUNT_PX = 10;
KeyButton.NORMAL_KEY = "normal_key";
KeyButton.NORMAL_FUNCTION_KEY = "normal_function_key";
KeyButton.LEFT_FUNCTION_KEY = "left_function_key";
KeyButton.CENTER_FUNCTION_KEY = "center_function_key";
KeyButton.RIGHT_FUNCTION_KEY = "right_function_key";
+108
View File
@@ -0,0 +1,108 @@
class KeyTextData {
constructor(normalText, shiftText, shiftHandSide) {
this.normalText = normalText;
this.shiftText = shiftText;
this.shiftHandSide = shiftHandSide;
}
}
KeyTextData.HAND_LEFT = 0;
KeyTextData.HAND_RIGHT = 1;
KeyTextData.THUMB = 0;
KeyTextData.INDEX_FINGER = 1;
KeyTextData.MIDDLE_FINGER = 2;
KeyTextData.RING_FINGER = 3;
KeyTextData.LITTLE_FINGER = 4;
KeyTextData.LEFT_HAND = 0;
KeyTextData.RIGHT_HAND = 1;
KeyTextData.BOTH_HAND = 2;
KeyTextData.NONE_HAND = 3;
class KeyMapper {
constructor() {
this.keyboardKeyMap = {};
this.inputKeyMap = {};
this.registerKeyTextData("`", "`", "~", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("1", "1", "!", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("2", "2", "@", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("3", "3", "#", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("4", "4", "$", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("5", "5", "%", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("6", "6", "^", KeyTextData.LEFT_HAND);
this.registerKeyTextData("7", "7", "&", KeyTextData.LEFT_HAND);
this.registerKeyTextData("8", "8", "*", KeyTextData.LEFT_HAND);
this.registerKeyTextData("9", "9", "(", KeyTextData.LEFT_HAND);
this.registerKeyTextData("0", "0", ")", KeyTextData.LEFT_HAND);
this.registerKeyTextData("-", "-", "_", KeyTextData.LEFT_HAND);
this.registerKeyTextData("=", "=", "+", KeyTextData.LEFT_HAND);
this.registerKeyTextData("backspace", "backspace", "backspace", KeyTextData.NONE_HAND);
this.registerKeyTextData("tab", "tab", "tab", KeyTextData.NONE_HAND);
this.registerKeyTextData("[", "[", "{", KeyTextData.LEFT_HAND);
this.registerKeyTextData("]", "]", "}", KeyTextData.LEFT_HAND);
this.registerKeyTextData("\\", "\\", "|", KeyTextData.LEFT_HAND);
this.registerKeyTextData("caps_lock", "caps lock", "caps lock", KeyTextData.NONE_HAND);
this.registerKeyTextData(";", ";", ":", KeyTextData.LEFT_HAND);
this.registerKeyTextData("'", "'", "\"", KeyTextData.LEFT_HAND);
this.registerKeyTextData("enter", "enter", "enter", KeyTextData.NONE_HAND);
this.registerKeyTextData("left_shift", "left_shift", "left_shift", KeyTextData.LEFT_HAND);
this.registerKeyTextData("right_shift", "right_shift", "right_shift", KeyTextData.RIGHT_HAND);
this.registerKeyTextData(",", ",", "<", KeyTextData.LEFT_HAND);
this.registerKeyTextData(".", ".", ">", KeyTextData.LEFT_HAND);
this.registerKeyTextData("/", "/", "?", KeyTextData.LEFT_HAND);
this.registerKeyTextData("left_ctrl", "ctrl", "ctrl", KeyTextData.NONE_HAND);
this.registerKeyTextData("window", "window", "window", KeyTextData.NONE_HAND);
this.registerKeyTextData("left_alt", "alt", "alt", KeyTextData.NONE_HAND);
this.registerKeyTextData("chinese", "한자", "한자", KeyTextData.NONE_HAND);
this.registerKeyTextData("space", "space", "space", KeyTextData.BOTH_HAND);
this.registerKeyTextData("korean_english", "한/영", "한/영", KeyTextData.NONE_HAND);
this.registerKeyTextData("right_alt", "alt", "alt", KeyTextData.NONE_HAND);
this.registerKeyTextData("right_ctrl", "ctrl", "ctrl", KeyTextData.NONE_HAND);
}
registerKeyTextData(keyID, normalText, shiftText, shiftHandSide) {
this.keyboardKeyMap[keyID] = new KeyTextData(normalText, shiftText, shiftHandSide);
if(this.inputKeyMap[normalText] === undefined)
this.inputKeyMap[normalText] = keyID;
if(this.inputKeyMap[shiftText] === undefined)
this.inputKeyMap[shiftText] = keyID;
}
getNormalText(keyID) {
// console.log(this.keyboardKeyMap[keyID]);
return this.keyboardKeyMap[keyID].normalText;
}
getShiftText(keyID) {
return this.keyboardKeyMap[keyID].shiftText;
}
getShiftHandSide(keyID) {
return this.keyboardKeyMap[keyID].shiftHandSide;
}
getKeyIDOfText(text) {
return this.inputKeyMap[text];
}
getShiftTypeOfText(text) {
let keyID = this.getKeyIDOfText(text);
return this.keyboardKeyMap[keyID].shiftHandSide;
}
}
+264 -267
View File
@@ -1,271 +1,54 @@
class Keyboard { class Keyboard {
constructor() { constructor(keyMapper) {
// let keyButton = new KeyButton(100, 400, 100, "A", "align_type"); // let keyButton = new KeyButton(100, 400, 100, "A", "align_type");
let keyData = this.getKeyBoardData(); // let keyData = this.getKeyBoardData(keyMapper);
for(let i = 0; i < keyData.length; i++) { this.keyIndex = 0;
new KeyButton( this.keyDataList = [];
keyData[i].x, this.keyList = [];
keyData[i].y, this.keyHash = {};
keyData[i].width,
keyData[i].height, let shiftKey = game.input.keyboard.addKey(Phaser.KeyCode.SHIFT);
keyData[i].normalText, shiftKey.onDown.add(this.shifted, this);
keyData[i].shiftText, shiftKey.onUp.add(this.unshifted, this);
keyData[i].alignType,
this.initKeyData(keyMapper);
for(let i = 0; i < this.keyDataList.length; i++) {
this.keyList[i] = new KeyButton(
this.keyDataList[i].x,
this.keyDataList[i].y,
this.keyDataList[i].width,
this.keyDataList[i].height,
this.keyDataList[i].normalText,
this.keyDataList[i].shiftText,
this.keyDataList[i].alignType,
); );
} }
} }
getKeyBoardData() { shifted() {
let keyList = []; for(let i = 0; i < this.keyDataList.length; i++) {
let keyIndex = 0; this.keyList[i].onShiftPressed();
}
// row 1
keyList[keyIndex] = this.makeKeyDataObject(
"`", "~",
Keyboard.KEYBOARD_OFFSET__POX_X,
Keyboard.ROW_1_POX_Y,
Keyboard.DEFAULT_KEY_SIZE_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
"leftFunctionKey"
);
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "1", "!");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "2", "@");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "3", "#");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "4", "$");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "5", "%");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "6", "^");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "7", "&");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "8", "*");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "9", "(");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "0", ")");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "-", "_");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "=", "+");
keyIndex++;
keyList[keyIndex] = this.makeKeyDataObject(
"backspace", "backspace",
keyList[keyIndex - 1].x + keyList[keyIndex - 1].width + Keyboard.KEY_GAP_PX,
keyList[keyIndex - 1].y,
Keyboard.TAB_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
"leftFunctionKey"
);
keyIndex++;
// row 2
keyList[keyIndex] = this.makeKeyDataObject(
"tab", "tab",
Keyboard.KEYBOARD_OFFSET__POX_X,
Keyboard.ROW_2_POX_Y,
Keyboard.TAB_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
"rightFunctionKey"
);
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "q", "Q");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "w", "W");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "e", "E");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "r", "R");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "t", "T");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "y", "Y");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "u", "U");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "i", "I");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "o", "O");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "p", "P");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "[", "{");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "]", "}");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "\\", "|");
keyIndex++;
// row 3
keyList[keyIndex] = this.makeKeyDataObject(
"caps lock", "caps lock",
Keyboard.KEYBOARD_OFFSET__POX_X,
Keyboard.ROW_3_POX_Y,
Keyboard.CAPS_LOCK_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
"leftFunctionKey"
);
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "a", "A");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "s", "S");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "d", "D");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "f", "F");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "g", "G");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "h", "H");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "j", "J");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "k", "K");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "l", "L");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], ";", ":");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "'", "\"");
keyIndex++;
keyList[keyIndex] = this.makeKeyDataObject(
"enter", "enter",
keyList[keyIndex - 1].x + keyList[keyIndex - 1].width + Keyboard.KEY_GAP_PX,
keyList[keyIndex - 1].y,
Keyboard.ENTER_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
"rightFunctionKey"
);
keyIndex++;
// row 4
keyList[keyIndex] = this.makeKeyDataObject(
"shift", "shift",
Keyboard.KEYBOARD_OFFSET__POX_X,
Keyboard.ROW_4_POX_Y,
Keyboard.SHIFT_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
"leftFunctionKey"
);
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "z", "Z");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "x", "X");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "c", "C");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "v", "V");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "b", "B");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "n", "N");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "m", "M");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], ",", "<");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], ".", ">");
keyIndex++;
keyList[keyIndex] = this.makeNextNormalKeyDataObject(keyList[keyIndex - 1], "/", "?");
keyIndex++;
keyList[keyIndex] = this.makeKeyDataObject(
"shift", "shift",
keyList[keyIndex - 1].x + keyList[keyIndex - 1].width + Keyboard.KEY_GAP_PX,
keyList[keyIndex - 1].y,
Keyboard.SHIFT_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
"leftFunctionKey"
);
keyIndex++;
// row 5
keyList[keyIndex] = this.makeKeyDataObject(
"ctrl", "ctrl",
Keyboard.KEYBOARD_OFFSET__POX_X,
Keyboard.ROW_5_POX_Y,
Keyboard.CTRL_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
"leftFunctionKey"
);
keyIndex++;
keyList[keyIndex] = this.makeKeyDataObject(
"window", "window",
keyList[keyIndex - 1].x + keyList[keyIndex - 1].width + Keyboard.KEY_GAP_PX,
keyList[keyIndex - 1].y,
Keyboard.WINDOW_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
"leftFunctionKey"
);
keyIndex++;
keyList[keyIndex] = this.makeKeyDataObject(
"alt", "alt",
keyList[keyIndex - 1].x + keyList[keyIndex - 1].width + Keyboard.KEY_GAP_PX,
keyList[keyIndex - 1].y,
Keyboard.ALT_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
"leftFunctionKey"
);
keyIndex++;
keyList[keyIndex] = this.makeKeyDataObject(
"한자", "한자",
keyList[keyIndex - 1].x + keyList[keyIndex - 1].width + Keyboard.KEY_GAP_PX,
keyList[keyIndex - 1].y,
Keyboard.CHINESE_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
"leftFunctionKey"
);
keyIndex++;
keyList[keyIndex] = this.makeKeyDataObject(
"space", "space",
keyList[keyIndex - 1].x + keyList[keyIndex - 1].width + Keyboard.KEY_GAP_PX,
keyList[keyIndex - 1].y,
Keyboard.SPACE_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
"leftFunctionKey"
);
keyIndex++;
keyList[keyIndex] = this.makeKeyDataObject(
"한/영", "한/영",
keyList[keyIndex - 1].x + keyList[keyIndex - 1].width + Keyboard.KEY_GAP_PX,
keyList[keyIndex - 1].y,
Keyboard.KOREAN_ENGLISH_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
"leftFunctionKey"
);
keyIndex++;
keyList[keyIndex] = this.makeKeyDataObject(
"alt", "alt",
keyList[keyIndex - 1].x + keyList[keyIndex - 1].width + Keyboard.KEY_GAP_PX,
keyList[keyIndex - 1].y,
Keyboard.ALT_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
"leftFunctionKey"
);
keyIndex++;
keyList[keyIndex] = this.makeKeyDataObject(
"ctrl", "ctrl",
keyList[keyIndex - 1].x + keyList[keyIndex - 1].width + Keyboard.KEY_GAP_PX,
keyList[keyIndex - 1].y,
Keyboard.CTRL_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
"leftFunctionKey"
);
keyIndex++;
return keyList;
} }
unshifted() {
for(let i = 0; i < this.keyDataList.length; i++) {
this.keyList[i].onShiftUnpressed();
}
}
keyPress(char) {
// self.checkTypingContents(event);
console.log(char);
if(game.input.keyboard.isDown(Phaser.Keyboard.SHIFT))
console.log("shift is pressed");
}
makeKeyDataObject(normalText, shiftText, x, y, width, height, alignType) { makeKeyDataObject(normalText, shiftText, x, y, width, height, alignType) {
let keyDataObject = {}; let keyDataObject = {};
keyDataObject.normalText = normalText; keyDataObject.normalText = normalText;
@@ -287,29 +70,243 @@ class Keyboard {
prevKeyData.y, prevKeyData.y,
Keyboard.DEFAULT_KEY_SIZE_PX, Keyboard.DEFAULT_KEY_SIZE_PX,
Keyboard.DEFAULT_KEY_SIZE_PX, Keyboard.DEFAULT_KEY_SIZE_PX,
"normalKey" KeyButton.NORMAL_KEY
); );
} }
addKey(normalText, shiftText, x, y, width, alignType) {
return { addFunctionKeyData(keyMapper, keyID, x, y, width, height, type) {
normalText: normalText, shiftText: shiftText, x: x, y: y, width: width, alignType: alignType let normalText = keyMapper.getNormalText(keyID);
}; let shiftText = keyMapper.getShiftText(keyID);
let newKey = this.makeKeyDataObject(normalText, shiftText, x, y, width, height, type);
this.keyDataList[this.keyIndex] = newKey;
this.keyIndex++;
this.keyHash[keyID] = newKey;
}
addNextFunctionKeyData(keyMapper, keyID, width, height, type) {
let prevKey = this.keyDataList[this.keyIndex - 1];
let normalText = keyMapper.getNormalText(keyID);
let shiftText = keyMapper.getShiftText(keyID);
let newKey = this.makeKeyDataObject(
normalText,
shiftText,
prevKey.x + prevKey.width + Keyboard.KEY_GAP_PX,
prevKey.y,
width,
height,
type
);
this.keyDataList[this.keyIndex] = newKey;
this.keyIndex++;
this.keyHash[keyID] = newKey;
}
addNextNormalKeyData(keyMapper, keyID) {
let prevKey = this.keyDataList[this.keyIndex - 1];
let normalText = keyMapper.getNormalText(keyID);
let shiftText = keyMapper.getShiftText(keyID);
let newKey = this.makeNextNormalKeyDataObject(prevKey, normalText, shiftText);
this.keyDataList[this.keyIndex] = newKey;
this.keyIndex++;
this.keyHash[keyID] = newKey;
}
initKeyData(keyMapper) {
// row 1
this.addFunctionKeyData(
keyMapper,
"`",
Keyboard.KEYBOARD_OFFSET__POX_X,
Keyboard.ROW_1_POX_Y,
Keyboard.DEFAULT_KEY_SIZE_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
KeyButton.NORMAL_FUNCTION_KEY
);
this.addNextNormalKeyData(keyMapper, "1");
this.addNextNormalKeyData(keyMapper, "2");
this.addNextNormalKeyData(keyMapper, "3");
this.addNextNormalKeyData(keyMapper, "4");
this.addNextNormalKeyData(keyMapper, "5");
this.addNextNormalKeyData(keyMapper, "6");
this.addNextNormalKeyData(keyMapper, "7");
this.addNextNormalKeyData(keyMapper, "8");
this.addNextNormalKeyData(keyMapper, "9");
this.addNextNormalKeyData(keyMapper, "0");
this.addNextNormalKeyData(keyMapper, "-");
this.addNextNormalKeyData(keyMapper, "=");
this.addNextFunctionKeyData(
keyMapper,
"backspace",
Keyboard.BACKSPACE_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
KeyButton.RIGHT_FUNCTION_KEY
);
// row 2
this.addFunctionKeyData(
keyMapper,
"tab",
Keyboard.KEYBOARD_OFFSET__POX_X,
Keyboard.ROW_2_POX_Y,
Keyboard.TAB_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
KeyButton.LEFT_FUNCTION_KEY
);
this.addNextNormalKeyData(keyMapper, "q");
this.addNextNormalKeyData(keyMapper, "w");
this.addNextNormalKeyData(keyMapper, "e");
this.addNextNormalKeyData(keyMapper, "r");
this.addNextNormalKeyData(keyMapper, "t");
this.addNextNormalKeyData(keyMapper, "y");
this.addNextNormalKeyData(keyMapper, "u");
this.addNextNormalKeyData(keyMapper, "i");
this.addNextNormalKeyData(keyMapper, "o");
this.addNextNormalKeyData(keyMapper, "p");
this.addNextNormalKeyData(keyMapper, "[");
this.addNextNormalKeyData(keyMapper, "]");
this.addNextNormalKeyData(keyMapper, "\\");
// row 3
this.addFunctionKeyData(
keyMapper,
"caps_lock",
Keyboard.KEYBOARD_OFFSET__POX_X,
Keyboard.ROW_3_POX_Y,
Keyboard.CAPS_LOCK_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
KeyButton.LEFT_FUNCTION_KEY
);
this.addNextNormalKeyData(keyMapper, "a");
this.addNextNormalKeyData(keyMapper, "s");
this.addNextNormalKeyData(keyMapper, "d");
this.addNextNormalKeyData(keyMapper, "f");
this.addNextNormalKeyData(keyMapper, "g");
this.addNextNormalKeyData(keyMapper, "h");
this.addNextNormalKeyData(keyMapper, "j");
this.addNextNormalKeyData(keyMapper, "k");
this.addNextNormalKeyData(keyMapper, "l");
this.addNextNormalKeyData(keyMapper, ";");
this.addNextNormalKeyData(keyMapper, "'");
this.addNextFunctionKeyData(
keyMapper,
"enter",
Keyboard.ENTER_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
KeyButton.RIGHT_FUNCTION_KEY
);
// row 4
this.addFunctionKeyData(
keyMapper,
"left_shift",
Keyboard.KEYBOARD_OFFSET__POX_X,
Keyboard.ROW_4_POX_Y,
Keyboard.SHIFT_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
KeyButton.LEFT_FUNCTION_KEY
);
this.addNextNormalKeyData(keyMapper, "z");
this.addNextNormalKeyData(keyMapper, "x");
this.addNextNormalKeyData(keyMapper, "c");
this.addNextNormalKeyData(keyMapper, "v");
this.addNextNormalKeyData(keyMapper, "b");
this.addNextNormalKeyData(keyMapper, "n");
this.addNextNormalKeyData(keyMapper, "m");
this.addNextNormalKeyData(keyMapper, ",");
this.addNextNormalKeyData(keyMapper, ".");
this.addNextNormalKeyData(keyMapper, "/");
this.addNextFunctionKeyData(
keyMapper,
"right_shift",
Keyboard.SHIFT_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
KeyButton.RIGHT_FUNCTION_KEY
);
// row 5
this.addFunctionKeyData(
keyMapper,
"left_ctrl",
Keyboard.KEYBOARD_OFFSET__POX_X,
Keyboard.ROW_5_POX_Y,
Keyboard.CTRL_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
KeyButton.LEFT_FUNCTION_KEY
);
this.addNextFunctionKeyData(
keyMapper,
"window",
Keyboard.WINDOW_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
KeyButton.LEFT_FUNCTION_KEY
);
this.addNextFunctionKeyData(
keyMapper,
"left_alt",
Keyboard.ALT_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
KeyButton.LEFT_FUNCTION_KEY
);
this.addNextFunctionKeyData(
keyMapper,
"chinese",
Keyboard.CHINESE_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
KeyButton.LEFT_FUNCTION_KEY
);
this.addNextFunctionKeyData(
keyMapper,
"space",
Keyboard.SPACE_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
KeyButton.CENTER_FUNCTION_KEY
);
this.addNextFunctionKeyData(
keyMapper,
"korean_english",
Keyboard.KOREAN_ENGLISH_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
KeyButton.RIGHT_FUNCTION_KEY
);
this.addNextFunctionKeyData(
keyMapper,
"right_alt",
Keyboard.ALT_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
KeyButton.RIGHT_FUNCTION_KEY
);
this.addNextFunctionKeyData(
keyMapper,
"right_ctrl",
Keyboard.CTRL_KEY_WIDTH_PX,
Keyboard.DEFAULT_KEY_SIZE_PX,
KeyButton.RIGHT_FUNCTION_KEY
);
} }
} }
Keyboard.DEFAULT_KEY_SIZE_PX = 46; 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.TAB_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 1.5;
Keyboard.CAPS_LOCK_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 1.7; Keyboard.CAPS_LOCK_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 1.9;
Keyboard.ENTER_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.36; 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.CTRL_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 1.7;
Keyboard.WINDOW_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX; Keyboard.WINDOW_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX;
Keyboard.ALT_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 1.5; Keyboard.ALT_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 1.5;
Keyboard.CHINESE_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX; Keyboard.CHINESE_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX;
Keyboard.SPACE_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 5.84; Keyboard.SPACE_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX * 5.9;
Keyboard.KOREAN_ENGLISH_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX; Keyboard.KOREAN_ENGLISH_KEY_WIDTH_PX = Keyboard.DEFAULT_KEY_SIZE_PX;
Keyboard.KEY_GAP_PX = 6; Keyboard.KEY_GAP_PX = 6;
@@ -0,0 +1,36 @@
class KoreanKeyMapper extends KeyMapper {
constructor() {
super();
this.registerKeyTextData("q", "ㅂ", "ㅃ", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("w", "ㅈ", "ㅉ", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("e", "ㄷ", "ㄸ", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("r", "ㄱ", "ㄲ", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("t", "ㅅ", "ㅆ", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("y", "ㅛ", "ㅛ", KeyTextData.LEFT_HAND);
this.registerKeyTextData("u", "ㅕ", "ㅕ", KeyTextData.LEFT_HAND);
this.registerKeyTextData("i", "ㅑ", "ㅑ", KeyTextData.LEFT_HAND);
this.registerKeyTextData("o", "ㅐ", "ㅒ", KeyTextData.LEFT_HAND);
this.registerKeyTextData("p", "ㅔ", "ㅖ", KeyTextData.LEFT_HAND);
this.registerKeyTextData("a", "ㅁ", "ㅁ", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("s", "ㄴ", "ㄴ", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("d", "ㅇ", "ㅇ", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("f", "ㄹ", "ㄹ", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("g", "ㅎ", "ㅎ", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("h", "ㅗ", "ㅗ", KeyTextData.LEFT_HAND);
this.registerKeyTextData("j", "ㅓ", "ㅓ", KeyTextData.LEFT_HAND);
this.registerKeyTextData("k", "ㅏ", "ㅏ", KeyTextData.LEFT_HAND);
this.registerKeyTextData("l", "ㅣ", "ㅣ", KeyTextData.LEFT_HAND);
this.registerKeyTextData("z", "ㅋ", "ㅋ", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("x", "ㅌ", "ㅌ", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("c", "ㅊ", "ㅊ", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("v", "ㅍ", "ㅍ", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("b", "ㅠ", "ㅠ", KeyTextData.RIGHT_HAND);
this.registerKeyTextData("n", "ㅜ", "ㅜ", KeyTextData.LEFT_HAND);
this.registerKeyTextData("m", "ㅡ", "ㅡ", KeyTextData.LEFT_HAND);
}
}
+3
View File
@@ -51,6 +51,9 @@
<!-- Test typing : source files --> <!-- Test typing : source files -->
<script src="../../game/typing/practice/define_variables.js"></script> <script src="../../game/typing/practice/define_variables.js"></script>
<script src="../../game/typing/practice/content_progress.js"></script> <script src="../../game/typing/practice/content_progress.js"></script>
<script src="../../game/typing/practice/key_mapper.js"></script>
<script src="../../game/typing/practice/english_key_mapper.js"></script>
<script src="../../game/typing/practice/korean_key_mapper.js"></script>
<script src="../../game/typing/practice/key_button.js"></script> <script src="../../game/typing/practice/key_button.js"></script>
<script src="../../game/typing/practice/keyboard.js"></script> <script src="../../game/typing/practice/keyboard.js"></script>
<script src="../../game/typing/practice/loading.js"></script> <script src="../../game/typing/practice/loading.js"></script>
+28
View File
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Key Mapper</title>
<link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.6.0.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="https://code.jquery.com/qunit/qunit-2.6.0.js"></script>
<!--
<script src="../src/game/lib/string_util.js"></script>
<script src="../src/game/lib/date_util.js"></script>
<script src="../src/game/lib/session_storage_manager.js"></script>
<script src="../src/game/global/global_variables.js"></script>
<script src="../src/game/lib/history_record_manager.js"></script>
<script src="../src/game/lib/ranking_record_manager.js"></script>
-->
<script src="../src/game/typing/practice/key_mapper.js"></script>
<script src="../src/game/typing/practice/english_key_mapper.js"></script>
<script src="../src/game/typing/practice/korean_key_mapper.js"></script>
<script src="key_mapper.js"></script>
</body>
</html>
+69
View File
@@ -0,0 +1,69 @@
let englishKeyMapper = new EnglishKeyMapper();
let koreanKeyMapper = new KoreanKeyMapper();
QUnit.test( "getNormalText", function( assert ) {
assert.equal(englishKeyMapper.getNormalText("`"), "`", "getNormalText - `");
assert.equal(englishKeyMapper.getNormalText("/"), "/", "getNormalText - /");
assert.equal(englishKeyMapper.getNormalText("q"), "q", "getNormalText - q");
assert.equal(englishKeyMapper.getNormalText("m"), "m", "getNormalText - m");
assert.equal(koreanKeyMapper.getNormalText("q"), "ㅂ", "getNormalText - ㅂ");
assert.equal(koreanKeyMapper.getNormalText("m"), "ㅡ", "getNormalText - ㅡ");
});
QUnit.test( "getShiftText", function( assert ) {
assert.equal(englishKeyMapper.getShiftText("`"), "~", "getShiftText - ~");
assert.equal(englishKeyMapper.getShiftText("/"), "?", "getShiftText - ?");
assert.equal(englishKeyMapper.getShiftText("q"), "Q", "getShiftText - Q");
assert.equal(englishKeyMapper.getShiftText("m"), "M", "getShiftText - M");
assert.equal(koreanKeyMapper.getShiftText("q"), "ㅃ", "getShiftText - ㅃ");
assert.equal(koreanKeyMapper.getShiftText("m"), "ㅡ", "getShiftText - ㅡ");
});
QUnit.test( "getShiftHandSide", function( assert ) {
assert.equal(englishKeyMapper.getShiftHandSide("`"), KeyTextData.RIGHT_HAND, "getShiftHandSide - `");
assert.equal(englishKeyMapper.getShiftHandSide("/"), KeyTextData.LEFT_HAND, "getShiftHandSide - /");
assert.equal(englishKeyMapper.getShiftHandSide("space"), KeyTextData.BOTH_HAND, "getShiftHandSide - space");
assert.equal(englishKeyMapper.getShiftHandSide("q"), KeyTextData.RIGHT_HAND, "getShiftHandSide - q");
assert.equal(englishKeyMapper.getShiftHandSide("m"), KeyTextData.LEFT_HAND, "getShiftHandSide - m");
assert.equal(koreanKeyMapper.getShiftHandSide("q"), KeyTextData.RIGHT_HAND, "getShiftHandSide - q");
assert.equal(koreanKeyMapper.getShiftHandSide("m"), KeyTextData.LEFT_HAND, "getShiftHandSide - m");
});
QUnit.test( "getKeyIDOfText", function( assert ) {
assert.equal(englishKeyMapper.getKeyIDOfText("`"), "`", "getKeyIDOfText - `");
assert.equal(englishKeyMapper.getKeyIDOfText("~"), "`", "getKeyIDOfText - ~");
assert.equal(englishKeyMapper.getKeyIDOfText("/"), "/", "getKeyIDOfText - /");
assert.equal(englishKeyMapper.getKeyIDOfText("?"), "/", "getKeyIDOfText - ?");
assert.equal(englishKeyMapper.getKeyIDOfText("q"), "q", "getKeyIDOfText - q");
assert.equal(englishKeyMapper.getKeyIDOfText("Q"), "q", "getKeyIDOfText - Q");
assert.equal(englishKeyMapper.getKeyIDOfText("m"), "m", "getKeyIDOfText - m");
assert.equal(englishKeyMapper.getKeyIDOfText("M"), "m", "getKeyIDOfText - M");
assert.equal(koreanKeyMapper.getKeyIDOfText("ㅂ"), "q", "getKeyIDOfText - ㅂ");
assert.equal(koreanKeyMapper.getKeyIDOfText("ㅃ"), "q", "getKeyIDOfText - ㅃ");
assert.equal(koreanKeyMapper.getKeyIDOfText("ㅡ"), "m", "getKeyIDOfText - ㅡ");
});
QUnit.test( "getShiftTypeOfText", function( assert ) {
assert.equal(englishKeyMapper.getShiftTypeOfText("`"), KeyTextData.RIGHT_HAND, "getShiftHandSide - `");
assert.equal(englishKeyMapper.getShiftTypeOfText("/"), KeyTextData.LEFT_HAND, "getShiftHandSide - /");
assert.equal(englishKeyMapper.getShiftTypeOfText("q"), KeyTextData.RIGHT_HAND, "getShiftHandSide - q");
assert.equal(englishKeyMapper.getShiftTypeOfText("m"), KeyTextData.LEFT_HAND, "getShiftHandSide - m");
assert.equal(koreanKeyMapper.getShiftTypeOfText("ㅂ"), KeyTextData.RIGHT_HAND, "getShiftHandSide - ㅂ");
assert.equal(koreanKeyMapper.getShiftTypeOfText("ㅃ"), KeyTextData.RIGHT_HAND, "getShiftHandSide - ㅃ");
assert.equal(koreanKeyMapper.getShiftTypeOfText("ㅡ"), KeyTextData.LEFT_HAND, "getShiftHandSide - ㅡ");
});
View File