Fix: restructing session manager, ES6 -> ES5

This commit is contained in:
2018-09-14 22:22:22 +09:00
parent 72e7c1a28f
commit 3f340535ac
44 changed files with 3100 additions and 3262 deletions
+45 -51
View File
@@ -1,58 +1,52 @@
/////////////////////////////
// Record board
function RecordBoard(type) {
this.chartGraphics = game.add.graphics(0, 0);
class RecordBoard {
constructor(type) {
this.chartGraphics = game.add.graphics(0, 0);
this.printRecordBoardHeader();
this.printSeperator();
let historyBoard = new HistoryBoard(type);
let rankingBoard = new RankingBoard(type);
}
printRecordBoardHeader() {
let posX = 60;
let posY = game.world.height / 2 + 20;
var bar = game.add.graphics();
bar.beginFill(0x444444);
bar.drawRect(0, posY, game.world.width, RecordBoard.HEADER_BAR_HEIGHT_PX);
const style = { font: "32px Arial", fill: "#ffc", align: "left", boundsAlignH: "center", boundsAlignV: "middle" };
this.printHeader(posX, posY, "최근의 내 기록", style);
posX = 320;
style.fill = "#fff";
this.printHeader(posX, posY, "수업시간 순위", style);
posX = 550;
this.printHeader(posX, posY, "오늘의 순위", style);
posX = 770;
this.printHeader(posX, posY, "이달의 순위", style);
}
printHeader(x, y, title, style) {
game.add.text(x, y, title, style)
.setTextBounds(0, 0, 200, RecordBoard.HEADER_BAR_HEIGHT_PX)
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
}
printSeperator() {
const posX = 290;
const posY = 480;
this.chartGraphics.lineStyle(3, 0x444444, 1);
this.chartGraphics.moveTo(posX, posY);
this.chartGraphics.lineTo(posX, posY + 200);
}
this.printRecordBoardHeader();
this.printSeperator();
var historyBoard = new HistoryBoard(type);
var rankingBoard = new RankingBoard(type);
}
RecordBoard.prototype.printRecordBoardHeader = function() {
var posX = 60;
var posY = game.world.height / 2 + 20;
var bar = game.add.graphics();
bar.beginFill(0x444444);
bar.drawRect(0, posY, game.world.width, RecordBoard.HEADER_BAR_HEIGHT_PX);
const style = { font: "32px Arial", fill: "#ffc", align: "left", boundsAlignH: "center", boundsAlignV: "middle" };
this.printHeader(posX, posY, "최근의 내 기록", style);
posX = 320;
style.fill = "#fff";
this.printHeader(posX, posY, "수업시간 순위", style);
posX = 550;
this.printHeader(posX, posY, "오늘의 순위", style);
posX = 770;
this.printHeader(posX, posY, "이달의 순위", style);
}
RecordBoard.prototype.printHeader = function(x, y, title, style) {
game.add.text(x, y, title, style)
.setTextBounds(0, 0, 200, RecordBoard.HEADER_BAR_HEIGHT_PX)
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
}
RecordBoard.prototype.printSeperator = function() {
const posX = 290;
const posY = 480;
this.chartGraphics.lineStyle(3, 0x444444, 1);
this.chartGraphics.moveTo(posX, posY);
this.chartGraphics.lineTo(posX, posY + 200);
}
RecordBoard.HEADER_BAR_HEIGHT_PX = 60;
RecordBoard.TYPE_SAMPLE = "sample";