From b0d148f107a56a691549b07e80d0af8336020bf9 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Mon, 25 Sep 2006 04:06:35 +0000 Subject: [PATCH] Allow "draw" text to be provided as well. Also nixed the green because it was really ugly... git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@75 c613c5cb-e716-0410-b11b-feb51c14d237 --- .../parlor/turn/client/TurnDisplay.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/java/com/threerings/parlor/turn/client/TurnDisplay.java b/src/java/com/threerings/parlor/turn/client/TurnDisplay.java index 2e9297c9..bb0b4a62 100644 --- a/src/java/com/threerings/parlor/turn/client/TurnDisplay.java +++ b/src/java/com/threerings/parlor/turn/client/TurnDisplay.java @@ -96,6 +96,15 @@ public class TurnDisplay extends JPanel _winnerText = winnerText; } + /** + * Sets the text to be displayed next to everyone's name in the event of a + * draw. + */ + public void setDrawText (String drawText) + { + _drawText = drawText; + } + /** * Set optional icons to use for identifying each player in the game. */ @@ -126,7 +135,8 @@ public class TurnDisplay extends JPanel labelC.gridwidth = GridBagConstraints.REMAINDER; Name[] names = _turnObj.getPlayers(); - boolean[] winners = ((GameObject) _turnObj).winners; + GameObject gameobj = (GameObject)_turnObj; + boolean[] winners = gameobj.winners; Name holder = _turnObj.getTurnHolder(); for (int ii=0, jj=0; ii < names.length; ii++, jj++) { if (names[ii] == null) continue; @@ -136,10 +146,12 @@ public class TurnDisplay extends JPanel if (names[ii].equals(holder)) { iconLabel.setIcon(_turnIcon); } + } else if (gameobj.isDraw()) { + iconLabel.setText(_drawText); } else if (winners[ii]) { iconLabel.setText(_winnerText); - iconLabel.setForeground(Color.GREEN); } + iconLabel.setForeground(Color.BLACK); _labels.put(names[ii], iconLabel); add(iconLabel, iconC); @@ -210,7 +222,10 @@ public class TurnDisplay extends JPanel protected Icon[] _playerIcons; /** The text to display next to a winner's name. */ - protected String _winnerText; + protected String _winnerText = ""; + + /** The text to display next to a drawing player's name. */ + protected String _drawText = ""; /** The Icon we use for indicating the turn. */ protected Icon _turnIcon;