@Override public void setController(IController controller) { super.setController(controller); map.setController(controller); }
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); }
@Override public void placeRobber(HexLocation hexLoc) { map.placeRobber(hexLoc); }
@Override public void placeCity(VertexLocation vertLoc, CatanColor color) { map.placeCity(vertLoc, color); }
@Override public void placeSettlement(VertexLocation vertLoc, CatanColor color) { map.placeSettlement(vertLoc, color); }
@Override public void placeRoad(EdgeLocation edgeLoc, CatanColor color) { map.placeRoad(edgeLoc, color); }
@Override public void addPort(EdgeLocation edgeLoc, PortType portType) { map.placePort(edgeLoc, portType); }
@Override public void addNumber(HexLocation hexLoc, int num) { map.addNumber(hexLoc, num); }
@Override public void addHex(HexLocation hexLoc, HexType hexType) { map.addHex(hexLoc, hexType); }
public void cancelDrop() { map.cancelDrop(); }