示例#1
0
  // author Sheila
  public String lookAtRoom() {
    Game game = PemberleyGame.getCurrentGame();
    Room currentRoom = game.getCurrentRoom();
    String roomDescription = currentRoom.getDescription();
    roomDescription = roomDescription + "\nThese are the directions you can move from here: ";
    int i;

    if (currentRoom.getNorth() != null) {
      roomDescription = roomDescription + "NORTH ";
    }
    if (currentRoom.getWest() != null) {
      roomDescription = roomDescription + "WEST ";
    }
    if (currentRoom.getSouth() != null) {
      roomDescription = roomDescription + "SOUTH ";
    }
    if (currentRoom.getEast() != null) {
      roomDescription = roomDescription + "EAST ";
    }

    if (game.getLocalItemNames().length != 0) {
      roomDescription = roomDescription + "\nThese Items are here: ";
      for (String s : game.getLocalItemNames()) {
        roomDescription = roomDescription + s + "-";
      }
    }

    if (game.getLocalActorNames().length != 0) {
      roomDescription = roomDescription + "\nThese People are here: ";
      for (String s : game.getLocalActorNames()) {
        roomDescription = roomDescription + s + "-";
      }
    }

    String[] roomDrawing = currentRoom.getRoomDrawing();

    for (String v : roomDrawing) {
      roomDescription = roomDescription + "\n";
      roomDescription = roomDescription + v;
    }

    return roomDescription;
  }