Package clueless.messaging

Examples of clueless.messaging.MoveMessage


              }
            }
          }
        }
      }else if(event.getMessage() instanceof MoveMessage){
        MoveMessage msg = (MoveMessage)event.getMessage();
        // Update the spaces
        for(Location space : this.getSpaces()){
          boolean isNewLoc = false;
          boolean isOldLoc = false;
         
          if(space.getLocationType()==LocationType.HALLWAY_TYPE){
            if(msg.getOldLocation().getLocationType()==LocationType.HALLWAY_TYPE){
              if(((Hallway)space).getHallwayName() == ((Hallway)msg.getOldLocation()).getHallwayName()){
                isOldLoc = true;
              }
            }
            if(msg.getNewLocation().getLocationType()==LocationType.HALLWAY_TYPE){
              if(((Hallway)space).getHallwayName() == ((Hallway)msg.getNewLocation()).getHallwayName()){
                isNewLoc = true;
              }
            }
          }else if (space.getLocationType()==LocationType.ROOM_TYPE){
            if(msg.getOldLocation().getLocationType()==LocationType.ROOM_TYPE){
              if(((Room)space).getRoomName() == ((Room)msg.getOldLocation()).getRoomName()){
                isOldLoc = true;
              }
            }
            if(msg.getNewLocation().getLocationType()==LocationType.ROOM_TYPE){
              if(((Room)space).getRoomName() == ((Room)msg.getNewLocation()).getRoomName()){
                isNewLoc = true;
              }
            }
          }
         
          if(isOldLoc){
            space.setCharacterName(null);
            space.setPlayer(null);
          }
          if(isNewLoc){
            space.setCharacterName(msg.getCharacterName());
            // Now figure our which player should go there
            for(Player player : this.players){
              if(player.getCharacter() == msg.getCharacterName()){
                space.setPlayer(player);
              }
            }
          }
          isOldLoc = false;
View Full Code Here


        for(CharacterName name : msg.getNames()){
          initializeBoardPawn(name);
          this.boardPane.repaint();
        }
      }else if(event.getMessage() instanceof MoveMessage){
        MoveMessage msg = (MoveMessage)event.getMessage();
        movePawn(msg.getCharacterName(), msg.getOldLocation(), msg.getNewLocation());
      }else if (event.getMessage() instanceof AvailableMoveMessage){
        AvailableMoveMessage msg = (AvailableMoveMessage)event.getMessage();
        for(Location location : msg.getLocations()){
          this.showButton(location, msg.getCharacterName());
        }
      }
    }
  }
View Full Code Here

    } else if(event.getMessage() instanceof GetMoveMessage){
      if(isServer){
        GetMoveMessage msg = (GetMoveMessage) event.getMessage();
        for(Location space : game.getSpaces()){
          if(space.getCharacterName() == msg.getCharacterName()){
            server.sendAll(new MoveMessage(msg.getCharacterName(), msg.getNewLocation(), space));
            return;
          }
        }
      }
    } else if(event.getMessage() instanceof DrawPawnsMessage){
View Full Code Here

TOP

Related Classes of clueless.messaging.MoveMessage

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.