diff --git a/src/game/typing/practice/game.js b/src/game/typing/practice/game.js index 7ce8caa..05fd4af 100644 --- a/src/game/typing/practice/game.js +++ b/src/game/typing/practice/game.js @@ -263,7 +263,6 @@ class TypingPractice { this.typingIndex++; this.showTypingPracticeContents(); this.showPlayingWordNumber(); - // this.resetTypingContent(); } showPlayingWordNumber() { @@ -273,13 +272,13 @@ class TypingPractice { } -TypingPractice.TYPING_CONTENT_PREVIEW_COUNT = 3; -TypingPractice.TYPING_CONTENT_DONE_COUNT = 3; -TypingPractice.TYPING_COUNT_PLUS_ENTER = 1; +TypingPractice.TYPING_CONTENT_PREVIEW_COUNT = 3; +TypingPractice.TYPING_CONTENT_DONE_COUNT = 3; +TypingPractice.TYPING_COUNT_PLUS_ENTER = 1; -TypingPractice.OFFSET_RIGHT_ALIGN = 10; +TypingPractice.OFFSET_RIGHT_ALIGN = 10; -TypingPractice.WORD_COUNT_FOR_STAGE = 10; +TypingPractice.WORD_COUNT_FOR_STAGE = 10; TypingPractice.COLOR_CONTENT_WRONG = "#aaaaaa"; TypingPractice.COLOR_CONTENT_RIGHT = "#ffff4d"; \ No newline at end of file diff --git a/src/game/typing/test/game.js b/src/game/typing/test/game.js index a0b19c5..b2a6754 100644 --- a/src/game/typing/test/game.js +++ b/src/game/typing/test/game.js @@ -149,15 +149,21 @@ class TypingTest { } initTypingData() { - this.typingContents = this.getTypingTestContents(); - let randomContents = Phaser.ArrayUtils.shuffle(this.typingContents); - this.wordCountForStage = TypingTest.WORD_COUNT_FOR_STAGE; + let typingTextMan = new TypingTextManager(); + + let typingPracticeContents = this.getTypingTestContents(); + // console.log(typingPracticeContents); + typingTextMan.makeTestContents(typingPracticeContents); + let wordCountForStage = TypingTest.WORD_COUNT_FOR_STAGE; if(isDebugMode()) - this.wordCountForStage = 3; - this.typingRandomContents = randomContents.slice(1, this.wordCountForStage + 1); // start Num, end Num (not index) - this.typingContentLength = this.typingContents.length; + wordCountForStage = 3; + typingTextMan.slice(0, wordCountForStage); + this.typingRandomContents = typingTextMan.getContents(); + // console.log(this.typingRandomContents); + this.typingContentLength = this.typingRandomContents.length; this.typingIndex = 0; + this.isTyping = false; this.timeTypingStart = 0; this.timeTypingEnd = 0; @@ -264,7 +270,7 @@ class TypingTest { } } - if(this.typingIndex == this.wordCountForStage) { + if(this.typingIndex == this.typingContentLength) { this.textTypingContent.text = ""; return; } @@ -296,7 +302,7 @@ class TypingTest { this.calculateTypingRecord(typingContent); this.playNextContent(); - if(this.typingIndex == this.wordCountForStage) + if(this.typingIndex == this.typingContentLength) this.goResult(); // this.state.start('TypingTestResult'); } @@ -381,7 +387,7 @@ class TypingTest { } showPlayingWordNumber() { - this.contentProgressText.print(this.typingIndex + 1, this.wordCountForStage); + this.contentProgressText.print(this.typingIndex + 1, this.typingContentLength); } setTimeTypingStart() { @@ -402,16 +408,12 @@ class TypingTest { TypingTest.TYPING_CONTENT_PREVIEW_COUNT = 3; -TypingTest.TYPING_CONTENT_DONE_COUNT = 3; +TypingTest.TYPING_CONTENT_DONE_COUNT = 3; TypingTest.TYPING_COUNT_PLUS_ENTER = 1; -TypingTest.OFFSET_RIGHT_ALIGN = 10; +TypingTest.OFFSET_RIGHT_ALIGN = 10; TypingTest.WORD_COUNT_FOR_STAGE = 10; -// if(isDebugMode()) -// WORD_COUNT_FOR_STAGE = 3; TypingTest.COLOR_CONTENT_WRONG = "#aaaaaa"; -TypingTest.COLOR_CONTENT_RIGHT = "#ffff4d"; - - +TypingTest.COLOR_CONTENT_RIGHT = "#ffff4d"; \ No newline at end of file