Fix: show failed record in result, ranking

This commit is contained in:
2019-09-27 08:26:23 +09:00
parent 301a057099
commit 963012978a
14 changed files with 180 additions and 17 deletions
+9 -1
View File
@@ -22,8 +22,11 @@ Chart.prototype.drawRecordGraph = function(index, date, bestRecord, min, max) {
return;
var recordTextPosY = posY - Chart.CHART_HEIGHT - Chart.CHART_RECORD_OFFSET_Y;
var absRecordValue = Math.abs(bestRecord);
// var absRecordValue = Math.abs(bestRecord);
var absRecordValue = bestRecord < 0 ? -1 * bestRecord : bestRecord;
// var absRecordValue = Math.abs(Math.floor(bestRecord));
var recordWithUnit = RecordUtil.getRecordValueWithUnit(absRecordValue, sessionStorageManager.getPlayingAppID());
if(bestRecord >= 0) {
this.drawText(posX, recordTextPosY, recordWithUnit);
} else {
@@ -38,9 +41,14 @@ Chart.prototype.drawRecordGraph = function(index, date, bestRecord, min, max) {
chartColor = 0xdddddd;
else
chartColor = 0xffaaaa;
if(max < absRecordValue)
max = absRecordValue * 1.1;
this.chartGraphics.lineStyle(50, chartColor, 1);
this.chartGraphics.moveTo(posX, posY);
this.chartGraphics.lineTo(posX, posY - Chart.CHART_HEIGHT * ( (absRecordValue - min) / (max - min) ));
console.log("absRecordValue : " + absRecordValue);
console.log("min : " + min);
console.log("max : " + max);
}
Chart.prototype.drawText = function(posX, posY, text) {
+22
View File
@@ -361,20 +361,24 @@ DBService.prototype.parseJSONtoRankingRecord = function(type, jsonData) {
return rankingRecordManager;
var replyJSON = null;
var rankingMinusJSON = null;
switch(type) {
case DBConnectManager.TYPE_MY_RANKING_HOUR:
case DBConnectManager.TYPE_ALL_RANKING_HOUR:
replyJSON = jsonData.rankingHour;
rankingMinusJSON = jsonData.rankingMinusHour;
break;
case DBConnectManager.TYPE_MY_RANKING_DAY:
case DBConnectManager.TYPE_ALL_RANKING_DAY:
replyJSON = jsonData.rankingDay;
rankingMinusJSON = jsonData.rankingMinusDay;
break;
case DBConnectManager.TYPE_MY_RANKING_MONTH:
case DBConnectManager.TYPE_ALL_RANKING_MONTH:
replyJSON = jsonData.rankingMonth;
rankingMinusJSON = jsonData.rankingMinusMonth;
break;
}
@@ -392,6 +396,24 @@ DBService.prototype.parseJSONtoRankingRecord = function(type, jsonData) {
rankingRecordManager.push(record);
}
if(rankingMinusJSON === null)
return rankingRecordManager;
var countMinus = rankingMinusJSON.length;
for(var i = 0; i < countMinus; i++) {
if(rankingRecordManager.hasPlayerID(rankingMinusJSON[i]["PlayerID"]))
continue;
var record = new RankingRecord(
// i + 1,
-1,
rankingMinusJSON[i]["PlayerID"],
rankingMinusJSON[i]["Name"],
rankingMinusJSON[i]["HighScore"]
);
rankingRecordManager.push(record);
}
return rankingRecordManager;
}
+1 -1
View File
@@ -69,7 +69,7 @@ HistoryRecordManager.prototype.maxValueOfArray = function() {
}
HistoryRecordManager.prototype.underValueForGraph = function() {
console.log("this.minValueOfRecord : " + this.minValueOfRecord);
// console.log("this.minValueOfRecord : " + this.minValueOfRecord);
var minNumberOfDigits = NumberUtil.numberOfDigits(this.minValueOfRecord);
var underMinValue =
Math.floor( (this.minValueOfRecord / Math.pow(10, minNumberOfDigits - 2) ) )
+10
View File
@@ -55,4 +55,14 @@ RankingRecordManager.prototype.getBestRecordAt = function(index) {
return -1;
return this.rankingRecords[index].bestRecord;
}
RankingRecordManager.prototype.hasPlayerID = function(playerID) {
var count = this.rankingRecords.length;
for(var i = 0; i < count; i++) {
if(this.getPlayerIDAt(i) == playerID)
return true;
}
return false;
}
+12 -1
View File
@@ -42,7 +42,18 @@ HistoryText.prototype.setContents = function(date, record) {
this.reset();
this.textDate.text = DateUtil.printMonthDay(date);
this.textRecord.text = RecordUtil.getRecordValueWithUnit(record, sessionStorageManager.getPlayingAppID());
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";
}
};
+34 -4
View File
@@ -103,7 +103,8 @@ RankingText.prototype.setTextRankingColor = function(text, ranking) {
}
text.fill = fillColor;
text.stroke = strokeColor;
text.strokeThickness = 2;
text.strokeThickness = 6;
text.setShadow(2, 2, "#333333", 2, false, true);
};
RankingText.prototype.setTopRankingTextColor = function(ranking) {
@@ -131,19 +132,48 @@ RankingText.prototype.setMyRankingTextColor = function() {
this.textRecord.strokeThickness = 2;
};
RankingText.prototype.setRankingMinusTextColor = function(ranking) {
// console.log(ranking);
if(ranking >= 0)
return;
var fillColor = "#ddaaaa"; // yellowgreen
// var strokeColor = "#2e8b57"; // seagreen
this.textRanking.fill = fillColor;
// this.textRanking.stroke = strokeColor;
// this.textRanking.strokeThickness = 2;
this.textPlayerName.fill = fillColor;
// this.textPlayerName.stroke = strokeColor;
// this.textPlayerName.strokeThickness = 2;
this.textRecord.fill = fillColor;
// this.textRecord.stroke = strokeColor;
// this.textRecord.strokeThickness = 2;
};
RankingText.prototype.setContents = function(playerID, ranking, playerName, record) {
this.reset();
this.playerID = playerID;
this.textRanking.text = ranking + "등";
if(record >= 0)
this.textRanking.text = ranking + "등";
else
this.textRanking.text = "실격";
this.textPlayerName.text = playerName;
this.setRecord(record, this.appID);
this.setMyRankingTextColor();
this.setTopRankingTextColor(ranking);
this.setRankingMinusTextColor(ranking);
this.setMyRankingTextColor();
};
RankingText.prototype.setRecord = function(record, appID) {
this.textRecord.text = RecordUtil.getRecordValueWithUnit(record, appID);
// this.textRecord.text = RecordUtil.getRecordValueWithUnit(record, appID);
var recordValue = record >= 0 ? record : -1 * record;
var absRecordValue = RecordUtil.getRecordValueWithUnit(
recordValue,
sessionStorageManager.getPlayingAppID()
);
this.textRecord.text = absRecordValue;
};
+3 -2
View File
@@ -413,10 +413,11 @@ var Ranking = {
var record = [];
// record[0] = jsonRankingList[i]['UserID'];
record[0] = rankingRecordManager.getPlayerIDAt(i); // playerID
record[1] = i + 1; // ranking
// record[1] = i + 1; // ranking
record[1] = rankingRecordManager.getRankAt(i);; // ranking
record[2] = rankingRecordManager.getPlayerNameAt(i);
record[3] = rankingRecordManager.getBestRecordAt(i);
// console.log("record : " + record[0] + ", " + record[1] + ", " + record[2]);
// console.log("record : " + record[0] + ", " + record[1] + ", " + record[2] + ", " + record[3]);
this.recordArray.push(record);
}
+1 -1
View File
@@ -70,7 +70,7 @@ RankingBoard.prototype.requestRanking = function(type) {
RankingBoard.prototype.onReceiveRankingData = function(type, rankingRecordManager) {
if(rankingRecordManager.getCount() == 0) {
console.log("ranking board - no data");
// console.log("ranking board - no data");
return;
}
+1 -1
View File
@@ -104,7 +104,7 @@ Result.prototype.printRecord = function() {
scoreText.style.fill = MainColor.THISTLE_STRING;
var timeoverText = this.makeDefaultText(game.world.width / 2, 225);
timeoverText.text = "== 제한 시간 초과 (기록 저장 안됨) ==";
timeoverText.text = "== 제한 시간 초과 ==";
timeoverText.fontSize = 50;
timeoverText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
timeoverText.anchor.set(0.5);
+3 -3
View File
@@ -63,7 +63,7 @@ var Start = {
sessionStorageManager.getWritingID(),
(function(replyJSON) {
console.log(replyJSON);
// console.log(replyJSON);
var highestRecordData = replyJSON["highestRecordData"];
var highestRecord = highestRecordData["highestRecord"];
this.onReceiveAppHighestRecord(highestRecord);
@@ -168,8 +168,8 @@ var Start = {
var underValue = historyRecordManager.underValueForGraph();
var upperValue = historyRecordManager.upperValueForGraph();
console.log("underValue : " + underValue);
console.log("upperValue : " + upperValue);
// console.log("underValue : " + underValue);
// console.log("upperValue : " + upperValue);
var minValue = underValue - (upperValue - underValue) / 10;
var maxValue = upperValue;// + (upperValue - underValue) / 10;