From 463432e36995e6063b8a4cd2ed9cabe5dcd8ee0c Mon Sep 17 00:00:00 2001 From: Andy Janata Date: Tue, 7 Feb 2012 14:15:51 -0800 Subject: [PATCH] Gray out the Card Czar's hand and display a message over it. --- WebContent/cah.css | 16 ++++++++++++++++ WebContent/game.jsp | 3 +++ WebContent/js/cah.constants.js | 2 +- WebContent/js/cah.game.js | 12 ++++++++++++ src/net/socialgamer/cah/Constants.java | 2 +- 5 files changed, 33 insertions(+), 2 deletions(-) diff --git a/WebContent/cah.css b/WebContent/cah.css index ac0e0cb..ecb0418 100644 --- a/WebContent/cah.css +++ b/WebContent/cah.css @@ -283,6 +283,22 @@ span.debug { */ } +.game_hand_filter { + height: 100%; + position: relative; + background: rgba(192, 192, 192, .5); + z-index: 100; + text-align: center; +} + +.game_hand_filter_text { + height: 100%; + position: absolute; + top: 50%; + font-size: 300%; + margin-top: -30px; +} + .game_hand_cards { position: absolute; bottom: 0px; diff --git a/WebContent/game.jsp b/WebContent/game.jsp index 9b9a2b6..63b8ca5 100644 --- a/WebContent/game.jsp +++ b/WebContent/game.jsp @@ -201,6 +201,9 @@ HttpSession hSession = request.getSession(true);
+
+ +
Your Hand
diff --git a/WebContent/js/cah.constants.js b/WebContent/js/cah.constants.js index 9896591..1d57eff 100644 --- a/WebContent/js/cah.constants.js +++ b/WebContent/js/cah.constants.js @@ -170,7 +170,7 @@ cah.$.GamePlayerStatus_msg_2['playing'] = "Select a card to play."; cah.$.GamePlayerStatus_msg_2['idle'] = "Waiting for players..."; cah.$.GamePlayerStatus_msg_2['judging'] = "Select a winning card."; cah.$.GamePlayerStatus_msg_2['host'] = "Wait for players then click Start Game."; -cah.$.GamePlayerStatus_msg_2['judge'] = "You are the Card Czar this round."; +cah.$.GamePlayerStatus_msg_2['judge'] = "You are the Card Czar."; cah.$.GamePlayerStatus_msg_2['winner'] = "You have won!"; cah.$.GameState = function() { diff --git a/WebContent/js/cah.game.js b/WebContent/js/cah.game.js index be1da9c..fa5c5f7 100644 --- a/WebContent/js/cah.game.js +++ b/WebContent/js/cah.game.js @@ -558,6 +558,7 @@ cah.Game.prototype.updateUserStatus = function(playerInfo) { if (playerName == cah.nickname) { $(".game_message", this.element_).text(cah.$.GamePlayerStatus_msg_2[playerStatus]); + if (playerStatus == cah.$.GamePlayerStatus.PLAYING && this.handSelectedCard_ != null) { $(".confirm_card", this.element_).removeAttr("disabled"); } else if (playerStatus == cah.$.GamePlayerStatus.JUDGING && this.roundSelectedCard_ != null) { @@ -565,6 +566,7 @@ cah.Game.prototype.updateUserStatus = function(playerInfo) { } else { $(".confirm_card", this.element_).attr("disabled", "disabled"); } + if (playerStatus != cah.$.GamePlayerStatus.PLAYING) { if (this.handSelectedCard_ != null) { // we have a card selected, but we're changing state. this almost certainly is an @@ -574,9 +576,19 @@ cah.Game.prototype.updateUserStatus = function(playerInfo) { this.handSelectedCard_ = null; $(".selected", $(".game_hand", this.element_)).removeClass("selected"); } + if (playerStatus == cah.$.GamePlayerStatus.HOST) { $("#start_game").show(); } + + if (playerStatus == cah.$.GamePlayerStatus.JUDGE) { + $(".game_hand_filter", this.element_).removeClass("hide"); + $(".game_hand_filter_text", this.element_).text(cah.$.GamePlayerStatus_msg_2[playerStatus]); + // We need to kick it to properly re-center the text. + $(".game_hand_filter").width($(".game_hand_filter").width()); + } else if (playerStatus == cah.$.GamePlayerStatus.PLAYING) { + $(".game_hand_filter", this.element_).addClass("hide"); + } } if (playerStatus == cah.$.GamePlayerStatus.JUDGE diff --git a/src/net/socialgamer/cah/Constants.java b/src/net/socialgamer/cah/Constants.java index be713ba..7f7b064 100644 --- a/src/net/socialgamer/cah/Constants.java +++ b/src/net/socialgamer/cah/Constants.java @@ -488,7 +488,7 @@ public class Constants { public enum GamePlayerStatus implements DoubleLocalizable { HOST("host", "Host", "Wait for players then click Start Game."), IDLE("idle", "", "Waiting for players..."), - JUDGE("judge", "Card Czar", "You are the Card Czar this round."), + JUDGE("judge", "Card Czar", "You are the Card Czar."), JUDGING("judging", "Selecting", "Select a winning card."), PLAYING("playing", "Playing", "Select a card to play."), WINNER("winner", "Winner!", "You have won!");