Fix: timer text color

This commit is contained in:
2018-12-10 23:16:30 +09:00
parent 5bd5f0809e
commit 09b1fb100b
+23 -21
View File
@@ -22,6 +22,7 @@ function Timer() {
Timer.prototype.initVariables = function() { Timer.prototype.initVariables = function() {
this.isTimerGoingOn = false; this.isTimerGoingOn = false;
this.isTimeOver = false;
this.timeStart = 0 this.timeStart = 0
this.timeLeft = 0; this.timeLeft = 0;
@@ -52,7 +53,7 @@ Timer.prototype.loadDataFromServer = function() {
// this.setTimerTextColor(0xffffff); // this.setTimerTextColor(0xffffff);
// } // }
this.setTimerTextColor(0xc04040); this.setTimerTextColor(0x40c0c0);
} }
Timer.prototype.makeTimer = function() { Timer.prototype.makeTimer = function() {
@@ -107,15 +108,15 @@ Timer.prototype.makeResetButton = function() {
setting.fontStyle.fontSize = 40; setting.fontStyle.fontSize = 40;
setting.setStrokeColor( setting.setStrokeColor(
0x903030, 0x309090,
0x802020, 0x208080,
0x502020, 0x205050,
0x666666 0x666666
); );
setting.setButtonColor( setting.setButtonColor(
0xc04040, 0x40c0c0,
0xa03030, 0x30a0a0,
0x802020, 0x208080,
0x666666 0x666666
); );
setting.setTextColor( setting.setTextColor(
@@ -144,15 +145,15 @@ Timer.prototype.makePlayButton = function() {
// blue tone // blue tone
setting.setStrokeColor( setting.setStrokeColor(
0x208080, 0x808020,
0x106060, 0x606010,
0x004040, 0x404000,
0x333333 0x333333
); );
setting.setButtonColor( setting.setButtonColor(
0x40c0c0, 0xc0c040,
0x30a0a0, 0xa0a030,
0x209090, 0x909020,
0x666666 0x666666
); );
setting.setTextColor( setting.setTextColor(
@@ -250,7 +251,7 @@ Timer.prototype.setTimerTextColor = function(color) {
Timer.prototype.startTimer = function() { Timer.prototype.startTimer = function() {
this.isTimerGoingOn = true; this.isTimerGoingOn = true;
this.setTimerTextColor(0x40c0c0); this.setTimerTextColor(0xc0c040);
this.updateTimeText(); this.updateTimeText();
ShowNotifyTimeOver(this.timeLeft * Timer.TIME_MILLISECONDS); ShowNotifyTimeOver(this.timeLeft * Timer.TIME_MILLISECONDS);
@@ -264,6 +265,8 @@ Timer.prototype.startTimer = function() {
} }
Timer.prototype.pauseTimer = function() { Timer.prototype.pauseTimer = function() {
this.isTimeOver = false;
this.setTimerTextColor(0xa0a0a0); this.setTimerTextColor(0xa0a0a0);
this.updateTimeText(); this.updateTimeText();
@@ -281,7 +284,7 @@ Timer.prototype.resetTimer = function() {
this.pauseTimer(); this.pauseTimer();
this.isTimerGoingOn = false; this.isTimerGoingOn = false;
this.setTimerTextColor(0xc04040); this.setTimerTextColor(0x40c0c0);
// this.loadDataFromServer(); // this.loadDataFromServer();
} }
@@ -301,17 +304,16 @@ Timer.prototype.tickTimeLeft = function() {
this.updateTimeText(); this.updateTimeText();
if(this.timeLeft < 0) { if(!this.isTimeOver && this.timeLeft < 0)
this.setTimerTextColor(0xff0000);
this.timeOver(); this.timeOver();
}
} }
Timer.prototype.timeOver = function() { Timer.prototype.timeOver = function() {
this.isTimeOver = true;
this.setTimerTextColor(0xc04040);
console.log("time over"); console.log("time over");
// this.startButton.disable();
// this.restartButton.disable();
// this.pauseButton.disable();
// xhr = new XMLHttpRequest(); // xhr = new XMLHttpRequest();
// xhr.open('POST', 'delete_last_timestamp.php', true); // xhr.open('POST', 'delete_last_timestamp.php', true);