Add: ranking hour, day, month record php
This commit is contained in:
@@ -14,12 +14,17 @@ class HistoryBoard {
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
|
||||
this.dbConnectManager.requestPlayerHistory( historyRecordManager => {
|
||||
let maxIndex = historyRecordManager.count;
|
||||
if(maxIndex > 6)
|
||||
maxIndex = 6;
|
||||
|
||||
for(let i = 0; i < historyRecordManager.count; i++) {
|
||||
if(i > 6)
|
||||
break;
|
||||
|
||||
let data = historyRecordManager.getAt(i);
|
||||
let data = historyRecordManager.getAt(maxIndex);
|
||||
this.printRecord(i, data.date, data.score);
|
||||
maxIndex--;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -39,13 +44,12 @@ class HistoryBoard {
|
||||
var style = { font: "20px Arial", fill: "#ffc", align: "right", boundsAlignH: "right", boundsAlignV: "top" };
|
||||
|
||||
style.boundsAlignH = "center";
|
||||
game.add.text(posX, posY, date, style)
|
||||
game.add.text(posX, posY, StringUtil.printMonthDay(date), style)
|
||||
.setTextBounds(0, 0, 100, 60)
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
|
||||
let numberWithCommas = NumberUtil.numberWithCommas(score);
|
||||
style.boundsAlignH = "right";
|
||||
game.add.text(posX + 80, posY, numberWithCommas, style)
|
||||
game.add.text(posX + 80, posY, StringUtil.getScoreTextWithoutUnit(score), style)
|
||||
.setTextBounds(0, 0, 100, 60)
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
}
|
||||
@@ -61,14 +65,12 @@ class HistoryBoard {
|
||||
.setTextBounds(0, 0, 40, 40)
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
|
||||
let typingAppName = appName;
|
||||
game.add.text(posX + 60, posY, typingAppName, style)
|
||||
game.add.text(posX + 60, posY, appName, style)
|
||||
.setTextBounds(0, 0, 60, 60)
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
|
||||
let numberWithCommas = NumberUtil.numberWithCommas(score);
|
||||
style.boundsAlignH = "right";
|
||||
game.add.text(posX + 120, posY, numberWithCommas, style)
|
||||
game.add.text(posX + 120, posY, StringUtil.getScoreTextWithoutUnit(score), style)
|
||||
.setTextBounds(0, 0, 80, 60)
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
}
|
||||
|
||||
@@ -7,13 +7,15 @@ class RankingBoard {
|
||||
this.dbConnectManager = new DBConnectManager();
|
||||
|
||||
this.requestRanking(DBConnectManager.TYPE_MY_RANKING_HOUR);
|
||||
this.requestRanking(DBConnectManager.TYPE_MY_RANKING_DAY);
|
||||
this.requestRanking(DBConnectManager.TYPE_MY_RANKING_MONTH);
|
||||
// this.requestRanking(DBConnectManager.TYPE_MY_RANKING_DAY);
|
||||
// this.requestRanking(DBConnectManager.TYPE_MY_RANKING_MONTH);
|
||||
}
|
||||
|
||||
|
||||
requestRanking(type, rankingRecordManager) {
|
||||
this.dbConnectManager.requestRanking(type, rankingRecordManager => {
|
||||
this.dbConnectManager.requestRanking(type, (type, rankingRecordManager) => {
|
||||
console.log(type);
|
||||
console.log(rankingRecordManager);
|
||||
for(let i = 0; i < rankingRecordManager.count; i++) {
|
||||
if(i > 6)
|
||||
break;
|
||||
@@ -40,9 +42,9 @@ class RankingBoard {
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
|
||||
// score
|
||||
let numberWithCommas = NumberUtil.numberWithCommas(data.score);
|
||||
let score = StringUtil.getScoreTextWithoutUnit(data.score);
|
||||
style.boundsAlignH = "right";
|
||||
game.add.text(this.getPosX(type) + 120, this.getPosY(index), numberWithCommas, style)
|
||||
game.add.text(this.getPosX(type) + 120, this.getPosY(index), score, style)
|
||||
.setTextBounds(0, 0, 80, 60)
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
}
|
||||
@@ -53,17 +55,17 @@ class RankingBoard {
|
||||
switch(type) {
|
||||
case DBConnectManager.TYPE_MY_RANKING_HOUR:
|
||||
case DBConnectManager.TYPE_ALL_RANKING_HOUR:
|
||||
posX = 340;
|
||||
posX = 320;
|
||||
break;
|
||||
|
||||
case DBConnectManager.TYPE_MY_RANKING_DAY:
|
||||
case DBConnectManager.TYPE_ALL_RANKING_DAY:
|
||||
posX = 560;
|
||||
posX = 540;
|
||||
break;
|
||||
|
||||
case DBConnectManager.TYPE_MY_RANKING_MONTH:
|
||||
case DBConnectManager.TYPE_ALL_RANKING_MONTH:
|
||||
posX = 780;
|
||||
posX = 760;
|
||||
}
|
||||
|
||||
return posX;
|
||||
|
||||
@@ -15,7 +15,7 @@ class RecordBoard {
|
||||
|
||||
|
||||
printRecordBoardHeader() {
|
||||
let posX = 40;
|
||||
let posX = 60;
|
||||
let posY = game.world.height / 2 + 20;
|
||||
|
||||
var bar = game.add.graphics();
|
||||
@@ -25,14 +25,14 @@ class RecordBoard {
|
||||
const style = { font: "32px Arial", fill: "#ffc", align: "left", boundsAlignH: "center", boundsAlignV: "middle" };
|
||||
this.printHeader(posX, posY, "최근의 내 기록", style);
|
||||
|
||||
posX = 340;
|
||||
posX = 320;
|
||||
style.fill = "#fff";
|
||||
this.printHeader(posX, posY, "수업시간 순위", style);
|
||||
|
||||
posX = 560;
|
||||
posX = 550;
|
||||
this.printHeader(posX, posY, "오늘의 순위", style);
|
||||
|
||||
posX = 780;
|
||||
posX = 770;
|
||||
this.printHeader(posX, posY, "이달의 순위", style);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class RecordBoard {
|
||||
}
|
||||
|
||||
printSeperator() {
|
||||
const posX = 300;
|
||||
const posX = 290;
|
||||
const posY = 480;
|
||||
|
||||
this.chartGraphics.lineStyle(3, 0x444444, 1);
|
||||
|
||||
Reference in New Issue
Block a user