Fix: reduce score not reset in typing practice
This commit is contained in:
@@ -157,7 +157,7 @@ var TypingPractice = {
|
||||
},
|
||||
|
||||
goResult: function() {
|
||||
sessionStorageManager.setRecord(this.typingScore.score());
|
||||
sessionStorageManager.setRecord(this.typingScore.getScore());
|
||||
|
||||
location.href = '../../web/client/result.html';
|
||||
},
|
||||
@@ -365,8 +365,15 @@ var TypingPractice = {
|
||||
var typingContent = this.typingRandomContents[this.typingIndex];
|
||||
|
||||
if(this.isKeyPressed(inputContent, typingContent)) {
|
||||
this.typingScore.increase();
|
||||
var animalLevelID = Animal.animalLevelIDByRecord(this.typingScore.score(), Animal.TYPE_PRACTICE);
|
||||
var plusScore = 1;
|
||||
this.typingScore.add(plusScore);
|
||||
var scoreText = new ScoreText(
|
||||
game.world.centerX,
|
||||
TypingContentBG.POS_Y_CONTENT_BOX_TYPING_PRACTICE,
|
||||
plusScore
|
||||
);
|
||||
|
||||
var animalLevelID = Animal.animalLevelIDByRecord(this.typingScore.getScore(), Animal.TYPE_PRACTICE);
|
||||
// console.log(animalLevelID);
|
||||
// console.log(this.playingAnimalIndex);
|
||||
if(animalLevelID > this.playingAnimalIndex) {
|
||||
@@ -382,7 +389,17 @@ var TypingPractice = {
|
||||
} else {
|
||||
if(this.playingAnimalIndex > 0)
|
||||
this.playingAnimalIndex--;
|
||||
var prevScore = this.typingScore.getScore();
|
||||
this.typingScore.set(Animal.getAnimalPracticeTypingCount(this.playingAnimalIndex));
|
||||
var presentScore = this.typingScore.getScore();
|
||||
|
||||
if(presentScore - prevScore < 0) {
|
||||
var scoreText = new ScoreText(
|
||||
game.world.centerX,
|
||||
TypingContentBG.POS_Y_CONTENT_BOX_TYPING_PRACTICE,
|
||||
presentScore - prevScore
|
||||
);
|
||||
}
|
||||
|
||||
this.animalList.activate(this.playingAnimalIndex);
|
||||
this.animalList.tweenAnimation(Animal.ANIMATION_TYPE_DAMAGE);
|
||||
|
||||
Reference in New Issue
Block a user