Exemple #1
0
  @Override
  public void setController(IController controller) {

    super.setController(controller);

    map.setController(controller);
  }
Exemple #2
0
    public void startDrop(PieceType pieceType, CatanColor pieceColor, boolean isCancelAllowed) {

      this.setOpaque(false);
      this.setLayout(new BorderLayout());
      this.setBorder(BorderFactory.createLineBorder(Color.black, BORDER_WIDTH));

      label = new JLabel(getLabelText(pieceType), JLabel.CENTER);
      label.setOpaque(true);
      label.setBackground(Color.white);
      Font labelFont = label.getFont();
      labelFont = labelFont.deriveFont(labelFont.getStyle(), LABEL_TEXT_SIZE);
      label.setFont(labelFont);

      map = mainMap.copy();
      map.setController(getController());

      int prefWidth = (int) (mainMap.getScale() * mainMap.getPreferredSize().getWidth());
      int prefHeight = (int) (mainMap.getScale() * mainMap.getPreferredSize().getHeight());
      Dimension prefSize = new Dimension(prefWidth, prefHeight);
      map.setPreferredSize(prefSize);

      this.add(label, BorderLayout.NORTH);
      this.add(map, BorderLayout.CENTER);

      if (isCancelAllowed) {

        cancelButton = new JButton("Cancel");
        Font buttonFont = cancelButton.getFont();
        buttonFont = buttonFont.deriveFont(buttonFont.getStyle(), BUTTON_TEXT_SIZE);
        cancelButton.setFont(buttonFont);
        cancelButton.addActionListener(cancelButtonListener);
        this.add(cancelButton, BorderLayout.SOUTH);
      }

      map.startDrop(pieceType, pieceColor);
    }
Exemple #3
0
 @Override
 public void placeRobber(HexLocation hexLoc) {
   map.placeRobber(hexLoc);
 }
Exemple #4
0
 @Override
 public void placeCity(VertexLocation vertLoc, CatanColor color) {
   map.placeCity(vertLoc, color);
 }
Exemple #5
0
 @Override
 public void placeSettlement(VertexLocation vertLoc, CatanColor color) {
   map.placeSettlement(vertLoc, color);
 }
Exemple #6
0
 @Override
 public void placeRoad(EdgeLocation edgeLoc, CatanColor color) {
   map.placeRoad(edgeLoc, color);
 }
Exemple #7
0
 @Override
 public void addPort(EdgeLocation edgeLoc, PortType portType) {
   map.placePort(edgeLoc, portType);
 }
Exemple #8
0
 @Override
 public void addNumber(HexLocation hexLoc, int num) {
   map.addNumber(hexLoc, num);
 }
Exemple #9
0
 @Override
 public void addHex(HexLocation hexLoc, HexType hexType) {
   map.addHex(hexLoc, hexType);
 }
Exemple #10
0
    public void cancelDrop() {

      map.cancelDrop();
    }