예제 #1
0
  /**
   * PlayerHuman sends card he want to lay on table, and computers lays cards automatically.
   *
   * @param card
   */
  public void layCards(Card card) {
    player.cardOnTable(card);
    if (table.getNumberOfCards() == 0) {
      cp.addOnePoint(0);
    }

    for (int i = 0; i < computersTable.size(); i++) {
      computersTable.get(i).cardOnTable();
      if (table.getNumberOfCards() == 0) {
        // Player has index 0
        cp.addOnePoint(i + 1);
      }
    }
  }
예제 #2
0
  /**
   * Counts every players card scores and return false if game has ended.
   *
   * @return boolean
   */
  public boolean newRound() {
    table.removeCardsFromTable();
    cp.valueCards(0, player.getPointsCard());
    for (int i = 0; i < computersPlayer.size(); i++) {
      cp.valueCards(i + 1, computersPlayer.get(i).getPointsCard());
    }
    cp.roundEnd();
    boolean gameEnded = cp.gameEnded();

    if (gameEnded == false) {
      deck.newRound();
      dealNewCards();
    }

    if (gameEnded == false) {
      return true;
    } else {
      return false;
    }
  }
예제 #3
0
 /**
  * Returns cards on table.
  *
  * @return ArrayList<Card>
  */
 public ArrayList<Card> showTableCards() {
   return table.showCards();
 }
예제 #4
0
파일: POSPage.java 프로젝트: fordream/POS
  public POSPage() {
    super("POSMainPage", 1400, 800);
    data = new PosData();
    Table.setSelectedTable(-1);

    setOnAddMenuFrame(false);
    setOnTableCalculateFrame(false);
    setOnTotalCalculateFrame(false);
    setOnResetFrame(false);

    //// read File PosData
    PosFileControler posFileControler = new PosFileControler(getData());
    posFileControler.readFromFile();
    setData(posFileControler.getData());

    /* ========== Developers Label ========== */

    developersLabel = new JLabel();
    developersLabel.setText(
        "<html>Developed by KNU 컴퓨터학부 REVOLUTION<br> 박동원, 유동규, " + " 곽대훈, 이찬영</html>");
    developersLabel.setFont(new Font("맑은 고딕", Font.PLAIN, 11));
    this.add(developersLabel).setBounds(35, 728, 500, 100);

    /* ========== ========== ========== */

    /////
    // this setup
    lineBorder = new LineBorder(Color.darkGray, 1);
    this.getRootPane().setBorder(lineBorder);
    //

    // CSE lost setup
    logoLabel = new JLabel();
    logoLabel.setIcon(new ImageIcon("img/CSELogo_120_60.png"));
    this.add(logoLabel).setBounds(30, 0, 350, 60);
    //

    // CSE lost setup
    logoLabel2 = new JLabel();
    logoLabel2.setIcon(new ImageIcon("img/revolution_logo.png"));
    this.add(logoLabel2).setBounds(350, 2, 350, 60);
    //

    // posMainLabel label setup
    posMainLabel = new JLabel();
    posMainLabel.setFont(new Font("맑은 고딕", Font.BOLD, 16));
    posMainLabel.setForeground(Color.BLACK);
    posMainLabel.setText("Computer Science & Engineering POS");
    posMainLabel.setVisible(true);
    this.add(posMainLabel).setBounds(40, 30, 400, 50);
    //

    // exit button setup
    exitButton = new JButton();
    lineBorder = new LineBorder(Color.BLACK, 3);
    exitButton.setContentAreaFilled(false);
    exitButton.setIcon(new ImageIcon("img/exit_button.png"));
    exitButton.setPressedIcon(new ImageIcon("img/exit_button_press.png"));
    exitButton.setBackground(null);
    exitButton.setFont(new Font("맑은 고딕", Font.BOLD, 16));
    exitButton.setBorder(null);
    exitButton.setFocusPainted(false);
    exitButton.addActionListener(this);
    this.add(exitButton).setBounds(1360, 0, 30, 30);
    //

    // table panel setup

    menuInnerPanel = new MenuInnerPanel(getData());
    this.add(menuInnerPanel);
    //
    tableInnerPanel = new TableInnerPanel(getData(), menuInnerPanel);
    this.add(tableInnerPanel);
    menuInnerPanel.setTableInnerPanel(tableInnerPanel);

    // menu panel setup

    //

  }