Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 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) {
     }
   }
 }