Package de.creepsmash.common.messages.client

Examples of de.creepsmash.common.messages.client.JoinGameRequestMessage


    this.add(this.profil);
    this.add(this.help);
   
    ActionListener a1 = new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        JoinGameRequestMessage grm = new JoinGameRequestMessage();
        String pw = null;
        if (GameLobby.this.joinGame == null) {
          GameLobby.this.logger.info("Could not select the game");
          return;
        }
        if ( GameLobby.this.joinGame.getMinEloPoints() > getCore().getPlayerEloScore() && GameLobby.this.joinGame.getMinEloPoints() != 0){
          errorDialog(GameLobby.this.joinGame.getMinEloPoints() + " Score-Points required for this Game.");
          return;
        }
        if ( GameLobby.this.joinGame.getMaxEloPoints() < getCore().getPlayerEloScore() && GameLobby.this.joinGame.getMaxEloPoints() != 0){
          errorDialog("max." + GameLobby.this.joinGame.getMaxEloPoints() + " Score-Points required for this Game.");
          return;
        }
        if (!GameLobby.this.joinGame.getState().equals("waiting")){
          errorDialog("they can join only waiting game...");
          return;
        }
        if (GameLobby.this.joinGame.getPasswort().equals("yes")){
         
          UIManager.put("OptionPane.background", Color.BLACK);
          UIManager.put("Panel.background", Color.BLACK);
          UIManager.put("OptionPane.messageForeground", Color.GREEN);
          pw = JOptionPane.showInputDialog(null,"please enter a valid password for this game:")
          if (pw != null){
            if (pw.equals("")) return;
          }else{
            return;
          }
        } 
        GameLobby.this.joinGameId = GameLobby.this.joinGame.getGameId();

        grm.setGameId(GameLobby.this.joinGameId);
        grm.setPasswort(pw);
        GameLobby.this.getCore().getNetwork().sendMessage(grm);
        GameLobby.this.join.setEnabled(false);
      }
    };
    this.join.addActionListener(a1);

    join.addKeyListener(new KeyAdapter() {
      public void keyPressed(KeyEvent e) {
        JoinGameRequestMessage grm = new JoinGameRequestMessage();
        String pw = null;
        if (GameLobby.this.joinGame == null) {
          GameLobby.this.logger.info("Could not select the game");
          return;
        }
        if ( GameLobby.this.joinGame.getMinEloPoints() > getCore().getPlayerEloScore() && GameLobby.this.joinGame.getMinEloPoints() != 0){
          errorDialog(GameLobby.this.joinGame.getMinEloPoints() + " Score-Points required for this Game.");
          return;
        }
        if ( GameLobby.this.joinGame.getMaxEloPoints() < getCore().getPlayerEloScore() && GameLobby.this.joinGame.getMaxEloPoints() != 0){
          errorDialog("max." + GameLobby.this.joinGame.getMaxEloPoints() + " Score-Points required for this Game.");
          return;
        }
        if (!GameLobby.this.joinGame.getState().equals("waiting")){
          errorDialog("they can join only waiting game...");
          return;
        }
        if (GameLobby.this.joinGame.getPasswort().equals("yes")){
         
          UIManager.put("OptionPane.background", Color.BLACK);
          UIManager.put("Panel.background", Color.BLACK);
          UIManager.put("OptionPane.messageForeground", Color.GREEN);
          pw = JOptionPane.showInputDialog(null,"please enter a valid password for this game:")
          if (pw.equals("")) return;
       
        GameLobby.this.joinGameId = GameLobby.this.joinGame.getGameId();

        grm.setGameId(GameLobby.this.joinGameId);
        grm.setPasswort(pw);
        GameLobby.this.getCore().getNetwork().sendMessage(grm);
        GameLobby.this.join.setEnabled(false);
      }
    });
View Full Code Here

TOP

Related Classes of de.creepsmash.common.messages.client.JoinGameRequestMessage

Copyright © 2018 www.massapicom. 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.