Fix: remove setTextBound for keybutton

Fix: word practice text
Fix: move keyboard, hands position
Fix: typing content bg
This commit is contained in:
2018-08-23 14:35:45 +09:00
parent c7641ee2b4
commit 9963a28d17
8 changed files with 182 additions and 90 deletions
+52 -36
View File
@@ -25,32 +25,41 @@ class TypingPractice {
// typing content
let typingAreaPositionY = 140;
let bar = game.add.graphics();
bar.beginFill(0x000000, 0.2);
bar.drawRect(0, typingAreaPositionY, GAME_SCREEN_SIZE.x, 120);
let typingContentBG = new TypingContentBG();
typingContentBG.makePracticeContentBG();
let TYPING_CONTENT_Y = 200;
textStyleBasic.font = "bold 84px Arial";
this.textTypingContent = game.add.text(game.world.centerX, TYPING_CONTENT_Y, "", textStyleBasic)
.setShadow(3, 3, 'rgba(0, 0, 0, 1)', 2)
.addColor(TypingPractice.COLOR_CONTENT_INPUT, 0);
this.textTypingContent.anchor.set(0.5);
this.textTypingContent = game.add.text(0, 2, "test", textStyleBasic)
.setTextBounds(0, typingAreaPositionY, GAME_SCREEN_SIZE.x, 120)
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_CONTENT_WRONG, 0);
.addColor(TypingPractice.COLOR_BRACKET, 0);
this.textTypingBracket.anchor.set(0.5);
textStyleBasic.font = "32px Arial";
// textStyleBasic.font = "32px Arial";
let OFFSET_WORD_X = 70;
let textDoneColor = [ '#99994d', '#77774d', '#66664d' ];
this.textTypingContentsDone = game.add.text(0, 2, "test", textStyleBasic)
.setTextBounds(0, typingAreaPositionY - 50, GAME_SCREEN_SIZE.x, 40)
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
.addColor(textDoneColor[0], 0);
let textPreviewColor = [ '#999999', '#888888', '#777777' ];
this.textTypingContentPreview = game.add.text(0, 2, "test", textStyleBasic)
.setTextBounds(0, typingAreaPositionY + 130, GAME_SCREEN_SIZE.x, 40)
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
.addColor(textPreviewColor[0], 0);
this.textTypingContentsDone = [];
for(let i = 0; i < TypingPractice.TYPING_CONTENT_DONE_COUNT; i++) {
this.textTypingContentsDone[i] = game.add.text(game.world.centerX - 200 - i * OFFSET_WORD_X, TYPING_CONTENT_Y, "", textStyleBasic)
.addColor(textDoneColor[0], 0);
this.textTypingContentsDone[i].anchor.set(0.5);
}
let textPreviewColor = [ '#666666', '#888888', '#777777' ];
this.textTypingContentPreview = [];
for(let i = 0; i < TypingPractice.TYPING_CONTENT_PREVIEW_COUNT; i++) {
this.textTypingContentPreview[i] = game.add.text(game.world.centerX + 200 + i * OFFSET_WORD_X, TYPING_CONTENT_Y, "", textStyleBasic)
.addColor(textPreviewColor[0], 0);
this.textTypingContentPreview[i].anchor.set(0.5);
}
// keyboard
this.keyMapper = new KeyMapper();
@@ -97,6 +106,12 @@ class TypingPractice {
}
goResult() {
for(let i = 0; i < TypingPractice.TYPING_CONTENT_DONE_COUNT; i++) {
this.textTypingContentsDone[i].text = "";
}
this.textTypingBracket.text = "";
this.textTypingContent.clearColors();
this.textTypingContent.addColor(TypingPractice.COLOR_CONTENT_RIGHT, 0);
this.textTypingContent.text = "= 연습 끝 =";
@@ -217,29 +232,29 @@ class TypingPractice {
}
showTypingPracticeContents() {
// done
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[i].text = "";
} else {
this.textTypingContentsDone[i].text = this.typingRandomContents[doneIndex];
}
}
if(this.typingIndex === this.typingContentLength) {
if(this.typingIndex == this.typingContentLength) {
this.textTypingContent.text = "";
return;
}
this.textTypingContent.text = this.typingRandomContents[this.typingIndex];
// typing
let typingText = this.typingRandomContents[this.typingIndex];
this.textTypingContent.text = typingText;
// preview
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[i].text = this.typingRandomContents[previewIndex];
else
this.textTypingContentPreview[i].text = "";
}
}
hideHighlightKey() {
@@ -349,5 +364,6 @@ TypingPractice.OFFSET_RIGHT_ALIGN = 10;
TypingPractice.WORD_COUNT_FOR_STAGE = 10;
TypingPractice.COLOR_CONTENT_WRONG = "#aaaaaa";
TypingPractice.COLOR_CONTENT_INPUT = "#dddddd";
TypingPractice.COLOR_BRACKET = "#dddd70";
TypingPractice.COLOR_CONTENT_RIGHT = "#ffff4d";