Examples of GameModel


Examples of com.lunivore.noughtsandcrosses.game.GameModel

import com.lunivore.noughtsandcrosses.view.NoughtsAndCrossesFrame;

public class NoughtsAndCrosses {

    public NoughtsAndCrosses() {
        new NoughtsAndCrossesFrame(new GameModel());
    }
View Full Code Here

Examples of monopoly.model.game.GameModel

    /**
     * Товчка входа.
     * @param args аргументы командной строки.
     */
    public static void main(String[] args) {
        GameModel model = new GameModel();
        GameView view = new GameView(model);
        GameController controller = new GameController(model, view);

        view.setVisible(true);
    }
View Full Code Here

Examples of org.gojul.fourinaline.model.GameModel

  private synchronized void updateMainPanel(final GameModel newGameModel)
  {
    // This method is synchronized since it may be called by the client
    // thread or by the GUI.
   
    GameModel gameModel = newGameModel;
   
    if (newGameModel == null)
    {
      try
      {
        gameModel = gameClient.getGameModelImmediately();
      }
      catch (RemoteException e)
      {
        e.printStackTrace();
        gameModel = gameClient.getGameModel();
      }
    }
   
    if (gameModel == null)
    { 
      mainPanel.removeAll();
   
      JLabel label = new JLabel(GUIMessages.NO_GAME_RUNNING_MESSAGE.toString());
      label.setHorizontalAlignment(JLabel.CENTER);
      label.setVerticalAlignment(JLabel.CENTER);
      label.setOpaque(true);
      label.setBackground(Color.BLUE);
      label.setForeground(Color.WHITE);
     
      gameModelDrawPanel = null;
   
      mainPanel.add(label, BorderLayout.CENTER);
     
      statusLabel.setText(GUIMessages.NO_GAME_RUNNING_MESSAGE.toString());     
     
      localGameModel = null;
    }
    else
    {
      if (localGameModel == null)
      {
        initFulfilledMainPanel(gameModel);
      }
     
      boolean bUpdatedGame = !gameModel.equals(localGameModel);
     
      localGameModel = new GameModel(gameModel);
     
      gameModelDrawPanel.updateModel(localGameModel);
     
      PlayerMark mark = localGameModel.getCurrentPlayer();
     
View Full Code Here

Examples of org.gojul.fourinaline.model.GameModel

      {
        // We work on a local copy of the game model in order to avoid
        // some side effects due to the speed of some games.
        // In some cases the panel would not even notify that something
        // has happened.
        GameModel model = gameClient.getGameModel();
        final GameModel localModel = model != null ? new GameModel(model): null;
       
        SwingUtilities.invokeLater(new Runnable()
        {
          /**
           * @see java.lang.Runnable#run()
View Full Code Here

Examples of org.gojul.fourinaline.model.GameModel

          {
            disconnectionFromServer();
            return;
          }
         
          GameModel model = gameClient.getGameModel();
         
         
          // Updates the actions if necessary.
          if (model == null || !model.getGameStatus().equals(GameStatus.CONTINUE_STATUS))
          {
            // Well... no risk of redundant enabling
            // with the gameFinished() listener since
            // there's no thread concurrency at this stage.
            // Thus in some conditions the new game action
            // must be enabled while no game has been started
            // nor is running. In these cases the gameFinished()
            // event will never be thrown.
            newGameAction.setEnabled(isGameOwner);
            endGameAction.setEnabled(false);
          }
          // Prevents the user from ending a game when it is not up to it to play.
          // Avoids some very tricky unsolvable multithread conflicts, without being
          // surprising for the users.
          else if (model != null && model.getGameStatus().equals(GameStatus.CONTINUE_STATUS))
          {
            newGameAction.setEnabled(false);       
            endGameAction.setEnabled(isGameOwner && model.getCurrentPlayer().equals(gameClient.getPlayer().getPlayerMark()));
          }
        }
      });
    }
   
View Full Code Here

Examples of org.gojul.fourinaline.model.GameModel

      PlayerMark currentPlayerMark = null;
     
      try
      {
        commandResult = mainFrame.gameClient.newGame();
        GameModel currentModel = mainFrame.gameClient.getGameModelImmediately();
       
        // Avoids some possible multithread issues in which a
        // user may have ended a game that has just started now.
        if (currentModel != null)
          currentPlayerMark = currentModel.getCurrentPlayer();
      }
      catch (Throwable t)
      {
        t.printStackTrace();
        commandResult = false;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.