Package com.svanloon.game.wizard.network

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


   * @return Message
   */
  public Message handleMessage(Message msg) {
    List<MessageParam> responseMps = new ArrayList<MessageParam>();
    List<MessageParam> mps = msg.getMsgParams();
    MessageType cc = msg.getMessageType();
    MessageType responseMessageType;
    if(cc.equals(MessageType.BID)) {
      Card card = getCard(mps);

      int min = findParameterAsInt(MessageParamConstants.MIN, mps);
      int max = findParameterAsInt(MessageParamConstants.MAX, mps);
View Full Code Here


   * Document the handleMessage method
   *
   * @param message
   */
  public void handleMessage(Message message) {
    MessageType mt = message.getMessageType();
    _logger.info("got " + mt);
    List<MessageParam> mps = message.getMsgParams();
    if(mt.equals(MessageType.GAME_OVER)) {
      Collection<String> playerNames = getPlayerNames(mps);
      Collection<Integer> ids = getPlayerIds(mps);
      listener.handleGameOver(new GameOverEvent(ids, playerNames));
    } else if(mt.equals(MessageType.HAND_DEALT)) {
      int id = getPlayerId(mps);
      listener.handleHandDealt(new HandDealtEvent(id));
    } else if(mt.equals(MessageType.NEW_GAME)) {
      List<String> playerNames = getPlayerNames(mps);
      List<Integer> ids = getPlayerIds(mps);
      listener.handleNewGame(new NewGameEvent(ids, playerNames));
    } else if(mt.equals(MessageType.NEW_ROUND)) {
      int round = getInt(mps, MessageParamConstants.ROUND);
      listener.handleNewRound(new NewRoundEvent(round));
    } else if(mt.equals(MessageType.NEW_TRICK)) {
      listener.handleNewTrick(new NewTrickEvent());
    } else if(mt.equals(MessageType.NEW_TRUMP)) {
      Card card = getCard(mps);
      listener.handleNewTrump(new NewTrumpEvent(card));
    } else if(mt.equals(MessageType.PLAYER_BID)) {
      int bid = getInt(mps, MessageParamConstants.BID);
      int id = getPlayerId(mps);
      listener.handlePlayerBid(new PlayerBidEvent(id, bid));
    } else if(mt.equals(MessageType.PLAYER_PLAYED)) {
      Card card = getCard(mps);
      int id = getPlayerId(mps);
      listener.handlePlayerPlayed(new PlayerPlayedEvent(id, card));
    } else if(mt.equals(MessageType.PLAYER_WON_TRICK)) {
      int id = getPlayerId(mps);
      Card card = getCard(mps);
      listener.handlePlayerWonTrick(new PlayerWonTrickEvent(id, card));
    } else if(mt.equals(MessageType.SCORE_EVENT)) {
      int score = getInt(mps, MessageParamConstants.SCORE);
      int id = getPlayerId(mps);
      listener.handleScore(new ScoreEvent(id, score));
    } else if(mt.equals(MessageType.PLAYER_NEEDS_TO_PLAY)) {
      int id = getPlayerId(mps);
      listener.handlePlayerNeedsToPlay(new PlayerNeedsToPlay(id));
    }
  }
View Full Code Here

TOP

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

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.