Fix: Timer and Chart UI

This commit is contained in:
2018-12-10 07:39:02 +09:00
parent 3fd64a35e1
commit 496ddbcde0
3 changed files with 172 additions and 7 deletions
+31 -7
View File
@@ -31,6 +31,8 @@ var LicenseTimer = {
this.makeTimer();
this.chart = new Chart();
this.makeInputScoreGroup();
@@ -136,12 +138,12 @@ var LicenseTimer = {
makeTimer: function() {
// bar
var bar = game.add.graphics();
bar.beginFill(0x000000, 0.2);
bar.drawRect(0, 60, GAME_SCREEN_SIZE.x, 200);
bar.beginFill(0x202020);
bar.drawRect(0, 60, GAME_SCREEN_SIZE.x, 240);
// Timer
var timerCenterX = game.world.centerX + 60;
var timerCenterY = 163;
var timerCenterX = game.world.centerX + LicenseTimer.Timer_CENTER_OFFSET_X;
var timerCenterY = 183;
this.timeHourText = this.makeTimerTextContent(timerCenterX - 240, timerCenterY, 160, "00");
this.makeTimerTextContent(timerCenterX - 120, timerCenterY, 160, ":");
@@ -193,14 +195,29 @@ var LicenseTimer = {
timePlus(amount, type) {
console.log(amount + type);
// if(type == "hour")
this.timeLeft += amount * 60;
this.updateTimeText();
this.sendTimeLeftToServer();
},
timeMinus(amount, type) {
console.log(amount + type);
// if(type == "hour") {
// var totalMinusMinute = amount * LicenseTimer.TIME_MINUTES_FOR_HOUR;
// if(totalMinusMinute - )
// }
this.timeLeft -= amount * 60;
if(this.timeLeft < 0)
this.timeLeft = 0;
this.updateTimeText();
this.sendTimeLeftToServer();
},
makeInputScoreGroup: function() {
var InputScoreGruopPosY = GAME_SCREEN_SIZE.y - 70;
var InputScoreGruopPosY = GAME_SCREEN_SIZE.y - LicenseTimer.INPUT_SCORE_GROUP_OFFSET_Y;
// bar
var bar = game.add.graphics();
bar.beginFill(0x303030); //, 0.2);
@@ -374,6 +391,13 @@ var LicenseTimer = {
}
LicenseTimer.TIME_DEFAULT_SEC = 60 * 60; // 60 min * 60 sec
LicenseTimer.TIME_MILLISECONDS = 1000;
LicenseTimer.Timer_CENTER_OFFSET_X = 40;
LicenseTimer.INPUT_SCORE_GROUP_OFFSET_Y = 70;
LicenseTimer.TIME_MILLISECONDS = 1000;
LicenseTimer.TIME_MINUTES_FOR_HOUR = 60;
LicenseTimer.TIME_SECONDS_FOR_MINUTE = 60;
LicenseTimer.TIME_DEFAULT_SEC
= LicenseTimer.TIME_MINUTES_FOR_HOUR * LicenseTimer.TIME_SECONDS_FOR_MINUTE; // 60 min * 60 sec