Package com.barrybecker4.game.multiplayer.poker.ui.chips

Examples of com.barrybecker4.game.multiplayer.poker.ui.chips.PokerChips


    void ok() {
        GameContext.setDebugMode( dbgLevelField_.getIntValue() );
        GameContext.setProfiling( profileCheckbox_.isSelected() );
        GameContext.getLogger().setDestination( logDestination_ );

        GameBoardViewer v = ((GameBoardViewer)controller_.getViewer());
        v.setBackground( boardColorButton_.getBackground() );
        v.setGridColor( gridColorButton_.getBackground() );

        LocaleType[] locales = LocaleType.values();
        GameContext.setLocale(locales[localeComboBox_.getSelectedIndex()]);

        // game specific options
View Full Code Here


     * The Orders button was pressed.
     * open the Orders dialog to get the players commands
     */
    @Override
    public void actionPerformed(ActionEvent e) {
        GalacticController gc = (GalacticController)controller_;
        gameChanged(null); // update the current player in the label

        if (e.getSource() == commandButton_) {

            // if the current player does not own any planets, then advance to the next player
            if (Galaxy.getPlanets((GalacticPlayer) gc.getCurrentPlayer()).size() == 0)  {
                gc.advanceToNextPlayer();
            }

            showOrdersDialog(gc);
        }
        else if (e.getSource() == passButton_) {
           gc.advanceToNextPlayer();
        }
    }
View Full Code Here

        viewerPanel.add( infoLabel_, BorderLayout.SOUTH);

        JPanel buttonsPanel = createButtonsPanel();

        Planet defendingPlanet =  battle_.getPlanet();
        String text = "There is a battle at "+defendingPlanet.getName()+".\n";

        descriptionLabel_.setEditable(false);
        //descriptionLabel_.setLineWrap(true);
        descriptionLabel_.setContentType("text/html");
        descriptionLabel_.setText(text);
View Full Code Here

            this.paint(this.getGraphics());
        }

        @Override
        public void run() {
             Planet destPlanet = battle_.getPlanet();
             int numAttackShips = battle_.getOrder().getFleetSize();
             int numDefendShips = destPlanet.getNumShips();
             //String defender = (destPlanet.getOwner()==null)? "Neutral" : destPlanet.getOwner().getName();

             // play back the move sequence
             List sequence = battle_.getHitSequence();
             if (sequence.isEmpty()) {
                 // reinforced!
                 GameContext.getMusicMaker().playNote( Instruments.APPLAUSE, 45, 0, 200, 1000 );
                 GameContext.getMusicMaker().playNote(70, 50, 900);
                 GameContext.getMusicMaker().playNote(90, 40, 1000);
                 descriptionLabel_.setText("Planet "+destPlanet.getName()+" has been reinforced.");
             }
             else {
                 boolean useSound = GameContext.getUseSound();
                 Iterator it = sequence.iterator();
                 if (useSound)
                     GameContext.getMusicMaker().playNote( Instruments.GUNSHOT, 45, 0, 200, 1000 );

                 while (it.hasNext()) {
                     GalacticPlayer p = (GalacticPlayer)it.next();
                     int total = numAttackShips + numDefendShips;
                     int time = 1 + BATTLE_SPEED / (1+total);
                     if (p == battle_.getOrder().getOwner()) {
                         if (useSound)
                             GameContext.getMusicMaker().playNote(100, time, 800);
                         numAttackShips--;
                     }
                     else {
                         if (useSound)
                             GameContext.getMusicMaker().playNote(80, time, 800);
                         numDefendShips--;
                     }

                     refresh(numAttackShips, numDefendShips);
                     ThreadUtil.sleep(time);
                 }
                 assert(numAttackShips == 0 || numDefendShips == 0):
                         "numAttackShips="+numAttackShips+" numDefendShips="+numDefendShips;
                 String winMessage;
                 if (numAttackShips==0)
                     winMessage = "Planet "+destPlanet.getName()+" has successfully defended itself.";
                 else
                     winMessage = battle_.getOrder().getOwner().getName()+ " has conquered planet "+destPlanet.getName();

                 descriptionLabel_.setText( "<html>"+ descriptionLabel_.getText()+ "<b>"+ winMessage +"/b></html>");
             }

             viewer_.showPlanetUnderAttack(battle_.getPlanet(), false)// battle is done
View Full Code Here

        return renderer_;
    }

    @Override
    protected int getPieceSize(int cellSize, GamePiece piece) {
        Planet planet = (Planet)piece;

        double rad = planet.getRadius();
        return (int) (cellSize * rad);
    }
View Full Code Here

        return (int) (cellSize * rad);
    }

    @Override
    protected Color getPieceColor(GamePiece piece) {
        Planet planet = (Planet)piece;
        return planet.getColor();
    }
View Full Code Here

     * @param g2 graphics context
     * @param position the position of the piece to render
     */
    @Override
    public void render( Graphics2D g2, BoardPosition position, int cellSize, int margin, Board b) {
        Planet planet = (Planet)position.getPiece();
        if (planet == null) {
            return; // nothing to render
        }

        int pieceSize = getPieceSize(cellSize, planet);
        Point pos = getPosition(position, cellSize, pieceSize, margin);
        Ellipse2D circle = new Ellipse2D.Float( pos.x, pos.y, pieceSize + 1, pieceSize + 1 );
        int hlOffset = (int) (pieceSize / 2.3 + 0.5)//spec highlight offset
        Color c = getPieceColor(planet);

        RoundGradientPaint rgp = new RoundGradientPaint(
                pos.x + hlOffset, pos.y + hlOffset, Color.white, SPEC_HIGHLIGHT_RADIUS, c );

        g2.setPaint( rgp );
        g2.fill( circle );

        if ( planet.isUnderAttack() ) {
            g2.setStroke(ATTACK_STROKE);
            g2.setColor( ATTACK_COLOR );
            g2.drawOval( pos.x, pos.y, pieceSize + 1, pieceSize + 1 );
        }

        if ( planet.isHighlighted() ) {
                g2.setStroke(HIGHLIGHT_STROKE);
                g2.setColor( HIGHLIGHT_COLOR );
                g2.drawOval( pos.x, pos.y, pieceSize + 1, pieceSize + 1 );
            }


        int offset = (pieceSize<(0.6*cellSize))? -1 : cellSize/5;
        if ( planet.getAnnotation() != null ) {
                g2.setColor( Color.black );
                g2.setFont( PLANET_FONT );
                g2.drawString( planet.getAnnotation(), pos.x + 2*offset, pos.y + 3*offset);
        }
    }
View Full Code Here

        TableModel model = table_.getModel();
        int nRows = model.getRowCount();
        PlayerList players = new PlayerList();
        for (int i=0; i<nRows; i++) {
            char planetName = (Character) model.getValueAt(i, HOME_PLANET_INDEX);
            Planet planet = Galaxy.getPlanet(planetName);
            planet.setProductionCapacity((Integer) model.getValueAt(i, PRODUCTION_INDEX));
            planet.setNumShips((Integer) (model.getValueAt(i, NUM_SHIPS_INDEX)));
            ImageIcon icon = (ImageIcon) (model.getValueAt(i, ICON_INDEX));
            players.add(GalacticPlayer.createGalacticPlayer(
                                    (String) model.getValueAt(i, NAME_INDEX),
                                    planet,
                                    (Color) model.getValueAt(i, COLOR_INDEX),
View Full Code Here

    }

    @Override
    protected Player createPlayer() {
        int ct = table_.getRowCount();
        Planet planet = new Planet((char)('A'+ct), GalacticPlayer.DEFAULT_NUM_SHIPS, 10, new ByteLocation(0,0));
        Color newColor = MultiGamePlayer.getNewPlayerColor(getPlayers());
        GalacticPlayer player = GalacticPlayer.createGalacticPlayer(
                                             "Admiral "+(ct+1), planet, newColor, true);
        planet.setOwner(player);
        return player;
    }
View Full Code Here

        if (e.getColumn() == HUMAN_INDEX)  {
            int row = e.getFirstRow();
            TableModel m = table_.getModel();
            boolean isHuman = (Boolean) m.getValueAt(row, HUMAN_INDEX);
            char c = (Character) m.getValueAt(row, HOME_PLANET_INDEX);
            Planet p = Galaxy.getPlanet(c);
            // Color color = (Color) m.getValueAt(row, COLOR_INDEX);
            // create a dummy player of the correct type and get the image icon.
            GalacticPlayer np =
                    GalacticPlayer.createGalacticPlayer("", p, Color.WHITE, isHuman);
            m.setValueAt(np.getIcon(), row, ICON_INDEX);
View Full Code Here

TOP

Related Classes of com.barrybecker4.game.multiplayer.poker.ui.chips.PokerChips

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.