Fix: reduce score not reset in typing practice
This commit is contained in:
@@ -2,65 +2,69 @@ function TypingContentBG() {
|
||||
}
|
||||
|
||||
TypingContentBG.prototype.makePracticeContentBG = function() {
|
||||
var CONTENT_Y = 140;
|
||||
var contentY = TypingContentBG.POS_Y_CONTENT_BOX_TYPING_PRACTICE;
|
||||
|
||||
var bar = game.add.graphics();
|
||||
if(isKoreanTypingApp()) {
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y, GAME_SCREEN_SIZE.x, 120);
|
||||
bar.drawRect(0, contentY, GAME_SCREEN_SIZE.x, 120);
|
||||
} else {
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y, GAME_SCREEN_SIZE.x, 40);
|
||||
bar.drawRect(0, contentY, GAME_SCREEN_SIZE.x, 40);
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_ALPHABET_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y + 40, GAME_SCREEN_SIZE.x, 50);
|
||||
bar.drawRect(0, contentY + 40, GAME_SCREEN_SIZE.x, 50);
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y + 90, GAME_SCREEN_SIZE.x, 30);
|
||||
bar.drawRect(0, contentY + 90, GAME_SCREEN_SIZE.x, 30);
|
||||
}
|
||||
}
|
||||
|
||||
TypingContentBG.prototype.makeTestContentBG = function() {
|
||||
var CONTENT_Y = 260;
|
||||
var contentY = TypingContentBG.POS_Y_CONTENT_BOX_TYPING_TEST;
|
||||
|
||||
var bar = game.add.graphics();
|
||||
if(isKoreanTypingApp()) {
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y, GAME_SCREEN_SIZE.x, 120);
|
||||
bar.drawRect(0, contentY, GAME_SCREEN_SIZE.x, 120);
|
||||
} else {
|
||||
if(isTypingSentenceApp()) {
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y, GAME_SCREEN_SIZE.x, 46);
|
||||
bar.drawRect(0, contentY, GAME_SCREEN_SIZE.x, 46);
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_ALPHABET_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y + 46, GAME_SCREEN_SIZE.x, 30);
|
||||
bar.drawRect(0, contentY + 46, GAME_SCREEN_SIZE.x, 30);
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y + 76, GAME_SCREEN_SIZE.x, 44);
|
||||
bar.drawRect(0, contentY + 76, GAME_SCREEN_SIZE.x, 44);
|
||||
} else {
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y, GAME_SCREEN_SIZE.x, 40);
|
||||
bar.drawRect(0, contentY, GAME_SCREEN_SIZE.x, 40);
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_ALPHABET_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y + 40, GAME_SCREEN_SIZE.x, 50);
|
||||
bar.drawRect(0, contentY + 40, GAME_SCREEN_SIZE.x, 50);
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y + 90, GAME_SCREEN_SIZE.x, 30);
|
||||
bar.drawRect(0, contentY + 90, GAME_SCREEN_SIZE.x, 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TypingContentBG.prototype.makeWhacAMoleContentBG = function() {
|
||||
var CONTENT_Y = 200;
|
||||
var contentY = TypingContentBG.POS_Y_CONTENT_BOX_TYPING_WHACAMOLE;
|
||||
|
||||
var bar = game.add.graphics();
|
||||
if(isKoreanTypingApp()) {
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y, GAME_SCREEN_SIZE.x, 120);
|
||||
bar.drawRect(0, contentY, GAME_SCREEN_SIZE.x, 120);
|
||||
} else {
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y, GAME_SCREEN_SIZE.x, 40);
|
||||
bar.drawRect(0, contentY, GAME_SCREEN_SIZE.x, 40);
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_ALPHABET_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y + 40, GAME_SCREEN_SIZE.x, 50);
|
||||
bar.drawRect(0, contentY + 40, GAME_SCREEN_SIZE.x, 50);
|
||||
bar.beginFill(TypingContentBG.COLOR_CONTENT_BG, 1);
|
||||
bar.drawRect(0, CONTENT_Y + 90, GAME_SCREEN_SIZE.x, 30);
|
||||
bar.drawRect(0, contentY + 90, GAME_SCREEN_SIZE.x, 30);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TypingContentBG.COLOR_CONTENT_BG = 0x444444;
|
||||
TypingContentBG.COLOR_CONTENT_ALPHABET_BG = 0x3d3d3d;
|
||||
TypingContentBG.COLOR_CONTENT_ALPHABET_BG = 0x3d3d3d;
|
||||
|
||||
TypingContentBG.POS_Y_CONTENT_BOX_TYPING_PRACTICE = 140;
|
||||
TypingContentBG.POS_Y_CONTENT_BOX_TYPING_TEST = 260;
|
||||
TypingContentBG.POS_Y_CONTENT_BOX_TYPING_WHACAMOLE = 200;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function TypingScore() {
|
||||
this.typingCount = 0;
|
||||
this.score = 0;
|
||||
|
||||
var fontStyle = TypingScore.DEFAULT_TEXT_FONT;
|
||||
|
||||
@@ -24,36 +24,36 @@ function TypingScore() {
|
||||
// this.scoreText.strokeThickness = 3;
|
||||
};
|
||||
|
||||
TypingScore.prototype.score = function() {
|
||||
return this.typingCount;
|
||||
TypingScore.prototype.getScore = function() {
|
||||
return this.score;
|
||||
}
|
||||
|
||||
TypingScore.prototype.increase = function() {
|
||||
this.typingCount++;
|
||||
this.print(this.typingCount);
|
||||
TypingScore.prototype.add = function(value) {
|
||||
this.score += value;
|
||||
this.print(this.score);
|
||||
}
|
||||
|
||||
TypingScore.prototype.reset = function() {
|
||||
this.typingCount = 0;
|
||||
this.print(this.typingCount);
|
||||
this.score = 0;
|
||||
this.print(this.score);
|
||||
}
|
||||
|
||||
TypingScore.prototype.set = function(score) {
|
||||
this.typingCount = score;
|
||||
this.print(this.typingCount);
|
||||
this.score = score;
|
||||
this.print(this.score);
|
||||
}
|
||||
|
||||
TypingScore.prototype.print = function(typingCount) {
|
||||
this.scoreText.text = typingCount;
|
||||
TypingScore.prototype.print = function(score) {
|
||||
this.scoreText.text = score;
|
||||
}
|
||||
|
||||
|
||||
TypingScore.SCORE_POS_Y = 35;
|
||||
|
||||
TypingScore.DEFAULT_TEXT_FONT = {
|
||||
font: "38px Arial",
|
||||
align: "center",
|
||||
boundsAlignH: "center", // left, center. right
|
||||
boundsAlignV: "middle", // top, middle, bottom
|
||||
fill: "#fff"
|
||||
font: "38px Arial",
|
||||
align: "center",
|
||||
boundsAlignH: "center", // left, center. right
|
||||
boundsAlignV: "middle", // top, middle, bottom
|
||||
fill: "#fff"
|
||||
};
|
||||
@@ -35,7 +35,6 @@ var englishSentenceList = [
|
||||
"Nobody's perfect.",
|
||||
"Negligence is a crime.",
|
||||
"Nothing is impossible to a willing heart.",
|
||||
"Never put off till tomorrow what you can do today.",
|
||||
"Never shoot, never hit.",
|
||||
"Never judge by appearance.",
|
||||
"Of a compliment only a third is meant.",
|
||||
|
||||
@@ -16,7 +16,6 @@ var koreanSentenceList = [
|
||||
"구르는 돌에는 이끼가 끼지 않는다.",
|
||||
"구슬이 서 말이라도 꿰어야 보배",
|
||||
"굴러 온 돌이 박힌 돌 뺀다.",
|
||||
"길이 아니면 가지 말고 말이 아니면 듣지 말라.",
|
||||
"까마귀 날자 배 떨어진다.",
|
||||
"낮 말은 새가 듣고 밤 말은 쥐가 듣는다.",
|
||||
"늦게 배운 도둑질이 날 새는 줄 모른다.",
|
||||
@@ -27,7 +26,6 @@ var koreanSentenceList = [
|
||||
"도둑을 맞으려면 개도 안 짖는다.",
|
||||
"도둑이 제 발 저린다.",
|
||||
"돌다리도 두들겨 보고 건너라.",
|
||||
"떡 줄 사람은 생각도 않는데 김칫국부터 마신다.",
|
||||
"똥 묻은 개가 겨 묻은 개 나무란다.",
|
||||
"똥이 무서워서 피하나 더러워서 피하지.",
|
||||
"뛰는 놈 위에 나는 놈 있다.",
|
||||
@@ -35,7 +33,7 @@ var koreanSentenceList = [
|
||||
"못된 송아지 엉덩이에 뿔난다.",
|
||||
"못 먹는 감 찔러나 본다.",
|
||||
"미꾸라지 한 마리가 온 웅덩이를 흐린다.",
|
||||
"믿는 도끼에 발등 찍히다.",
|
||||
"믿는 도끼에 발등 찍힌다.",
|
||||
"밑 빠진 독에 물 붓기.",
|
||||
"바늘 도둑이 소 도둑 된다.",
|
||||
"방귀 뀐 놈이 성낸다.",
|
||||
@@ -44,7 +42,7 @@ var koreanSentenceList = [
|
||||
"번데기 앞에서 주름잡기",
|
||||
"부뚜막의 소금도 집어 넣어야 짜다.",
|
||||
"비온 뒤 땅이 굳는다.",
|
||||
"빈 수레가 더 요란하다.",
|
||||
"빈 수레가 요란하다.",
|
||||
"빈대 잡다 초가삼간 태운다.",
|
||||
"사공이 많으면 배가 산으로 간다.",
|
||||
"서당개 삼년이면 풍월을 읊는다.",
|
||||
@@ -59,7 +57,6 @@ var koreanSentenceList = [
|
||||
"얌전한 고양이 부뚜막에 먼저 오른다.",
|
||||
"안 되는 놈은 뒤로 자빠져도 코가 깨진다.",
|
||||
"어물전 망신은 꼴뚜기가 시킨다.",
|
||||
"열길 물 속은 알아도 한길 사람 속은 모른다.",
|
||||
"열 번 찍어 안 넘어가는 나무 없다.",
|
||||
"오르지 못할 나무는 쳐다보지도 마라.",
|
||||
"오얏나무 아래에서 갓을 고쳐 쓰지 마라.",
|
||||
@@ -78,10 +75,9 @@ var koreanSentenceList = [
|
||||
"털어서 먼지 안 나는 사람 없다.",
|
||||
"팔은 안으로 굽는다.",
|
||||
"피는 물보다 진하다.",
|
||||
"하늘이 무너저도 솟아날 구멍은 있다.",
|
||||
"하늘이 무너져도 솟아날 구멍은 있다.",
|
||||
"하룻강아지 범 무서운줄 모른다.",
|
||||
"호랑이도 제 말 하면 온다.",
|
||||
"호랑이에게 물려가도 정신만 차리면 살 수 있다.",
|
||||
"호랑이를 잡으려면 호랑이굴로 가야 한다.",
|
||||
"호미로 막을걸 가래로 막는다.",
|
||||
"호박에 줄 긋는다고 수박되나.",
|
||||
|
||||
Reference in New Issue
Block a user