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

    super.setController(controller);

    map.setController(controller);
  }
예제 #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);
    }
예제 #3
0
 @Override
 public void placeRobber(HexLocation hexLoc) {
   map.placeRobber(hexLoc);
 }
예제 #4
0
 @Override
 public void placeCity(VertexLocation vertLoc, CatanColor color) {
   map.placeCity(vertLoc, color);
 }
예제 #5
0
 @Override
 public void placeSettlement(VertexLocation vertLoc, CatanColor color) {
   map.placeSettlement(vertLoc, color);
 }
예제 #6
0
 @Override
 public void placeRoad(EdgeLocation edgeLoc, CatanColor color) {
   map.placeRoad(edgeLoc, color);
 }
예제 #7
0
 @Override
 public void addPort(EdgeLocation edgeLoc, PortType portType) {
   map.placePort(edgeLoc, portType);
 }
예제 #8
0
 @Override
 public void addNumber(HexLocation hexLoc, int num) {
   map.addNumber(hexLoc, num);
 }
예제 #9
0
 @Override
 public void addHex(HexLocation hexLoc, HexType hexType) {
   map.addHex(hexLoc, hexType);
 }
예제 #10
0
    public void cancelDrop() {

      map.cancelDrop();
    }