From 09b1fb100b70c83363b9393dc89f347f66491ac6 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:16:30 +0900 Subject: [PATCH] Fix: timer text color --- src/game/license_timer/timer.js | 44 +++++++++++++++++---------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/game/license_timer/timer.js b/src/game/license_timer/timer.js index 9d67a00..c6469ed 100644 --- a/src/game/license_timer/timer.js +++ b/src/game/license_timer/timer.js @@ -22,6 +22,7 @@ function Timer() { Timer.prototype.initVariables = function() { this.isTimerGoingOn = false; + this.isTimeOver = false; this.timeStart = 0 this.timeLeft = 0; @@ -52,7 +53,7 @@ Timer.prototype.loadDataFromServer = function() { // this.setTimerTextColor(0xffffff); // } - this.setTimerTextColor(0xc04040); + this.setTimerTextColor(0x40c0c0); } Timer.prototype.makeTimer = function() { @@ -107,15 +108,15 @@ Timer.prototype.makeResetButton = function() { setting.fontStyle.fontSize = 40; setting.setStrokeColor( - 0x903030, - 0x802020, - 0x502020, + 0x309090, + 0x208080, + 0x205050, 0x666666 ); setting.setButtonColor( - 0xc04040, - 0xa03030, - 0x802020, + 0x40c0c0, + 0x30a0a0, + 0x208080, 0x666666 ); setting.setTextColor( @@ -144,15 +145,15 @@ Timer.prototype.makePlayButton = function() { // blue tone setting.setStrokeColor( - 0x208080, - 0x106060, - 0x004040, + 0x808020, + 0x606010, + 0x404000, 0x333333 ); setting.setButtonColor( - 0x40c0c0, - 0x30a0a0, - 0x209090, + 0xc0c040, + 0xa0a030, + 0x909020, 0x666666 ); setting.setTextColor( @@ -250,7 +251,7 @@ Timer.prototype.setTimerTextColor = function(color) { Timer.prototype.startTimer = function() { this.isTimerGoingOn = true; - this.setTimerTextColor(0x40c0c0); + this.setTimerTextColor(0xc0c040); this.updateTimeText(); ShowNotifyTimeOver(this.timeLeft * Timer.TIME_MILLISECONDS); @@ -264,6 +265,8 @@ Timer.prototype.startTimer = function() { } Timer.prototype.pauseTimer = function() { + this.isTimeOver = false; + this.setTimerTextColor(0xa0a0a0); this.updateTimeText(); @@ -281,7 +284,7 @@ Timer.prototype.resetTimer = function() { this.pauseTimer(); this.isTimerGoingOn = false; - this.setTimerTextColor(0xc04040); + this.setTimerTextColor(0x40c0c0); // this.loadDataFromServer(); } @@ -301,17 +304,16 @@ Timer.prototype.tickTimeLeft = function() { this.updateTimeText(); - if(this.timeLeft < 0) { - this.setTimerTextColor(0xff0000); + if(!this.isTimeOver && this.timeLeft < 0) this.timeOver(); - } } Timer.prototype.timeOver = function() { + this.isTimeOver = true; + + this.setTimerTextColor(0xc04040); + console.log("time over"); - // this.startButton.disable(); - // this.restartButton.disable(); - // this.pauseButton.disable(); // xhr = new XMLHttpRequest(); // xhr.open('POST', 'delete_last_timestamp.php', true);