From bdd8316fb5484709c835523f4f3222918cb7ccc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A2=E1=84=91=E1=85=B3=E1=86=AF=20=E1=84=82?= =?UTF-8?q?=E1=85=A9=E1=84=90=E1=85=B3=E1=84=87=E1=85=AE=E1=86=A8?= Date: Wed, 16 May 2018 11:14:07 +0900 Subject: [PATCH] Add: print temp data for history board --- src/game/result/history_board.js | 83 ++++++++++++++++++++++++++++++++ src/game/result/record_board.js | 1 + src/game/result/result.js | 1 - 3 files changed, 84 insertions(+), 1 deletion(-) diff --git a/src/game/result/history_board.js b/src/game/result/history_board.js index 414134e..0fdbfe6 100644 --- a/src/game/result/history_board.js +++ b/src/game/result/history_board.js @@ -3,4 +3,87 @@ 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); + } } \ No newline at end of file diff --git a/src/game/result/record_board.js b/src/game/result/record_board.js index 0a14a77..dfb2e64 100644 --- a/src/game/result/record_board.js +++ b/src/game/result/record_board.js @@ -8,6 +8,7 @@ class RecordBoard { this.printRecordBoardHeader(); + let historyBoard = new HistoryBoard(); let rankingBoard = new RankingBoard(); } diff --git a/src/game/result/result.js b/src/game/result/result.js index bf97c05..d6a0cf4 100644 --- a/src/game/result/result.js +++ b/src/game/result/result.js @@ -27,7 +27,6 @@ class Result { this.makeStartButton(); let recordBoard = new RecordBoard(); - console.log(recordBoard); // bottom