Add: printHistory

This commit is contained in:
2018-05-15 19:54:41 +09:00
parent 5e32d9bd23
commit ade28f781b
+54 -30
View File
@@ -23,14 +23,9 @@ class Result {
// contents // contents
// this.printHowToPlay(appInfoManager.getHowToPlayText(sessionStorageManager.playingAppName));
this.printScore(); this.printScore();
this.makeStartButton(); this.makeStartButton();
this.loadHistoryRecords();
// this.printHistoryRecords();
this.loadRanking();
this.printRanking(); this.printRanking();
@@ -42,7 +37,10 @@ class Result {
screenBottom.printBottomCenterText(playingAppName); screenBottom.printBottomCenterText(playingAppName);
screenBottom.printBottomRightText(sessionStorageManager.playerName); screenBottom.printBottomRightText(sessionStorageManager.playerName);
this.loadHistoryRecords();
// this.loadTypingStageData(); // this.loadTypingStageData();
this.loadRanking();
} }
printScore() { printScore() {
@@ -90,44 +88,70 @@ class Result {
this.historyRecordManager.clear(); this.historyRecordManager.clear();
this.historyRecordManager.push(new HistoryRecordData("05/10", 15460)); this.historyRecordManager.push(new HistoryRecordData("05/10", 15460));
this.historyRecordManager.push(new HistoryRecordData("05/11", 13040)); this.historyRecordManager.push(new HistoryRecordData("05/11", 3040));
this.historyRecordManager.push(new HistoryRecordData("05/12", 16460)); this.historyRecordManager.push(new HistoryRecordData("05/12", 460));
this.historyRecordManager.push(new HistoryRecordData("05/13", 15060)); this.historyRecordManager.push(new HistoryRecordData("05/13", 60));
this.historyRecordManager.push(new HistoryRecordData("05/14", 19800)); this.historyRecordManager.push(new HistoryRecordData("05/14", 8));
this.printHistoryRecords();
} }
printHistoryRecords(historyRecords) { printHistoryRecords(historyRecords) {
let underValue = this.historyRecordManager.underValueForGraph();
let upperValue = this.historyRecordManager.upperValueForGraph();
for(let i = 0; i < this.historyRecordManager.count; i++) { for(let i = 0; i < this.historyRecordManager.count; i++) {
let data = this.historyRecordManager.getAt(i); let data = this.historyRecordManager.getAt(i);
this.printRecord(i, data.date, data.record, underValue, upperValue); this.printRecord(i, data.date, data.record);
} }
this.chartGraphics.lineStyle(3, 0xffd900, 1); // this.chartGraphics.lineStyle(3, 0xffd900, 1);
this.chartGraphics.moveTo(0, 0); // this.chartGraphics.moveTo(0, 0);
this.chartGraphics.lineTo(game.world.width - 200, 0); // this.chartGraphics.lineTo(game.world.width - 200, 0);
} }
printRecord(index, date, record, min, max) { printRecord(index, date, record) {
const CHART_GAP_PX = 180; if(sessionStorageManager.playingAppName.indexOf("typing") > -1)
const style = { font: "32px Arial", fill: "#fff", align: "left", boundsAlignH: "center", boundsAlignV: "middle" }; this.printMouseAppHistory(index, date, record);
else
this.printMouseAppHistory(index, date, record);
}
let dateText = game.add.text(100 + index * CHART_GAP_PX, game.world.height - 140, date, style); printTypingAppHistory(index, date, record) {
dateText.setTextBounds(0, 0, 100, 100); let posX = 60;
dateText.stroke = "#333"; let posY = game.world.height / 2 + 90 + 30 * index;
dateText.strokeThickness = 1;
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); let numberWithCommas = NumberUtil.numberWithCommas(record);
let recordText = game.add.text(100 + index * CHART_GAP_PX, game.world.height - 300, numberWithCommas, style); style.boundsAlignH = "right";
recordText.setTextBounds(0, 0, 100, 100); game.add.text(posX + 120, posY, numberWithCommas, style)
recordText.stroke = "#333"; .setTextBounds(0, 0, 80, 60)
recordText.strokeThickness = 1; .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
}
this.chartGraphics.lineStyle(50, 0xdddddd, 1); printMouseAppHistory(index, date, record) {
this.chartGraphics.moveTo(50 + index * CHART_GAP_PX, 0); let posX = 60;
this.chartGraphics.lineTo(50 + index * CHART_GAP_PX, -100 * ( (record - min) / (max - min) )); 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);
} }
loadRanking() { loadRanking() {