From a89ff91db5d9b4c35232197b2ae64a71e84feab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A2=E1=84=91=E1=85=B3=E1=86=AF=20=E1=84=82?= =?UTF-8?q?=E1=85=A9=E1=84=90=E1=85=B3=E1=84=87=E1=85=AE=E1=86=A8?= Date: Sun, 6 Jan 2019 08:10:29 +0900 Subject: [PATCH] Fix: text color --- src/game/typing/word_flyingsaucer/flyingsaucer.js | 10 +++++++--- src/game/typing/word_flyingsaucer/game.js | 3 ++- .../typing/word_flyingsaucer/game_level_manager.js | 9 +++++---- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/game/typing/word_flyingsaucer/flyingsaucer.js b/src/game/typing/word_flyingsaucer/flyingsaucer.js index a64b16a..2fc53dd 100644 --- a/src/game/typing/word_flyingsaucer/flyingsaucer.js +++ b/src/game/typing/word_flyingsaucer/flyingsaucer.js @@ -115,10 +115,10 @@ FlyingSaucer.prototype.update = function() { FlyingSaucer.prototype.updateJetColor = function() { var landingRatio = this.getLandingRatio(); - if(this.jetStatus == FlyingSaucer.JET_STATUS_HIGH && landingRatio < 0.9) { + if(this.jetStatus == FlyingSaucer.JET_STATUS_HIGH && landingRatio < GameLevelManager.LEVEL_UP_LANDING_RATIO) { this.jetStatus = FlyingSaucer.JET_STATUS_MIDDLE; this.changeJetColor(FlyingSaucer.JET_COLOR_MIDDLE); - } else if(this.jetStatus == FlyingSaucer.JET_STATUS_MIDDLE && landingRatio < 0.1) { + } else if(this.jetStatus == FlyingSaucer.JET_STATUS_MIDDLE && landingRatio < GameLevelManager.WARNING_LANDING_RATIO) { this.jetStatus = FlyingSaucer.JET_STATUS_LOW; this.changeJetColor(FlyingSaucer.JET_COLOR_LOW); } @@ -212,6 +212,9 @@ FlyingSaucer.prototype.checkInputText = function(inputText) { var word = this.wordText.text; var inputTextLength = inputText.length; + if(word.length < inputTextLength) + return; + var index = 0; for(; index < inputTextLength; index++) { // console.log("i : " + index); @@ -239,7 +242,8 @@ FlyingSaucer.prototype.checkWord = function(inputText) { // console.log("inputText : " + inputText); // console.log("this.wordText : " + this.wordText); - // var word = this.wordText.text; + this.wordText.clearColors(); + this.wordText.addColor(FlyingSaucer.TEXT_COLOR_NORMAL, 0); if(this.word == inputText) { this.gameLevelManager.clearWord(this.wordLevel, this.getLandingRatio()); diff --git a/src/game/typing/word_flyingsaucer/game.js b/src/game/typing/word_flyingsaucer/game.js index 91e1231..0794486 100644 --- a/src/game/typing/word_flyingsaucer/game.js +++ b/src/game/typing/word_flyingsaucer/game.js @@ -45,7 +45,7 @@ var WordFlyingSaucer = { } this.flyingsaucers = []; - for(var i = 0; i < 2; i++) { + for(var i = 0; i < WordFlyingSaucer.MAX_FLYINGSAUCER_COUNT; i++) { this.flyingsaucers[i] = new FlyingSaucer(i); this.flyingsaucers[i].setScoreManager(this.scoreManager); this.flyingsaucers[i].setHeartManager(this.heartManager); @@ -174,3 +174,4 @@ var WordFlyingSaucer = { } +WordFlyingSaucer.MAX_FLYINGSAUCER_COUNT = 5; \ No newline at end of file diff --git a/src/game/typing/word_flyingsaucer/game_level_manager.js b/src/game/typing/word_flyingsaucer/game_level_manager.js index a896e4f..34021a6 100644 --- a/src/game/typing/word_flyingsaucer/game_level_manager.js +++ b/src/game/typing/word_flyingsaucer/game_level_manager.js @@ -14,18 +14,19 @@ GameLevelManager.prototype.getWordScore = function() { GameLevelManager.prototype.clearWord = function(wordLevel, clearTiming) { - console.log("wordLevel : " + wordLevel); - console.log("clearTiming : " + clearTiming); + // console.log("wordLevel : " + wordLevel); + // console.log("clearTiming : " + clearTiming); if(this.wordLevel == wordLevel && clearTiming > 0.9) { if(this.wordLevel < GameLevelManager.MAX_KOR_WORD_LEVEL) this.wordLevel++; - console.log("this.wordLevel : " + this.wordLevel); + // console.log("this.wordLevel : " + this.wordLevel); } } -GameLevelManager.LEVELUP_TIMING = 0.5; +GameLevelManager.LEVEL_UP_LANDING_RATIO = 0.7; +GameLevelManager.WARNING_LANDING_RATIO = 0.1; GameLevelManager.MAX_KOR_WORD_LEVEL = 7; \ No newline at end of file