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
+36 -24
View File
@@ -25,55 +25,67 @@ class TypingTest {
// typing content
let typingAreaPositionY = 260;
let bar = game.add.graphics();
bar.beginFill(0x000000, 0.2);
bar.drawRect(0, typingAreaPositionY, GAME_SCREEN_SIZE.x, 120);
let typingContentBG = new TypingContentBG();
typingContentBG.makeTestContentBG();
let TYPING_CONTENT_Y = 320;
if(isTypingWordStage())
textStyleBasic.font = "bold 84px Arial";
else // Sentence stage
textStyleBasic.font = "bold 48px Arial";
this.textTypingContent = game.add.text(0, 2, "test", textStyleBasic)
.setTextBounds(0, typingAreaPositionY, GAME_SCREEN_SIZE.x, 120)
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
.addColor(TypingTest.COLOR_CONTENT_WRONG, 0);
this.textTypingContent = game.add.text(
game.world.centerX, TYPING_CONTENT_Y,
"", textStyleBasic
)
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
.addColor(TypingTest.COLOR_CONTENT_INPUT, 0);
this.textTypingContent.anchor.set(0.5);
let TYPING_OFFSET_Y = 100;
textStyleBasic.font = "32px Arial";
let textDoneColor = [ '#99994d', '#77774d', '#66664d' ];
this.textTypingContentsDone = [];
this.textTypingRecordsDone = [];
for(let i = 0; i < TypingTest.TYPING_CONTENT_DONE_COUNT; i++) {
this.textTypingContentsDone[i] = game.add.text(0, 2, "test", textStyleBasic)
.setTextBounds(0, typingAreaPositionY - 50 - i * 50, GAME_SCREEN_SIZE.x, 40)
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
this.textTypingContentsDone[i] = game.add.text(
game.world.centerX, TYPING_CONTENT_Y - TYPING_OFFSET_Y - i * 50,
"", textStyleBasic
)
// .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
.addColor(textDoneColor[i], 0);
this.textTypingContentsDone[i].anchor.set(0.5);
let scorePositionX = 780;
let SCORE_POSITION_X = 900;
if(isTypingWordStage())
scorePositionX = 600;
SCORE_POSITION_X = 700;
this.textTypingRecordsDone[i] = game.add.text(0, 2, "", textStyleBasic)
.setTextBounds(scorePositionX, typingAreaPositionY - 50 - i * 50, 200, 40)
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
this.textTypingRecordsDone[i] = game.add.text(
SCORE_POSITION_X, TYPING_CONTENT_Y - TYPING_OFFSET_Y - i * 50,
"", textStyleBasic
)
// .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
.addColor(textDoneColor[i], 0);
this.textTypingRecordsDone[i].anchor.set(0.5);
}
let textPreviewColor = [ '#999999', '#888888', '#777777' ];
this.textTypingContentPreview = [];
for(let i = 0; i < TypingTest.TYPING_CONTENT_PREVIEW_COUNT; i++) {
this.textTypingContentPreview[i] = game.add.text(0, 2, "test", textStyleBasic)
.setTextBounds(0, typingAreaPositionY + 130 + i * 50, GAME_SCREEN_SIZE.x, 40)
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
this.textTypingContentPreview[i] = game.add.text(
game.world.centerX, TYPING_CONTENT_Y + TYPING_OFFSET_Y + i * 50,
"", textStyleBasic
)
// .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
.addColor(textPreviewColor[i], 0);
this.textTypingContentPreview[i].anchor.set(0.5);
}
// input text
this.inputTextContent = new InputTypeText(game.world.centerX, typingAreaPositionY + 360);
this.inputTextContent = new InputTypeText(game.world.centerX, TYPING_CONTENT_Y + 260);
this.inputTextContent.anchor.set(0.5);
this.inputTextContent.canvasInput.value('');
this.inputTextContent.canvasInput.focus();
@@ -288,7 +300,7 @@ class TypingTest {
resetTypingContent() {
this.textTypingContent.clearColors();
this.textTypingContent.addColor(TypingTest.COLOR_CONTENT_WRONG, 0);
this.textTypingContent.addColor(TypingTest.COLOR_CONTENT_INPUT, 0);
this.inputTextContent.canvasInput.value('');
}
@@ -334,7 +346,7 @@ class TypingTest {
// console.log("inputContent.charAt(i) : " + inputContent.charAt(i));
if(typingContent.charAt(i) != inputContent.charAt(i)) {
this.textTypingContent.addColor(TypingTest.COLOR_CONTENT_WRONG, i);
this.textTypingContent.addColor(TypingTest.COLOR_CONTENT_INPUT, i);
return;
}
}
@@ -415,5 +427,5 @@ TypingTest.OFFSET_RIGHT_ALIGN = 10;
TypingTest.WORD_COUNT_FOR_STAGE = 10;
TypingTest.COLOR_CONTENT_WRONG = "#aaaaaa";
TypingTest.COLOR_CONTENT_INPUT = "#dddddd";
TypingTest.COLOR_CONTENT_RIGHT = "#ffff4d";