Package com.svanloon.game.wizard.network

Examples of com.svanloon.game.wizard.network.MessageParam


    Message message;
    try {
      mr2 = new MessageReceiver(ip, initialConnectionPort);
      message = mr2.receive();
      Message response = new Message(MessageType.GET_NAME);
      response.addMsgParam(new MessageParam(MessageParamConstants.PLAYER_NAME, name));
      mr2.sendMessage(response);
      mr2.close();
    } catch (UnknownHostException e2) {
      e2.printStackTrace();
      return;
View Full Code Here


  }

  private Message handleGameOver(GameOverEvent e) {
    Message msg = new Message(MessageType.GAME_OVER);
    for(String name:e.getWinningPlayers()) {
      msg.addMsgParam(new MessageParam(MessageParamConstants.PLAYER_NAME, name));
    }
    for(Integer id:e.getIds()) {
      msg.addMsgParam(new MessageParam(MessageParamConstants.PLAYER_ID, String.valueOf(id)));
    }
    return msg;
  }
View Full Code Here

  }

  private Message handleNewGame(NewGameEvent e) {
    Message msg = new Message(MessageType.NEW_GAME);
    for(String name:e.getPlayerNames()) {
      msg.addMsgParam(new MessageParam(MessageParamConstants.PLAYER_NAME, name));
    }
    for(Integer id:e.getIds()) {
      msg.addMsgParam(new MessageParam(MessageParamConstants.PLAYER_ID, String.valueOf(id)));
    }
    return msg;
  }
View Full Code Here

    return msg;
  }

  private Message handleNewRound(NewRoundEvent e) {
    Message msg = new Message(MessageType.NEW_ROUND);
    msg.addMsgParam(new MessageParam(MessageParamConstants.ROUND, String.valueOf(e.getRound())));
    return msg;
   
  }
View Full Code Here

  private Message handleNewTrump(NewTrumpEvent e) {
    Message msg = new Message(MessageType.NEW_TRUMP);
    Card card = e.getCard();
    if(card != null) {
      msg.addMsgParam(new MessageParam(MessageParamConstants.SUIT, card.getSuit().getShortName()));
      if(card.getValue() != null) {
        msg.addMsgParam(new MessageParam(MessageParamConstants.VALUE, card.getValue().getShortNm()));
      }
      msg.addMsgParam(new MessageParam(MessageParamConstants.INDEX, String.valueOf(card.getIndex())));
    }
    return msg;
   
  }
View Full Code Here

   
  }

  private Message handlePlayerBid(PlayerBidEvent e) {
    Message msg = new Message(MessageType.PLAYER_BID);
    msg.addMsgParam(new MessageParam(MessageParamConstants.BID, String.valueOf(e.getBid())));
    handlePlayerEvent(e, msg);
    return msg;
   
  }
View Full Code Here

  }

  private Message handlePlayerPlayed(PlayerPlayedEvent e) {
    Message msg = new Message(MessageType.PLAYER_PLAYED);
    Card card = e.getCard();
    msg.addMsgParam(new MessageParam(MessageParamConstants.SUIT, card.getSuit().getShortName()));
    msg.addMsgParam(new MessageParam(MessageParamConstants.VALUE, card.getValue().getShortNm()));
    msg.addMsgParam(new MessageParam(MessageParamConstants.INDEX, String.valueOf(card.getIndex())));
    handlePlayerEvent(e, msg);
    return msg;
   
  }
View Full Code Here

   * @param card
   * @throws IOException
   */
  public void sendCard(MessageType cc, Card card) throws IOException {
    Message message = new Message(cc);
    message.addMsgParam(new MessageParam(MessageParamConstants.SUIT, card.getSuit().getShortName()));
    message.addMsgParam(new MessageParam(MessageParamConstants.VALUE, card.getValue().getShortNm()));
    message.addMsgParam(new MessageParam(MessageParamConstants.INDEX, String.valueOf(card.getIndex())));
    ms.sendMessageAndGetResponse(message);
  }
View Full Code Here

  private Message handlePlayerWonTrick(PlayerWonTrickEvent e) {
    Message msg = new Message(MessageType.PLAYER_WON_TRICK);
    handlePlayerEvent(e, msg);
    Card card = e.getCard();
    msg.addMsgParam(new MessageParam(MessageParamConstants.SUIT, card.getSuit().getShortName()));
    msg.addMsgParam(new MessageParam(MessageParamConstants.VALUE, card.getValue().getShortNm()));
    msg.addMsgParam(new MessageParam(MessageParamConstants.INDEX, String.valueOf(card.getIndex())));   
    return msg;
  }
View Full Code Here

   * @param message
   * @param card
   */
  public void addCard(Message message, Card card) {
    if(card != null) {
      message.addMsgParam(new MessageParam(MessageParamConstants.SUIT, card.getSuit().getShortName()));
      if(card.getValue() != null) {
        message.addMsgParam(new MessageParam(MessageParamConstants.VALUE, card.getValue().getShortNm()));
      }
      message.addMsgParam(new MessageParam(MessageParamConstants.INDEX, String.valueOf(card.getIndex())));
    }
  }
View Full Code Here

TOP

Related Classes of com.svanloon.game.wizard.network.MessageParam

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.