function HistoryText(x, y) { this.textDate = this.makeDateText(x, y); this.textDate.anchor.x = 1; this.textRecord = this.makeRecordText(x, y); this.textRecord.anchor.x = 1; }; HistoryText.prototype.makeText = function(x, y, fontStyle) { var text = game.add.text(x, y, "", fontStyle); text.anchor.y = 0.5; text.inputEnabled = false; text.setShadow(1, 1, 'rgba(32, 32, 32, 1)', 2); return text; }; HistoryText.prototype.makeDateText = function(x, y) { var offsetX = 50; return this.makeText(x + offsetX, y, HistoryText.FONT_STYLE); }; HistoryText.prototype.makeRecordText = function(x, y) { var offsetX = 150; return this.makeText(x + offsetX, y, HistoryText.FONT_STYLE); }; HistoryText.prototype.resetText = function(text) { text.text = ""; text.fill = "#ffffaa"; // text.stroke = "#888888"; // text.strokeThickness = 2; }; HistoryText.prototype.reset = function() { this.resetText(this.textDate); this.resetText(this.textRecord); }; HistoryText.prototype.setContents = function(date, record) { this.reset(); this.textDate.text = DateUtil.printMonthDay(date); var recordValue = record >= 0 ? record : -1 * record; var absRecordValue = RecordUtil.getRecordValueWithUnit( recordValue, sessionStorageManager.getPlayingAppID() ); if(record >= 0) { this.textRecord.text = absRecordValue; } else { this.textRecord.text = "아깝/" + absRecordValue; this.textRecord.style.fill = "#ffaaaa"; } }; HistoryText.FONT_STYLE = { font: "19px Arial", fill: "#ffc" };