Fix: show minus record for start

This commit is contained in:
2019-09-26 18:20:48 +09:00
parent 76481a4caa
commit 301a057099
3 changed files with 58 additions and 16 deletions
+32 -8
View File
@@ -21,20 +21,44 @@ Chart.prototype.drawRecordGraph = function(index, date, bestRecord, min, max) {
if(bestRecord === "")
return;
this.drawText(
posX, posY - Chart.CHART_HEIGHT - Chart.CHART_RECORD_OFFSET_Y,
// StringUtil.getRecordTextWithoutUnit(bestRecord) + StringUtil.getScoreUnit(sessionStorageManager.playingAppID)
RecordUtil.getRecordValueWithUnit(bestRecord, sessionStorageManager.getPlayingAppID())
);
var recordTextPosY = posY - Chart.CHART_HEIGHT - Chart.CHART_RECORD_OFFSET_Y;
var absRecordValue = Math.abs(bestRecord);
var recordWithUnit = RecordUtil.getRecordValueWithUnit(absRecordValue, sessionStorageManager.getPlayingAppID());
if(bestRecord >= 0) {
this.drawText(posX, recordTextPosY, recordWithUnit);
} else {
// recordWithUnit = recordWithUnit + "/실격";
recordWithUnit = "실격/" + recordWithUnit;
this.drawDisqualificationText(posX, recordTextPosY, recordWithUnit);
}
// chart
this.chartGraphics.lineStyle(50, 0xdddddd, 1);
var chartColor = 0xffffff;
if(bestRecord >= 0)
chartColor = 0xdddddd;
else
chartColor = 0xffaaaa;
this.chartGraphics.lineStyle(50, chartColor, 1);
this.chartGraphics.moveTo(posX, posY);
this.chartGraphics.lineTo(posX, posY - Chart.CHART_HEIGHT * ( (bestRecord - min) / (max - min) ));
this.chartGraphics.lineTo(posX, posY - Chart.CHART_HEIGHT * ( (absRecordValue - min) / (max - min) ));
}
Chart.prototype.drawText = function(posX, posY, text) {
var style = { font: "24px Arial", fill: "#fff", align: "left", boundsAlignH: "center", boundsAlignV: "middle" };
var style = { font: "22px Arial", fill: "#fff", align: "left", boundsAlignH: "center", boundsAlignV: "middle" };
var textObject = game.add.text(
posX, posY,
text, style
);
textObject.anchor.set(0.5);
textObject.stroke = "#333";
textObject.strokeThickness = 3;
return textObject;
}
Chart.prototype.drawDisqualificationText = function(posX, posY, text) {
var style = { font: "22px Arial", fill: "#faa", align: "left", boundsAlignH: "center", boundsAlignV: "middle" };
var textObject = game.add.text(
posX, posY,