예제 #1
0
파일: Vue.java 프로젝트: exidhor/Bejeweled
  public boolean gestionHighScore() {
    String chemin = "HighScore.txt";

    Vector<Integer> highScores = getHighScore(chemin);

    if (highScores.size() != 0 && model.getScore() > highScores.get(highScores.size() - 1)
        || highScores.size() < 5) {
      triTableau(highScores, model.getScore());

      ecrireFichier(chemin, highScores);

      return true;
    }

    return false;
  }
예제 #2
0
파일: View.java 프로젝트: kaschenko/lab3
  public void update(Observable o, Object arg) {

    String gameStatus = model.getStatus();

    if (gameStatus.equals("finished")) {
      statusbar.setText("Game over. You won.");
    } else if (gameStatus.equals("paused")) {
      statusbar.setText("Paused");
    } else if (gameStatus.equals("game over")) {
      statusbar.setText("Game over. You lost.");
    } else {
      statusbar.setText(
          "Your score: "
              + new Integer(model.getScore()).toString()
              + ", level "
              + new Integer(model.getLevel()).toString());
      board.repaint();
    }
  }
예제 #3
0
파일: Vue.java 프로젝트: exidhor/Bejeweled
  public void drawMap() {
    contentPane.removeAll();
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
    JPanel ligneIndication = new JPanel();
    ligneIndication.setLayout(new GridLayout(1, 3));
    JPanel caseLevel = new JPanel();
    JLabel texteLevel = new JLabel("Level : ");
    caseLevel.add(texteLevel);
    level = new JLabel(String.valueOf(model.getLevel()));
    caseLevel.add(level);
    ligneIndication.add(caseLevel);

    JPanel caseTries = new JPanel();
    JLabel texteTries = new JLabel("Tries : ");
    caseTries.add(texteTries);
    tries = new JLabel(String.valueOf(model.getTries()));
    caseTries.add(tries);
    ligneIndication.add(caseTries);

    JPanel caseScore = new JPanel();
    JLabel texteScore = new JLabel("Score : ");
    caseScore.add(texteScore);
    score = new JLabel(String.valueOf(model.getScore()));
    caseScore.add(score);
    ligneIndication.add(caseScore);

    contentPane.add(ligneIndication);

    JPanel sousContentPane = new JPanel();
    sousContentPane.setLayout(new GridLayout(8, 8));
    for (int i = 0; i < tableauBijouButton.length; i++) {
      for (int j = 0; j < tableauBijouButton.length; j++) {
        sousContentPane.add(tableauBijouButton[i][j]);
        tableauBijouButton[i][j].setPreferredSize(new Dimension(60, 60));
      }
    }
    contentPane.add(sousContentPane);

    contentPane.add(progressBar.getProgressBar());

    // coloreCoupPossible();
    setContentPane(contentPane);
  }
예제 #4
0
파일: Vue.java 프로젝트: exidhor/Bejeweled
  public void partieEstPerdu(String origineFin) {
    boolean newRecord = gestionHighScore();

    StringBuilder message = new StringBuilder();

    message.append("Desole, vous n'avez plus de ");
    message.append(origineFin);
    if (newRecord) {
      message.append(", mais vous avez fait un nouveau meilleur score : " + model.getScore());
    }

    JOptionPane optionPane = new JOptionPane();
    JDialog dialog = new JDialog();
    JOptionPane.showMessageDialog(
        optionPane, message, "Game Over", JOptionPane.INFORMATION_MESSAGE);

    model.genererTableau();
    model.reinitialiser();
    progressBar = new TheProgressBar(this);
    drawMap();
    setVisible(true);
    model.setEstEnJeu(false);
  }
예제 #5
0
파일: Vue.java 프로젝트: exidhor/Bejeweled
 public void actualiserScore() {
   score.setText(String.valueOf(model.getScore()));
 }