Package com.svanloon.game.wizard.network

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


    String name = getName();
    String ip = getIp();

    // estatablish connection with server
    MessageReceiver mr2 = null;
    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


   *
   * @param we
   * @return Message
   */
  public Message createMessage(WizardEvent we) {
    Message message;
    if(we instanceof GameOverEvent) {
      GameOverEvent event = (GameOverEvent) we;
      message = handleGameOver(event);
    }else if(we instanceof HandDealtEvent) {
      HandDealtEvent event = (HandDealtEvent) we;
View Full Code Here

    return message;
  }

  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

    }
    return msg;
  }

  private Message handleHandDealt(HandDealtEvent e) {
    Message msg = new Message(MessageType.HAND_DEALT);
    handlePlayerEvent(e, msg);
    return msg;
  }
View Full Code Here

    handlePlayerEvent(e, msg);
    return msg;
  }

  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

    return msg;
   
  }

  private Message handleNewTrick(NewTrickEvent e) {
    Message msg = new Message(MessageType.NEW_TRICK);
    return msg;
  }
View Full Code Here

    Message msg = new Message(MessageType.NEW_TRICK);
    return msg;
  }

  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

    return msg;
   
  }

  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

    return msg;
   
  }

  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

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.