Add: prev next time
This commit is contained in:
+97
-38
@@ -25,7 +25,7 @@ var Ranking = {
|
||||
// this.bgWhite = game.add.sprite(0, 0, "bg_white");
|
||||
// this.bgWhite.width = GAME_SCREEN_SIZE.x;
|
||||
// this.bgWhite.height = GAME_SCREEN_SIZE.y;
|
||||
// this.setBgColor();
|
||||
// this.setBgColor(this.timeType);
|
||||
|
||||
var posY = 100;
|
||||
// var bg = game.add.graphics();
|
||||
@@ -34,7 +34,7 @@ var Ranking = {
|
||||
this.bgWhite = game.add.sprite(0, 60, "bg_white");
|
||||
this.bgWhite.width = GAME_SCREEN_SIZE.x;
|
||||
this.bgWhite.height = 80;
|
||||
this.setBgColor();
|
||||
this.setBgColor(this.timeType);
|
||||
|
||||
|
||||
// keyboard shortcut
|
||||
@@ -66,13 +66,14 @@ var Ranking = {
|
||||
|
||||
// date time
|
||||
this.textDateTime = game.add.text(GAME_SCREEN_SIZE.x / 2, 104, "", resultTextStyle);
|
||||
this.textDateTime.fontSize = 34;
|
||||
this.textDateTime.fontSize = 28;
|
||||
this.textDateTime.fontWeight = "normal";
|
||||
this.textDateTime.stroke = "#333333";
|
||||
this.textDateTime.strokeThickness = 3;
|
||||
//.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
this.textDateTime.anchor.set(0.5);
|
||||
// this.textDateTime.addColor("#ff6666", 0);
|
||||
this.printDateTime(this.dateTime);
|
||||
|
||||
|
||||
// rank
|
||||
@@ -85,23 +86,39 @@ var Ranking = {
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
|
||||
|
||||
var buttonOffsetX = 300;
|
||||
var buttonOffsetX = 320;
|
||||
var buttonPositionY = 100;
|
||||
var dateTimeButtonWidth = 40;
|
||||
this.buttonPrevDate = this.makeArrowButton(
|
||||
buttonOffsetX, buttonPositionY,
|
||||
50, 50,
|
||||
dateTimeButtonWidth, dateTimeButtonWidth,
|
||||
"<",
|
||||
(function() { console.log("prev date time"); }).bind(this)
|
||||
(function() { this.decreaseDateTime(); }).bind(this)
|
||||
);
|
||||
// this.buttonPrevDate.inputEnabled = false;
|
||||
this.buttonNextDate = this.makeArrowButton(
|
||||
GAME_SCREEN_SIZE.x - buttonOffsetX, buttonPositionY,
|
||||
50, 50,
|
||||
dateTimeButtonWidth, dateTimeButtonWidth,
|
||||
">",
|
||||
(function() { console.log("next date time"); }).bind(this)
|
||||
(function() { this.increaseDateTime(); }).bind(this)
|
||||
);
|
||||
// this.buttonNextDate.inputEnabled = false;
|
||||
|
||||
var buttonTestDate = null;
|
||||
if(runMode == MODE_DEBUG) {
|
||||
buttonTestDate = this.makeArrowButton(
|
||||
30, buttonPositionY,
|
||||
50, 50,
|
||||
"@",
|
||||
(function() {
|
||||
this.date = "2018-08-23";
|
||||
this.time = "15:53:00";
|
||||
this.dateTime = new Date(this.date + "T" + this.time);
|
||||
this.getRecordToRankingServer();
|
||||
}).bind(this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
buttonOffsetX = 30;
|
||||
buttonPositionY = 370;
|
||||
@@ -291,10 +308,12 @@ var Ranking = {
|
||||
this.timeType = Ranking.MODE_HOUR;
|
||||
this.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 수업시간 순위";
|
||||
this.textTitle.addColor("#ff6666", 0);
|
||||
this.getRecordToRankingServer();
|
||||
|
||||
this.printDateTime(this.dateTime);
|
||||
|
||||
this.getRecordToRankingServer();
|
||||
this.setFirstPageIndex();
|
||||
this.setBgColor();
|
||||
this.setBgColor(this.timeType);
|
||||
},
|
||||
|
||||
showRankingDay: function() {
|
||||
@@ -302,9 +321,11 @@ var Ranking = {
|
||||
this.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 오늘의 순위";
|
||||
this.textTitle.addColor("#9999ff", 0);
|
||||
|
||||
this.printDateTime(this.dateTime);
|
||||
|
||||
this.getRecordToRankingServer();
|
||||
this.setFirstPageIndex();
|
||||
this.setBgColor();
|
||||
this.setBgColor(this.timeType);
|
||||
},
|
||||
|
||||
showRankingMonth: function() {
|
||||
@@ -312,9 +333,11 @@ var Ranking = {
|
||||
this.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 이달의 순위";
|
||||
this.textTitle.addColor("#99ff99", 0);
|
||||
|
||||
this.printDateTime(this.dateTime);
|
||||
|
||||
this.getRecordToRankingServer();
|
||||
this.setFirstPageIndex();
|
||||
this.setBgColor();
|
||||
this.setBgColor(this.timeType);
|
||||
},
|
||||
|
||||
showRanking: function(rankingRecordManager) {
|
||||
@@ -328,6 +351,7 @@ var Ranking = {
|
||||
}
|
||||
|
||||
if(rankingRecordManager.rankingRecords.length === 0) {
|
||||
this.setFirstPageIndex();
|
||||
var rankEmpty = [ ];
|
||||
this.textRanking1to10.parseList(rankEmpty);
|
||||
this.textRanking11to20.parseList(rankEmpty);
|
||||
@@ -351,7 +375,7 @@ var Ranking = {
|
||||
this.recordArray.push(bestRecordRow);
|
||||
}
|
||||
|
||||
this.printDateTime();
|
||||
this.printDateTime(this.dateTime);
|
||||
this.printRanking();
|
||||
},
|
||||
|
||||
@@ -443,18 +467,51 @@ var Ranking = {
|
||||
this.dateTime = new Date(hourTimeText);
|
||||
this.date = DateUtil.getYYYYMMDD(this.dateTime);
|
||||
this.time = DateUtil.getHHMMSS(this.dateTime);
|
||||
},
|
||||
|
||||
if(runMode == MODE_DEBUG) {
|
||||
this.date = "2018-08-23";
|
||||
this.time = "15:53:00";
|
||||
this.dateTime = new Date(this.date + "T" + this.time);
|
||||
}
|
||||
setDateTime: function(dateTime) {
|
||||
this.date = DateUtil.getYYYYMMDD(dateTime);
|
||||
this.time = DateUtil.getHHMMSS(dateTime);
|
||||
},
|
||||
|
||||
increaseDateTime: function() {
|
||||
switch(this.timeType) {
|
||||
case Ranking.MODE_HOUR:
|
||||
this.dateTime.setHours(this.dateTime.getHours() + 1);
|
||||
break;
|
||||
|
||||
case Ranking.MODE_DAY:
|
||||
this.dateTime.setDate(this.dateTime.getDate() + 1);
|
||||
break;
|
||||
|
||||
case Ranking.MODE_MONTH:
|
||||
this.dateTime.setMonth(this.dateTime.getMonth() + 1);
|
||||
break;
|
||||
}
|
||||
this.setDateTime(this.dateTime);
|
||||
|
||||
this.printDateTime(this.dateTime);
|
||||
this.getRecordToRankingServer();
|
||||
},
|
||||
|
||||
decreaseDateTime: function() {
|
||||
switch(this.timeType) {
|
||||
case Ranking.MODE_HOUR:
|
||||
this.dateTime.setHours(this.dateTime.getHours() - 1);
|
||||
break;
|
||||
|
||||
case Ranking.MODE_DAY:
|
||||
this.dateTime.setDate(this.dateTime.getDate() - 1);
|
||||
break;
|
||||
|
||||
case Ranking.MODE_MONTH:
|
||||
this.dateTime.setMonth(this.dateTime.getMonth() - 1);
|
||||
break;
|
||||
}
|
||||
this.setDateTime(this.dateTime);
|
||||
|
||||
this.printDateTime(this.dateTime);
|
||||
this.getRecordToRankingServer();
|
||||
},
|
||||
|
||||
getDatetimeHour: function() {
|
||||
@@ -465,37 +522,39 @@ var Ranking = {
|
||||
return ("0" + this.dateTime.getHours()).slice(-2);
|
||||
},
|
||||
|
||||
getYYYYMMDDHHText: function() {
|
||||
return DateUtil.getFullYear(this.dateTime) + "년 "
|
||||
+ DateUtil.getFullMonth(this.dateTime) + "월 "
|
||||
+ DateUtil.getFullDate(this.dateTime) + "일, "
|
||||
+ DateUtil.getFullHours(this.dateTime) + "시";
|
||||
getYYYYMMDDHHText: function(dateTime) {
|
||||
return DateUtil.getFullYear(dateTime) + "년 "
|
||||
+ DateUtil.getFullMonth(dateTime) + "월 "
|
||||
+ DateUtil.getFullDate(dateTime) + "일, "
|
||||
+ DateUtil.getFullHours(dateTime) + "시";
|
||||
},
|
||||
|
||||
getYYYYMMDDText: function() {
|
||||
return DateUtil.getFullYear(this.dateTime) + "년 "
|
||||
+ DateUtil.getFullMonth(this.dateTime) + "월 "
|
||||
+ DateUtil.getFullDate(this.dateTime) + "일";
|
||||
getYYYYMMDDText: function(dateTime) {
|
||||
return DateUtil.getFullYear(dateTime) + "년 "
|
||||
+ DateUtil.getFullMonth(dateTime) + "월 "
|
||||
+ DateUtil.getFullDate(dateTime) + "일";
|
||||
},
|
||||
|
||||
getYYYYMMText: function() {
|
||||
return DateUtil.getFullYear(this.dateTime) + "년 "
|
||||
+ DateUtil.getFullMonth(this.dateTime) + "월 ";
|
||||
getYYYYMMText: function(dateTime) {
|
||||
return DateUtil.getFullYear(dateTime) + "년 "
|
||||
+ DateUtil.getFullMonth(dateTime) + "월 ";
|
||||
},
|
||||
|
||||
printDateTime: function() {
|
||||
console.log(this.timeType);
|
||||
printDateTime: function(dateTime) {
|
||||
// console.log(this.timeType);
|
||||
// console.log((this.dateTime);
|
||||
|
||||
switch(this.timeType) {
|
||||
case Ranking.MODE_HOUR:
|
||||
this.textDateTime.text = this.getYYYYMMDDHHText();
|
||||
this.textDateTime.text = this.getYYYYMMDDHHText(dateTime);
|
||||
break;
|
||||
|
||||
case Ranking.MODE_DAY:
|
||||
this.textDateTime.text = this.getYYYYMMDDText();
|
||||
this.textDateTime.text = this.getYYYYMMDDText(dateTime);
|
||||
break;
|
||||
|
||||
case Ranking.MODE_MONTH:
|
||||
this.textDateTime.text = this.getYYYYMMText();
|
||||
this.textDateTime.text = this.getYYYYMMText(dateTime);
|
||||
break;
|
||||
}
|
||||
},
|
||||
@@ -524,8 +583,8 @@ var Ranking = {
|
||||
this.showingPageIndex = 0;
|
||||
},
|
||||
|
||||
setBgColor: function() {
|
||||
switch(this.timeType) {
|
||||
setBgColor: function(timeType) {
|
||||
switch(timeType) {
|
||||
case Ranking.MODE_HOUR:
|
||||
this.bgWhite.tint = 0x5f4d4d;
|
||||
break;
|
||||
@@ -545,4 +604,4 @@ Ranking.MODE_HOUR = "mode_hour";
|
||||
Ranking.MODE_DAY = "mode_day";
|
||||
Ranking.MODE_MONTH = "mode_month";
|
||||
|
||||
Ranking.REFRESH_TIME_SEC = 10;
|
||||
Ranking.REFRESH_TIME_SEC = 5;
|
||||
Reference in New Issue
Block a user