function ScreenBottomUI() { this.dbConnectManager = new DBConnectManager(); this.bottomBarCenterY = game.world.height - ScreenBottomUI.BG_HEIGHT / 2; this.drawBG(); this.leftText = this.printText(this.leftText, "", "left"); this.centerText = this.printText(this.centerText, "", "center"); this.rightText = this.printText(this.rightText, "", "right"); } ScreenBottomUI.prototype.drawBG = function() { game.add.graphics() .beginFill(0x303030, 1) .drawRect( 0, game.world.height - ScreenBottomUI.BG_HEIGHT, game.world.width, ScreenBottomUI.BG_HEIGHT ); } ScreenBottomUI.prototype.printLeftText = function(text) { this.leftText.text = text; } ScreenBottomUI.prototype.printCenterText = function(text) { this.centerText.text = text; } ScreenBottomUI.prototype.printRightText = function(text) { this.rightText.text = text; } ScreenBottomUI.prototype.printText = function(textObject, text, align) { if(textObject !== null && textObject !== undefined) { textObject.text = ""; textObject = null; } var posX = 0; var anchorValue = 0; switch(align) { case "left": posX = ScreenBottomUI.TEXT_OFFSET; break; case "center": posX = game.world.centerX; anchorValue = 0.5; break; case "right": posX = game.world.width - ScreenBottomUI.TEXT_OFFSET; anchorValue = 1; break; } textObject = game.add.text(posX, this.bottomBarCenterY, text, this.getFontStyle()); textObject.anchor.x = anchorValue; textObject.anchor.y = 0.5; return textObject; } ScreenBottomUI.prototype.printLeftTextWithAppHighestRecord = function(bestRecord) { var roundUpBestRecord = Math.round(bestRecord); var highScoreWithCommas = NumberUtil.numberWithCommas(roundUpBestRecord); this.printLeftText("최고 기록 : " + highScoreWithCommas); } ScreenBottomUI.prototype.getFontStyle = function() { return { font: "32px Arial", fill: "#fff", align: "left", boundsAlignH: "left", boundsAlignV: "bottom" }; } ScreenBottomUI.BG_HEIGHT = 50; ScreenBottomUI.NAME_WIDTH = 200; ScreenBottomUI.TEXT_OFFSET = 10;