Package com.svanloon.game.wizard.network

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


    return msg;
   
  }

  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 cc
   * @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

    msg.addMsgParam(new MessageParam(MessageParamConstants.INDEX, String.valueOf(card.getIndex())));   
    return msg;
  }

  private Message handleScore(ScoreEvent e) {
    Message msg = new Message(MessageType.SCORE_EVENT);
    msg.addMsgParam(new MessageParam(MessageParamConstants.SCORE, String.valueOf(e.getScoreChangeAmount())));
    handlePlayerEvent(e, msg);
    return msg;
  }
View Full Code Here

    handlePlayerEvent(e, msg);
    return msg;
  }

  private Message handlePlayerNeedsToPlay(PlayerNeedsToPlay e) {
    Message msg = new Message(MessageType.PLAYER_NEEDS_TO_PLAY);
    handlePlayerEvent(e, msg);
    return msg;
  }
View Full Code Here

   * @param cc
   * @return Suit
   * @throws IOException
   */
  public Suit getSuit(MessageType cc) throws IOException {
    Message message = new Message(cc);
    List<MessageParam> mps = send(message).getMsgParams();
    String suitShortName = null;
    for(MessageParam mp:mps) {
      if(mp.getName().equals(MessageParamConstants.SUIT.toString())) {
        suitShortName = mp.getValue();
View Full Code Here

   * @param cc
   * @return Card
   * @throws IOException
   */
  public Card getCard(MessageType cc) throws IOException {
    Message message = new Message(cc);
    List<MessageParam> mps = send(message).getMsgParams();
    String suitShortName = null;
    String valueShortName = null;
    int index = -1;
    for(MessageParam mp:mps) {
View Full Code Here

      message.addMsgParam(new MessageParam(MessageParamConstants.INDEX, String.valueOf(card.getIndex())));
    }
  }

  private Message send(Message msg) throws IOException {
    Message response = ms.sendMessageAndGetResponse(msg);
    return response;
  }
View Full Code Here

    } catch (IOException e1) {
      e1.printStackTrace();
    }
    try {
      while(true) {
        Message msg;
        try {
          msg = mr.receive();
          Message response = handleMessage(msg);
          mr.sendMessage(response);
        } catch (IOException e) {
          e.printStackTrace();
          return;
        }
View Full Code Here

      responseMessageType = MessageType.OK;
    } else {
      responseMessageType = MessageType.OK;
    }

    Message response = new Message(responseMessageType);
    response.setMsgParams(responseMps);
    return response;
  }
View Full Code Here

  public void run() {
    try {
      while(true) {
        try {
          Message message = emr.receive();
          handleMessage(message);
          Message m = new Message(MessageType.OK);
          emr.sendMessage(m);
        } catch (IOException e) {
          e.printStackTrace();
          return;
        }
View Full Code Here

TOP

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

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.