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
+18 -16
View File
@@ -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";