Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.47 KB | None | 0 0
  1. package AuiAs2.Model;
  2.  
  3. import AuiAs2.MathsGame;
  4. import AuiAs2.ScreenInterface;
  5.  
  6. import javax.swing.*;
  7.  
  8. public class Model implements ScreenInterface {
  9.     int CURRENT_SCORE = 0;
  10.     final int[] HIGH_SCORES = new int[ScreenInterface.Difficulty.values().length];
  11.  
  12.     private void updateScores(boolean isCorrect) {
  13.         CURRENT_SCORE = isCorrect ? CURRENT_SCORE+1 : 0;
  14.     }
  15.  
  16.     public Difficulty getSelectedDiff(ButtonModel selectedDiff) {
  17.         //butNewGame.addActionListener(e -> MathsGame.switchToGame(btgrpDiff.getSelection()));
  18.         System.out.println(selectedDiff);
  19.         return Difficulty.MEDIUM;
  20.     }
  21.     /*
  22.     private boolean checkHighScore() {
  23.         int highScore = MathsGame.HIGH_SCORES[difficulty.getSelectedIndex()];
  24.         if (currentScore > highScore) {
  25.             HIGH_SCORES[difficulty.getSelectedIndex()] = currentScore;
  26.             return true;
  27.         }
  28.         return false;
  29.     }
  30.  
  31.     private void answerCorrect() {
  32.         System.out.println("Correct!");
  33.         updateScores(true);
  34.         if(checkHighScore()){
  35.             statusLab.setText("New High Score!");
  36.         }
  37.         else {
  38.             statusLab.setText("Correct!");
  39.         }
  40.         startGame(); //starts a new round
  41.     }
  42.  
  43.     private void answerIncorrect() {
  44.         statusLab.setText("Incorrect!");
  45.         updateScores(false);
  46.         retryBut.setVisible(true); //displays button which allows user to retry without returning to setup
  47.     }
  48.     */
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement