From ac3936aad9e60301cdfc0d60cebc53f0168014f5 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: Mon, 10 Dec 2018 23:20:16 +0900 Subject: [PATCH] Fix: timer text color revised --- src/game/license_timer/timer.js | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/game/license_timer/timer.js b/src/game/license_timer/timer.js index c6469ed..7ee7cc8 100644 --- a/src/game/license_timer/timer.js +++ b/src/game/license_timer/timer.js @@ -52,8 +52,8 @@ Timer.prototype.loadDataFromServer = function() { // this.isTimerGoingOn = false; // this.setTimerTextColor(0xffffff); // } - - this.setTimerTextColor(0x40c0c0); + // else + this.setTimerTextColor(Timer.TEXT_COLOR_CYAN); } Timer.prototype.makeTimer = function() { @@ -251,7 +251,10 @@ Timer.prototype.setTimerTextColor = function(color) { Timer.prototype.startTimer = function() { this.isTimerGoingOn = true; - this.setTimerTextColor(0xc0c040); + if(this.timeLeft < 0) + this.setTimerTextColor(Timer.TEXT_COLOR_RED); + else + this.setTimerTextColor(Timer.TEXT_COLOR_YELLOW); this.updateTimeText(); ShowNotifyTimeOver(this.timeLeft * Timer.TIME_MILLISECONDS); @@ -265,9 +268,9 @@ Timer.prototype.startTimer = function() { } Timer.prototype.pauseTimer = function() { - this.isTimeOver = false; + // this.isTimeOver = false; - this.setTimerTextColor(0xa0a0a0); + this.setTimerTextColor(Timer.TEXT_COLOR_GREY); this.updateTimeText(); CancelNotifyTimeOver(); @@ -280,11 +283,13 @@ Timer.prototype.pauseTimer = function() { } Timer.prototype.resetTimer = function() { + this.isTimeOver = false; + this.timeLeft = this.timeStart; this.pauseTimer(); this.isTimerGoingOn = false; - this.setTimerTextColor(0x40c0c0); + this.setTimerTextColor(Timer.TEXT_COLOR_CYAN); // this.loadDataFromServer(); } @@ -311,7 +316,7 @@ Timer.prototype.tickTimeLeft = function() { Timer.prototype.timeOver = function() { this.isTimeOver = true; - this.setTimerTextColor(0xc04040); + this.setTimerTextColor(Timer.TEXT_COLOR_RED); console.log("time over"); @@ -425,8 +430,6 @@ Timer.prototype.makeTimeButton = function(setting, buttonText, eventHandler) { } Timer.prototype.timePlus = function(timePlusSecond, type) { - console.log(timePlusSecond + type); - var timeAmount = 0; switch(type) { case Timer.TYPE_HOUR: @@ -451,8 +454,6 @@ Timer.prototype.timePlus = function(timePlusSecond, type) { } Timer.prototype.timeMinus = function(timeMinusSecond, type) { - console.log(timeMinusSecond + type); - var timeAmount = 0; switch(type) { case Timer.TYPE_HOUR: @@ -559,4 +560,10 @@ Timer.TIME_DEFAULT_SEC Timer.TYPE_HOUR = "hour"; Timer.TYPE_MINUTE = "minute"; -Timer.TYPE_SECOND = "second"; \ No newline at end of file +Timer.TYPE_SECOND = "second"; + + +Timer.TEXT_COLOR_CYAN = 0x40c0c0; +Timer.TEXT_COLOR_YELLOW = 0xe0e040; +Timer.TEXT_COLOR_GREY = 0xa0a0a0; +Timer.TEXT_COLOR_RED = 0xc04040; \ No newline at end of file