public GenericGame( GameProduct gameProd, Board board, BoardViewer boardViewer, MainMenuTypes mmt) { super(); this.gameProd = gameProd; this.board = board; this.boardViewer = boardViewer; boardViewer.setBoard(board); this.mainMenuType = mmt; }
public void run() { while (true) { try { boardViewer.tick(); } catch (UserInteruptException e) { GenericMainMenu mainMenu = MainMenuFactory.createMainMenu( mainMenuType, gameProd.getPlatform(), gameProd.getServices()); gameProd.getPlatform().getDisplay().setCurrent(mainMenu); } catch (GameOverException e) { GenericMainMenu mainMenu = MainMenuFactory.createMainMenu( mainMenuType, gameProd.getPlatform(), gameProd.getServices()); mainMenu.setMessage(e.getMessage()); gameProd.getPlatform().getDisplay().setCurrent(mainMenu); } try { Thread.sleep(20); } catch (Exception ex) { } } }