Package com.jcloisterzone.board

Examples of com.jcloisterzone.board.TilePlacement


        if (sym == TileSymmetry.S4) {
            List<TilePlacement> options = new ArrayList<>(action.getOptions());
            Collections.sort(options);
            int size = options.size();
            for (int i = 0; i < size; i++) {
                TilePlacement tp = options.get(i);
                if (i == 0 || !options.get(i-1).getPosition().equals(tp.getPosition())) {
                    queue.push(new TilePlacementChoice(choice, savePoint, action, tp));
                }
            }
        } else {
            for (TilePlacement tp : action.getOptions()) {
View Full Code Here


        getServer().pass();
        return true;
    }

    protected boolean selectDummyTilePlacement(TilePlacementAction action) {
        TilePlacement nearest = null;
        Position p0 = new Position(0, 0);
        int min = Integer.MAX_VALUE;
        for (TilePlacement tp : action) {
            int dist = tp.getPosition().squareDistance(p0);
            if (dist < min) {
                min = dist;
                nearest = tp;
            }
        }
        getServer().placeTile(nearest.getRotation(), nearest.getPosition());
        return true;
    }
View Full Code Here

    @Override
    public void enter() {
      TilePlacementAction action = new TilePlacementAction(game.getCurrentTile());
      for (Entry<Position, Set<Rotation>> entry: getBoard().getAvailablePlacements().entrySet()) {
        for (Rotation rotation : entry.getValue()) {
          action.add(new TilePlacement(entry.getKey(), rotation));
        }
      }
        game.post(new SelectActionEvent(getActivePlayer(), action, false));
    }
View Full Code Here

    @Override
    public void mouseClicked(MouseEvent e, Position p) {
        if (e.getButton() == MouseEvent.BUTTON1) {
            if (getPreviewPosition() != null && isActive() && allowedRotation) {
                e.consume();
                action.perform(getClient().getServer(), new TilePlacement(p, previewRotation));
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.jcloisterzone.board.TilePlacement

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.