Hiding 'End Turn' button

This commit is contained in:
magenoxx 2012-06-28 00:53:59 +04:00
parent 004aa20d08
commit 25bdce4b67
3 changed files with 17 additions and 7 deletions

View file

@ -134,18 +134,17 @@ public class FeedbackPanel extends javax.swing.JPanel {
this.helper.setSpecial("Pay 2 life", true);
}
boolean yourTurn = options != null && options.containsKey("your_turn");
requestFocusIfPossible();
handleOptions(options);
this.revalidate();
this.repaint();
this.helper.setLinks(btnLeft, btnRight, btnSpecial);
// if (modal) {
// this.helper.setVisible(false);
// startModal();
// } else {
this.helper.setVisible(true);
// }
this.helper.setYourTurn(yourTurn);
this.helper.setVisible(true);
}
private void handleOptions(Map<String, Serializable> options) {

View file

@ -557,15 +557,18 @@ public class GamePanel extends javax.swing.JPanel {
public void select(String message, GameView gameView) {
updateGame(gameView);
String messageToDisplay = message;
Map<String, Serializable> options = null;
for (PlayerView playerView : gameView.getPlayers()) {
if (playerView.getPlayerId().equals(playerId)) {
if (playerView.isActive()) {
options = new HashMap<String, Serializable>();
options.put("your_turn", true);
messageToDisplay = message + " <div style='font-size:11pt'>Your turn</div>";
}
break;
}
}
this.feedbackPanel.getFeedback(FeedbackMode.SELECT, messageToDisplay, gameView.getSpecial(), null);
this.feedbackPanel.getFeedback(FeedbackMode.SELECT, messageToDisplay, gameView.getSpecial(), options);
if (PhaseManager.getInstance().isSkip(gameView, message)) {
this.feedbackPanel.doClick();
}

View file

@ -176,4 +176,12 @@ public class HelperPanel extends JPanel {
textArea.setText(message);
}
}
public void setYourTurn(boolean yourTurn) {
if (yourTurn) {
btnEndTurn.setVisible(true);
} else {
btnEndTurn.setVisible(false);
}
}
}