Add: RecordUtil
This commit is contained in:
@@ -51,20 +51,22 @@ HistoryBoard.prototype.calcDate = function(daysBefore) {
|
||||
|
||||
|
||||
HistoryBoard.prototype.printRecord = function(index, date, bestRecord) {
|
||||
var posX = 60;
|
||||
var posX = 130;
|
||||
var 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, StringUtil.printMonthDay(date), style)
|
||||
.setTextBounds(0, 0, 100, 60)
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
var dateText = game.add.text(posX, posY, StringUtil.printMonthDay(date), style);
|
||||
dateText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
dateText.anchor.set(1, 0);
|
||||
|
||||
style.boundsAlignH = "right";
|
||||
game.add.text(posX + 80, posY, StringUtil.getRecordTextWithoutUnit(bestRecord), style)
|
||||
.setTextBounds(0, 0, 100, 60)
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
var recordText = game.add.text(
|
||||
posX + 120, posY,
|
||||
RecordUtil.getRecordValueWithUnit(bestRecord, sessionStorageManager.getPlayingAppID()),
|
||||
style
|
||||
);
|
||||
recordText.anchor.set(1, 0);
|
||||
recordText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
}
|
||||
|
||||
HistoryBoard.prototype.printSample = function() {
|
||||
|
||||
@@ -126,23 +126,22 @@ RankingBoard.prototype.printRecord = function(type, index, data) {
|
||||
var style = { font: "20px Arial", fill: "#fff", align: "right", boundsAlignH: "right", boundsAlignV: "top" };
|
||||
|
||||
// rank
|
||||
style.boundsAlignH = "right";
|
||||
// style.boundsAlignH = "right";
|
||||
var rankText = game.add.text(this.getPosX(type), this.getPosY(index), data.rank, style);
|
||||
// .setTextBounds(0, 0, 40, 40)
|
||||
rankText.anchor.set(1, 0);
|
||||
rankText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
|
||||
// player name
|
||||
var playerNameText = game.add.text(this.getPosX(type) + 20, this.getPosY(index), data.playerName, style);
|
||||
// .setTextBounds(0, 0, 60, 60)
|
||||
playerNameText.anchor.set(0, 0);
|
||||
playerNameText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
|
||||
// bestRecord
|
||||
var bestRecord = StringUtil.getRecordTextWithoutUnit(data.bestRecord);
|
||||
style.boundsAlignH = "right";
|
||||
var recordText = game.add.text(this.getPosX(type) + 180, this.getPosY(index), bestRecord, style);
|
||||
// .setTextBounds(0, 0, 80, 60)
|
||||
var recordText = game.add.text(
|
||||
this.getPosX(type) + 180, this.getPosY(index),
|
||||
RecordUtil.getRecordValueWithUnit(data.bestRecord, sessionStorageManager.getPlayingAppID()),
|
||||
style
|
||||
);
|
||||
recordText.anchor.set(1, 0);
|
||||
recordText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ var Result = {
|
||||
|
||||
// bottom ui
|
||||
var screenBottomUI = new ScreenBottomUI();
|
||||
screenBottomUI.printLeftTextWithAppHighestRecord(Math.floor(sessionStorageManager.getAppHighestRecord()));
|
||||
screenBottomUI.printLeftTextWithAppHighestRecord(sessionStorageManager.getAppHighestRecord());
|
||||
screenBottomUI.printCenterText(sessionStorageManager.getPlayingAppKoreanName());
|
||||
screenBottomUI.printRightText(sessionStorageManager.getPlayerName());
|
||||
},
|
||||
@@ -87,16 +87,6 @@ var Result = {
|
||||
if(sessionStorageManager.getRecord() === null)
|
||||
sessionStorageManager.setRecord(0);
|
||||
|
||||
var record = 0;
|
||||
if(sessionStorageManager.getPlayingAppID() == 104) {
|
||||
var recordTime = sessionStorageManager.getRecord();
|
||||
record = recordTime.toFixed(3);
|
||||
} else {
|
||||
record = NumberUtil.numberWithCommas(Math.floor(sessionStorageManager.getRecord()));
|
||||
}
|
||||
|
||||
style.font = "80px Arial";
|
||||
|
||||
if(isTypingPracticeApp() || isTypingTestApp()) {
|
||||
var animalLevelID = 0;
|
||||
if(isTypingPracticeApp())
|
||||
@@ -111,27 +101,17 @@ var Result = {
|
||||
rightAnimal.startAnimation(Animal.SPECIES_DATA[animalLevelID]);
|
||||
}
|
||||
|
||||
var record = sessionStorageManager.getRecord();
|
||||
style.font = "80px Arial";
|
||||
var scoreText = game.add.text(
|
||||
x, y,
|
||||
record + StringUtil.getScoreUnit(sessionStorageManager.getPlayingAppID()),
|
||||
RecordUtil.getRecordValueWithUnit(record, sessionStorageManager.getPlayingAppID()),
|
||||
style
|
||||
);
|
||||
scoreText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
scoreText.anchor.set(0.5);
|
||||
},
|
||||
|
||||
/*
|
||||
recordUnit: function() {
|
||||
var recordUnit = "";
|
||||
if(sessionStorageManager.getPlayingAppID() == 104)
|
||||
return "초";
|
||||
else if(sessionStorageManager.getPlayingAppID() >= 100)
|
||||
return "점";
|
||||
else
|
||||
return "타";
|
||||
},
|
||||
*/
|
||||
|
||||
printTodayBestRecord: function() {
|
||||
var newRecordEmitter = game.add.emitter(game.world.centerX, 140, 300);
|
||||
newRecordEmitter.makeParticles('star');
|
||||
|
||||
Reference in New Issue
Block a user