Add: print temp data for history board

This commit is contained in:
2018-05-16 11:14:07 +09:00
parent 6d27a45a26
commit bdd8316fb5
3 changed files with 84 additions and 1 deletions
+83
View File
@@ -3,4 +3,87 @@
class HistoryBoard { class HistoryBoard {
constructor() {
this.historyRecordManager = new HistoryRecordManager();
let arrayTabStyle = { font: "20px Arial", fill: "#fff", align: "left", tabs: [ 40, 80, 120 ] };
let posX = 40;
let posY = game.world.height / 2 - 10;
this.textMyRanking = game.add.text(posX, posY + 100, '', arrayTabStyle)
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
this.loadHistoryRecords();
}
loadHistoryRecords() {
this.historyRecordManager.clear();
this.historyRecordManager.push(new HistoryRecordData("05/10", 15460));
this.historyRecordManager.push(new HistoryRecordData("05/11", 3040));
this.historyRecordManager.push(new HistoryRecordData("05/12", 460));
this.historyRecordManager.push(new HistoryRecordData("05/13", 60));
this.historyRecordManager.push(new HistoryRecordData("05/14", 8));
this.printHistoryRecords();
}
printHistoryRecords(historyRecords) {
for(let i = 0; i < this.historyRecordManager.count; i++) {
let data = this.historyRecordManager.getAt(i);
this.printRecord(i, data.date, data.record);
}
// this.chartGraphics.lineStyle(3, 0xffd900, 1);
// this.chartGraphics.moveTo(0, 0);
// this.chartGraphics.lineTo(game.world.width - 200, 0);
}
printRecord(index, date, record) {
if(sessionStorageManager.playingAppName.indexOf("typing") > -1)
this.printMouseAppHistory(index, date, record);
else
this.printMouseAppHistory(index, date, record);
}
printTypingAppHistory(index, date, record) {
let posX = 60;
let posY = game.world.height / 2 + 90 + 30 * index;
var style = { font: "20px Arial", fill: "#ffc", align: "right", boundsAlignH: "right", boundsAlignV: "top" };
style.boundsAlignH = "center";
game.add.text(posX, posY, date, style)
.setTextBounds(0, 0, 40, 40)
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
game.add.text(posX + 60, posY, "(한)단어", style)
.setTextBounds(0, 0, 60, 60)
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
let numberWithCommas = NumberUtil.numberWithCommas(record);
style.boundsAlignH = "right";
game.add.text(posX + 120, posY, numberWithCommas, style)
.setTextBounds(0, 0, 80, 60)
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
}
printMouseAppHistory(index, date, record) {
let posX = 60;
let posY = game.world.height / 2 + 90 + 30 * index;
var style = { font: "20px Arial", fill: "#ffc", align: "right", boundsAlignH: "right", boundsAlignV: "top" };
style.boundsAlignH = "center";
game.add.text(posX, posY, date, style)
.setTextBounds(0, 0, 100, 60)
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
let numberWithCommas = NumberUtil.numberWithCommas(record);
style.boundsAlignH = "right";
game.add.text(posX + 80, posY, numberWithCommas, style)
.setTextBounds(0, 0, 100, 60)
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
}
} }
+1
View File
@@ -8,6 +8,7 @@ class RecordBoard {
this.printRecordBoardHeader(); this.printRecordBoardHeader();
let historyBoard = new HistoryBoard();
let rankingBoard = new RankingBoard(); let rankingBoard = new RankingBoard();
} }
-1
View File
@@ -27,7 +27,6 @@ class Result {
this.makeStartButton(); this.makeStartButton();
let recordBoard = new RecordBoard(); let recordBoard = new RecordBoard();
console.log(recordBoard);
// bottom // bottom