Also manages the level-related information and checks when a level is completed or the game is over.
Game statistics (number of aliens killed, Level completed, ...) are also calculated here. @author Mattia Capucci @author Manuel Bottazzi
67686970717273747576
this.mainFrame.replacePanel(gamePanel); } @Override public void seeHighScoresCmd() { HighScoreGUI highScore = new HighScoreGUI(); HighScoreController highScoreController = new HighScoreController(this.mainFrame, this.model); highScoreController.setView(highScore); this.mainFrame.replacePanel(highScore); }
49505152535455565758
} @Override public void resetCmd() { HighScore.getHighScore().resetHighScore(); HighScoreGUI highScoreGUI = new HighScoreGUI(); HighScoreController highScoreController = new HighScoreController(this.mainFrame, this.model); highScoreController.setView(highScoreGUI); this.mainFrame.replacePanel(highScoreGUI); }
131415161718192021
public class Main { public static void main(String[] args) { Model model = new Model(); MainMenuController c = new MainMenuController(model); MainFrame mainFrame = new MainFrame(); c.setView(mainFrame); mainFrame.setVisible(true); }
112113114115116117118119120121122
} } } public static void main(String[] args) { MainFrame mainFrame = new MainFrame(); TestCollisionsToShip test = new TestCollisionsToShip(); mainFrame.replacePanel(test.getTestPanel()); test.start(); mainFrame.setVisible(true); }
179180181182183184185186187188189190191192193194
} } public static void main(String[] args) { MainFrame mainFrame = new MainFrame(); TestCollisionsInFrame f = new TestCollisionsInFrame(); List<Individual> list = f.getList(); GamePanel game = new GamePanel(list); Control cont = new Control(list); game.addKeyListener(cont); mainFrame.replacePanel(game); TestCollisions thread = new TestCollisions(list, game); thread.start(); mainFrame.setVisible(true); }
4546474849505152
* * @param mainFrame - The {@link oop13.space.views.MainFrameInterface} to observe. */ public void setView(MainFrameInterface mainFrame) { this.mainFrame = mainFrame; MainMenu mainMenu = this.mainFrame.getMainMenu(); mainMenu.attachObserver(this); }
6364656667686970
} @Override public void submitScore() { SubmitScoreController submitScoreController = new SubmitScoreController(this.gameOver, this.model); SubmitScore subScore = new SubmitScore(model.getStatistics().getScore()); submitScoreController.setView(subScore); }