Fix: get db data with date, time

This commit is contained in:
2018-05-24 20:48:22 +09:00
parent 82e290db86
commit 4863a8d3f1
7 changed files with 75 additions and 51 deletions
+21 -11
View File
@@ -13,20 +13,30 @@ class HistoryBoard {
this.textMyRanking = game.add.text(posX, posY + 100, '', arrayTabStyle)
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
this.dbConnectManager.requestPlayerHistory( historyRecordManager => {
let maxIndex = historyRecordManager.count - 1;
if(maxIndex > 6)
maxIndex = 6;
let today = new Date();
let date = DateUtil.getYYYYMMDD(today);
this.dbConnectManager.requestPlayerHistory(
date,
historyRecordManager => {
if(historyRecordManager.count == 0) {
console.log("history board - no data");
return;
}
for(let i = 0; i < historyRecordManager.count; i++) {
if(i > 6)
break;
let maxIndex = historyRecordManager.count - 1;
if(maxIndex > 6)
maxIndex = 6;
let data = historyRecordManager.getAt(maxIndex);
this.printRecord(i, data.date, data.score);
maxIndex--;
for(let i = 0; i < historyRecordManager.count; i++) {
if(i > 6)
break;
let data = historyRecordManager.getAt(maxIndex);
this.printRecord(i, data.date, data.score);
maxIndex--;
}
}
});
);
}