Add: ranking text color
This commit is contained in:
@@ -17,7 +17,7 @@ RankingText.prototype.makeText = function(x, y, fontStyle) {
|
|||||||
var text = game.add.text(x, y, "", fontStyle);
|
var text = game.add.text(x, y, "", fontStyle);
|
||||||
text.anchor.y = 0.5;
|
text.anchor.y = 0.5;
|
||||||
text.inputEnabled = false;
|
text.inputEnabled = false;
|
||||||
text.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
text.setShadow(3, 3, 'rgba(32, 32, 32, 1)', 2);
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
};
|
};
|
||||||
@@ -67,11 +67,68 @@ RankingText.prototype.makeRecordText = function(x, y) {
|
|||||||
return this.makeText(x + offsetX, y, fontStyle);
|
return this.makeText(x + offsetX, y, fontStyle);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
RankingText.prototype.resetText = function(text) {
|
||||||
|
text.text = "";
|
||||||
|
text.fill = "#ffffff";
|
||||||
|
text.stroke = "#888888";
|
||||||
|
text.strokeThickness = 2;
|
||||||
|
};
|
||||||
|
|
||||||
RankingText.prototype.reset = function() {
|
RankingText.prototype.reset = function() {
|
||||||
this.playerID = -1;
|
this.playerID = -1;
|
||||||
this.textRanking.text = "";
|
this.resetText(this.textRanking);
|
||||||
this.textPlayerName.text = "";
|
this.resetText(this.textPlayerName);
|
||||||
this.textRecord.text = "";
|
this.resetText(this.textRecord);
|
||||||
|
};
|
||||||
|
|
||||||
|
RankingText.prototype.setTextRankingColor = function(text, ranking) {
|
||||||
|
var fillColor = "";
|
||||||
|
var strokeColor = "";
|
||||||
|
switch(ranking) {
|
||||||
|
case 1:
|
||||||
|
fillColor = "#ffd700"; // gold
|
||||||
|
strokeColor = "#cd853f";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
fillColor = "#d0d0d0"; // silver
|
||||||
|
strokeColor = "#404040";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
fillColor = "#d2691e"; // bronze
|
||||||
|
strokeColor = "#8b0000";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
text.fill = fillColor;
|
||||||
|
text.stroke = strokeColor;
|
||||||
|
text.strokeThickness = 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
RankingText.prototype.setTopRankingTextColor = function(ranking) {
|
||||||
|
if(ranking < 4) {
|
||||||
|
this.setTextRankingColor(this.textRanking, ranking);
|
||||||
|
this.setTextRankingColor(this.textPlayerName, ranking);
|
||||||
|
this.setTextRankingColor(this.textRecord, ranking);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
RankingText.prototype.setMyRankingTextColor = function() {
|
||||||
|
if(sessionStorageManager.getPlayerID() != this.playerID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
console.log(this.playerID);
|
||||||
|
var fillColor = "#9acd32"; // 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) {
|
RankingText.prototype.setContents = function(playerID, ranking, playerName, record) {
|
||||||
@@ -81,6 +138,8 @@ RankingText.prototype.setContents = function(playerID, ranking, playerName, reco
|
|||||||
this.textRanking.text = ranking + "등";
|
this.textRanking.text = ranking + "등";
|
||||||
this.textPlayerName.text = playerName;
|
this.textPlayerName.text = playerName;
|
||||||
this.setRecord(record, this.appID);
|
this.setRecord(record, this.appID);
|
||||||
|
this.setMyRankingTextColor();
|
||||||
|
this.setTopRankingTextColor(ranking);
|
||||||
};
|
};
|
||||||
|
|
||||||
RankingText.prototype.setRecord = function(record, appID) {
|
RankingText.prototype.setRecord = function(record, appID) {
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ var Ranking = {
|
|||||||
posX, posY,
|
posX, posY,
|
||||||
sessionStorageManager.getPlayingAppID()
|
sessionStorageManager.getPlayingAppID()
|
||||||
);
|
);
|
||||||
this.rankingTexts[i].setContents(i, (i + 1), "박지삳", 100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user