Fix: apply TypingTextManager to typing test

This commit is contained in:
2018-06-19 13:23:41 +09:00
parent 564870e8b4
commit e49d9d3e3b
2 changed files with 23 additions and 22 deletions
+5 -6
View File
@@ -263,7 +263,6 @@ class TypingPractice {
this.typingIndex++; this.typingIndex++;
this.showTypingPracticeContents(); this.showTypingPracticeContents();
this.showPlayingWordNumber(); this.showPlayingWordNumber();
// this.resetTypingContent();
} }
showPlayingWordNumber() { showPlayingWordNumber() {
@@ -273,13 +272,13 @@ class TypingPractice {
} }
TypingPractice.TYPING_CONTENT_PREVIEW_COUNT = 3; TypingPractice.TYPING_CONTENT_PREVIEW_COUNT = 3;
TypingPractice.TYPING_CONTENT_DONE_COUNT = 3; TypingPractice.TYPING_CONTENT_DONE_COUNT = 3;
TypingPractice.TYPING_COUNT_PLUS_ENTER = 1; 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_WRONG = "#aaaaaa";
TypingPractice.COLOR_CONTENT_RIGHT = "#ffff4d"; TypingPractice.COLOR_CONTENT_RIGHT = "#ffff4d";
+17 -15
View File
@@ -149,15 +149,21 @@ class TypingTest {
} }
initTypingData() { initTypingData() {
this.typingContents = this.getTypingTestContents(); let typingTextMan = new TypingTextManager();
let randomContents = Phaser.ArrayUtils.shuffle(this.typingContents);
this.wordCountForStage = TypingTest.WORD_COUNT_FOR_STAGE; let typingPracticeContents = this.getTypingTestContents();
// console.log(typingPracticeContents);
typingTextMan.makeTestContents(typingPracticeContents);
let wordCountForStage = TypingTest.WORD_COUNT_FOR_STAGE;
if(isDebugMode()) if(isDebugMode())
this.wordCountForStage = 3; wordCountForStage = 3;
this.typingRandomContents = randomContents.slice(1, this.wordCountForStage + 1); // start Num, end Num (not index) typingTextMan.slice(0, wordCountForStage);
this.typingContentLength = this.typingContents.length; this.typingRandomContents = typingTextMan.getContents();
// console.log(this.typingRandomContents);
this.typingContentLength = this.typingRandomContents.length;
this.typingIndex = 0; this.typingIndex = 0;
this.isTyping = false; this.isTyping = false;
this.timeTypingStart = 0; this.timeTypingStart = 0;
this.timeTypingEnd = 0; this.timeTypingEnd = 0;
@@ -264,7 +270,7 @@ class TypingTest {
} }
} }
if(this.typingIndex == this.wordCountForStage) { if(this.typingIndex == this.typingContentLength) {
this.textTypingContent.text = ""; this.textTypingContent.text = "";
return; return;
} }
@@ -296,7 +302,7 @@ class TypingTest {
this.calculateTypingRecord(typingContent); this.calculateTypingRecord(typingContent);
this.playNextContent(); this.playNextContent();
if(this.typingIndex == this.wordCountForStage) if(this.typingIndex == this.typingContentLength)
this.goResult(); this.goResult();
// this.state.start('TypingTestResult'); // this.state.start('TypingTestResult');
} }
@@ -381,7 +387,7 @@ class TypingTest {
} }
showPlayingWordNumber() { showPlayingWordNumber() {
this.contentProgressText.print(this.typingIndex + 1, this.wordCountForStage); this.contentProgressText.print(this.typingIndex + 1, this.typingContentLength);
} }
setTimeTypingStart() { setTimeTypingStart() {
@@ -402,16 +408,12 @@ class TypingTest {
TypingTest.TYPING_CONTENT_PREVIEW_COUNT = 3; 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.TYPING_COUNT_PLUS_ENTER = 1;
TypingTest.OFFSET_RIGHT_ALIGN = 10; TypingTest.OFFSET_RIGHT_ALIGN = 10;
TypingTest.WORD_COUNT_FOR_STAGE = 10; TypingTest.WORD_COUNT_FOR_STAGE = 10;
// if(isDebugMode())
// WORD_COUNT_FOR_STAGE = 3;
TypingTest.COLOR_CONTENT_WRONG = "#aaaaaa"; TypingTest.COLOR_CONTENT_WRONG = "#aaaaaa";
TypingTest.COLOR_CONTENT_RIGHT = "#ffff4d"; TypingTest.COLOR_CONTENT_RIGHT = "#ffff4d";