diff --git a/src/game/lib/text/ranking_text.js b/src/game/lib/text/ranking_text.js index 19064f0..1666452 100644 --- a/src/game/lib/text/ranking_text.js +++ b/src/game/lib/text/ranking_text.js @@ -17,7 +17,7 @@ RankingText.prototype.makeText = function(x, y, fontStyle) { var text = game.add.text(x, y, "", fontStyle); text.anchor.y = 0.5; 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; }; @@ -67,11 +67,68 @@ RankingText.prototype.makeRecordText = function(x, y) { 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() { this.playerID = -1; - this.textRanking.text = ""; - this.textPlayerName.text = ""; - this.textRecord.text = ""; + this.resetText(this.textRanking); + this.resetText(this.textPlayerName); + 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) { @@ -81,6 +138,8 @@ RankingText.prototype.setContents = function(playerID, ranking, playerName, reco this.textRanking.text = ranking + "등"; this.textPlayerName.text = playerName; this.setRecord(record, this.appID); + this.setMyRankingTextColor(); + this.setTopRankingTextColor(ranking); }; RankingText.prototype.setRecord = function(record, appID) { diff --git a/src/game/ranking/ranking.js b/src/game/ranking/ranking.js index 6b3b083..eace75b 100644 --- a/src/game/ranking/ranking.js +++ b/src/game/ranking/ranking.js @@ -80,7 +80,6 @@ var Ranking = { posX, posY, sessionStorageManager.getPlayingAppID() ); - this.rankingTexts[i].setContents(i, (i + 1), "박지삳", 100); }