Add: show result after typing test
This commit is contained in:
@@ -35,7 +35,7 @@ class Result {
|
|||||||
// bottom
|
// bottom
|
||||||
let screenBottom = new ScreenBottom();
|
let screenBottom = new ScreenBottom();
|
||||||
screenBottom.makeBottomLine();
|
screenBottom.makeBottomLine();
|
||||||
screenBottom.printBottomLeftTextWithBestRecord(sessionStorageManager.bestRecord);
|
screenBottom.printBottomLeftTextWithBestRecord(Math.floor(sessionStorageManager.bestRecord));
|
||||||
screenBottom.printBottomCenterText(sessionStorageManager.playingAppKoreanName);
|
screenBottom.printBottomCenterText(sessionStorageManager.playingAppKoreanName);
|
||||||
screenBottom.printBottomRightText(sessionStorageManager.playerName);
|
screenBottom.printBottomRightText(sessionStorageManager.playerName);
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ class Result {
|
|||||||
let posY = 120;
|
let posY = 120;
|
||||||
if(sessionStorageManager.record === null)
|
if(sessionStorageManager.record === null)
|
||||||
sessionStorageManager.record = 0;
|
sessionStorageManager.record = 0;
|
||||||
let record = NumberUtil.numberWithCommas(sessionStorageManager.record);
|
let record = NumberUtil.numberWithCommas(Math.floor(sessionStorageManager.record));
|
||||||
style.font = "bold 80px Arial";
|
style.font = "bold 80px Arial";
|
||||||
game.add.text(0, 0, record, style)
|
game.add.text(0, 0, record, style)
|
||||||
.setTextBounds(0, posY, game.world.width, 60)
|
.setTextBounds(0, posY, game.world.width, 60)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Test {
|
|||||||
this.initTypingData();
|
this.initTypingData();
|
||||||
sessionStorageManager.isNewBestRecrd = false;
|
sessionStorageManager.isNewBestRecrd = false;
|
||||||
|
|
||||||
this.game.stage.backgroundColor = '#4d4d4d';
|
game.stage.backgroundColor = '#4d4d4d';
|
||||||
|
|
||||||
// top
|
// top
|
||||||
let backButton = new BackButton( () => {
|
let backButton = new BackButton( () => {
|
||||||
@@ -20,12 +20,7 @@ class Test {
|
|||||||
this.averageTypingSpeedText = new AverageTypingSpeed();
|
this.averageTypingSpeedText = new AverageTypingSpeed();
|
||||||
this.contentProgressText = new ContentProgress();
|
this.contentProgressText = new ContentProgress();
|
||||||
|
|
||||||
// var scoreboardAreaPositionY = 2;
|
let fullscreenButton = new FullscreenButton(game);
|
||||||
// this.textPlayingWordNumber = game.add.text(900, scoreboardAreaPositionY, "0", textStyleBasic)
|
|
||||||
// .setTextBounds(0, 0, 300, 80)
|
|
||||||
// .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
|
||||||
|
|
||||||
let fullscreenButton = new FullscreenButton(this.game);
|
|
||||||
|
|
||||||
|
|
||||||
// typing content
|
// typing content
|
||||||
@@ -77,7 +72,7 @@ class Test {
|
|||||||
|
|
||||||
|
|
||||||
// input text
|
// input text
|
||||||
this.inputTextContent = new InputTypeText(this.game.world.centerX, typingAreaPositionY + 360);
|
this.inputTextContent = new InputTypeText(game.world.centerX, typingAreaPositionY + 360);
|
||||||
this.inputTextContent.anchor.set(0.5);
|
this.inputTextContent.anchor.set(0.5);
|
||||||
this.inputTextContent.canvasInput.value('');
|
this.inputTextContent.canvasInput.value('');
|
||||||
this.inputTextContent.canvasInput.focus();
|
this.inputTextContent.canvasInput.focus();
|
||||||
@@ -132,7 +127,7 @@ class Test {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
startGame() {
|
startGame() {
|
||||||
this.initStage();
|
this.averageTypingSpeedText.print(0);
|
||||||
|
|
||||||
this.showTypingTestContents();
|
this.showTypingTestContents();
|
||||||
this.showPlayingWordNumber();
|
this.showPlayingWordNumber();
|
||||||
@@ -145,6 +140,10 @@ class Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
goResult() {
|
goResult() {
|
||||||
|
sessionStorageManager.record = this.typingRecordTotal;
|
||||||
|
if(sessionStorageManager.record > sessionStorageManager.bestRecord)
|
||||||
|
sessionStorageManager.bestRecord = sessionStorageManager.record;
|
||||||
|
|
||||||
location.href = '../../web/client/result.html';
|
location.href = '../../web/client/result.html';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,12 +162,9 @@ class Test {
|
|||||||
this.timeTypingEnd = 0;
|
this.timeTypingEnd = 0;
|
||||||
|
|
||||||
this.typingLetterCountTotal = 0;
|
this.typingLetterCountTotal = 0;
|
||||||
|
this.typingRecordTotal = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
initStage() {
|
|
||||||
// this.textBestRecord.text = Math.floor(sessionStorageManager.bestRecord);
|
|
||||||
this.averageTypingSpeedText.print(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
getTypingTestContents() {
|
getTypingTestContents() {
|
||||||
var typingTestContents = this.loadTestContent();
|
var typingTestContents = this.loadTestContent();
|
||||||
@@ -255,7 +251,8 @@ class Test {
|
|||||||
this.playNextContent();
|
this.playNextContent();
|
||||||
|
|
||||||
if(this.typingIndex == this.wordCountForStage)
|
if(this.typingIndex == this.wordCountForStage)
|
||||||
this.state.start('TypingTestResult');
|
this.goResult();
|
||||||
|
// this.state.start('TypingTestResult');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -295,7 +292,7 @@ class Test {
|
|||||||
// console.log('입력 단어 : ' + this.typingRandomContents[this.typingIndex]);
|
// console.log('입력 단어 : ' + this.typingRandomContents[this.typingIndex]);
|
||||||
|
|
||||||
this.isTyping = false;
|
this.isTyping = false;
|
||||||
this.timeTypingEnd = this.game.time.elapsedSince(0);
|
this.timeTypingEnd = game.time.elapsedSince(0);
|
||||||
// console.log('this.timeTypingEnd : ' + this.timeTypingEnd);
|
// console.log('this.timeTypingEnd : ' + this.timeTypingEnd);
|
||||||
|
|
||||||
var elapsedTimeMS = this.timeTypingEnd - this.timeTypingStart;
|
var elapsedTimeMS = this.timeTypingEnd - this.timeTypingStart;
|
||||||
@@ -317,12 +314,13 @@ class Test {
|
|||||||
// console.log('i : ' + i + ' - time : ' + this.typingElapsedTime[i]);
|
// console.log('i : ' + i + ' - time : ' + this.typingElapsedTime[i]);
|
||||||
typingElapsedTimeTotal += this.typingElapsedTime[i];
|
typingElapsedTimeTotal += this.typingElapsedTime[i];
|
||||||
}
|
}
|
||||||
let typingRecordTotal = this.typingLetterCountTotal * 60000 / typingElapsedTimeTotal;
|
this.typingRecordTotal = this.typingLetterCountTotal * 60000 / typingElapsedTimeTotal;
|
||||||
console.log(this.typingLetterCountTotal);
|
// console.log(this.typingLetterCountTotal);
|
||||||
console.log(typingElapsedTimeTotal);
|
// console.log(typingElapsedTimeTotal);
|
||||||
console.log(typingRecordTotal);
|
// console.log(typingRecordTotal);
|
||||||
|
|
||||||
// this.textTypingRecordTotal.text = Math.floor(typingRecordTotal);
|
// this.textTypingRecordTotal.text = Math.floor(typingRecordTotal);
|
||||||
this.averageTypingSpeedText.print(Math.floor(typingRecordTotal));
|
this.averageTypingSpeedText.print(Math.floor(this.typingRecordTotal));
|
||||||
// console.log('-------------- total --------------');
|
// console.log('-------------- total --------------');
|
||||||
// console.log('typingLetterCountTotal : ' + this.typingLetterCountTotal);
|
// console.log('typingLetterCountTotal : ' + this.typingLetterCountTotal);
|
||||||
// console.log('typingElapsedTimeTotal : ' + typingElapsedTimeTotal);
|
// console.log('typingElapsedTimeTotal : ' + typingElapsedTimeTotal);
|
||||||
@@ -338,12 +336,11 @@ class Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
showPlayingWordNumber() {
|
showPlayingWordNumber() {
|
||||||
// this.textPlayingWordNumber.text = (this.typingIndex + 1) + " / " + this.wordCountForStage;
|
|
||||||
this.contentProgressText.print(this.typingIndex + 1, this.wordCountForStage);
|
this.contentProgressText.print(this.typingIndex + 1, this.wordCountForStage);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeTypingStart() {
|
setTimeTypingStart() {
|
||||||
this.timeTypingStart = this.game.time.elapsedSince(0);
|
this.timeTypingStart = game.time.elapsedSince(0);
|
||||||
var timeGap = this.timeTypingStart - this.timeTypingEnd;
|
var timeGap = this.timeTypingStart - this.timeTypingEnd;
|
||||||
|
|
||||||
if(timeGap < 50)
|
if(timeGap < 50)
|
||||||
|
|||||||
Reference in New Issue
Block a user