private void guessPressed() { GuessDialog gs = new GuessDialog(); assert goc.getPlayerPos().isRoom(); Card shownCard = goc.guess(gs.getGuess("Guess", goc.getPlayerPos().getRoom().getName())); if (shownCard != null) { System.out.println("show card"); List<Card> cardList = new ArrayList<Card>(); cardList.add(shownCard); new ShowCardsFrame( cardList, "You were shown the " + shownCard.getTitle() + " card!", "You were shown the " + shownCard.getTitle() + " card!\n" + "This card cannot be in the envelope!"); } endTurn(); }
private void movePressed() { if (!moveSelected && goc.canMove()) { goc.die.roll(); lbl_dice.setIcon(goc.die.getDiceIcon()); if (goc.highlightValidMoves()) { btn_guess.setEnabled(false); btn_accuse.setEnabled(false); moveSelected = true; can_board.setBoard(goc.getBoard()); } else { btn_move.setEnabled(false); JOptionPane.showMessageDialog(this, " There are no valid moves"); if (!goc.getPlayerPos().isRoom()) { endTurn(); } } } }
private void endTurn() { if (goc.checkGameOver()) { showGameOver(); return; } goc.endTurn(); can_board.setBoard(goc.getBoard()); ImageIcon img = new ImageIcon(myPicture[goc.getCurrentPlayer().getCharacter().ordinal()]); picLabel.setIcon(img); txt_name.setText(goc.getCurrentPlayer().getName()); // if new player not in room disable guess if (!goc.getPlayerPos().isRoom()) { btn_guess.setEnabled(false); } else { btn_guess.setEnabled(true); } btn_move.setEnabled(true); // JOptionPane.showMessageDialog(this, goc.getCurrentPlayer().getName() + "'s Turn"); }