Package monopoly.model.personality

Examples of monopoly.model.personality.ILandOwner


     * @param p игрок.
     * @param land покупаемый земельный участок.
     * @param amount сумма сделки.
     */
    public void makePlayerBuyLand(Player p, ILand land, int amount) {
        ILandOwner owner = land.owner();
        if (owner instanceof ILandSeller) {
            ILandSeller seller = (ILandSeller) owner;
            if (p.buyLand(seller, amount, land)) {

                GameModelEvent event = new GameModelEvent(this, land, seller, p);
View Full Code Here


                c.gridx = 0;
                c.gridy = 0;

                Color color = HTMLColors.black;
                final ILandOwner owner = companyCell.owner();
                if (owner instanceof Player) {
                    color = ((Player) owner).color();
                }

                infoDialog.add(new JLabel("<html>"
                        + "Игрок <font color=" + HTMLColors.getName(p.color()) + ">"
                        + "\"" + p.name() + "\"</font>" + "остановился на ячейки"
                        + " являющейся фирмой <u>\"" + companyCell.name() + "\"</u>"
                        + " и принадлежащей игроку <font color="
                        + HTMLColors.getName(color) + ">\"" + owner.name()
                        + "\"</font>.<br>"
                        + "Оплатите арендную плату в размере <i>"
                        + companyCell.rent() + "$.</i>"
                        + "</html>"), c);

                JButton okbttn = new JButton("OK");
                okbttn.setAlignmentX(JComponent.CENTER_ALIGNMENT);
                okbttn.addActionListener(new ActionListener() {

                    public void actionPerformed(ActionEvent e) {
                        _canPlayerPaidRent = false;

                        GameViewEvent event = new GameViewEvent(this, p,
                                companyCell);
                        fireMadePlayerPayRent(event);

                        infoDialog.dispose();
                    }
                });

                c.fill = GridBagConstraints.NONE;
                c.gridy = 1;
                infoDialog.add(okbttn, c);

                infoDialog.pack();
                infoDialog.setLocationRelativeTo(this);
                infoDialog.setResizable(false);
                infoDialog.setVisible(true);

                if (_canPlayerPaidRent == true) {
                    final Dialog dialog = new JDialog();
                    dialog.setModal(true);
                    dialog.setTitle("Игрок \"" + p.name() + "\"");
                    dialog.setLayout(new GridBagLayout());

                    c = new GridBagConstraints();
                    c.fill = GridBagConstraints.BOTH;
                    c.insets = new Insets(5, 5, 5, 5);

                    final JLabel questionLbl = new JLabel();
                    final JLabel amountLbl = new JLabel();
                    final JSpinner amountSpr = new JSpinner();
                    final JButton ybttn = new JButton("Да");
                    ybttn.setAlignmentX(JComponent.CENTER_ALIGNMENT);
                    final JButton nbttn = new JButton("Нет");
                    nbttn.setAlignmentX(JComponent.CENTER_ALIGNMENT);

                    c.gridx = 0;
                    c.gridy = 0;
                    dialog.add(questionLbl, c);

                    c.gridx = 0;
                    c.gridy = 1;
                    dialog.add(amountLbl, c);

                    c.gridx = 0;
                    c.gridy = 2;
                    dialog.add(amountSpr, c);

                    c.gridx = 0;
                    c.gridy = 3;
                    c.fill = GridBagConstraints.NONE;
                    dialog.add(ybttn, c);

                    c.gridx = 0;
                    c.gridy = 4;
                    dialog.add(nbttn, c);

                    questionLbl.setText("<html>"
                            + "Желаете попробывать перекупить у игрока <font color="
                            + HTMLColors.getName(color) + ">\"" + owner.name()
                            + "\"</font> фирму <u>\"" + companyCell.name()
                            + "\"</u>?"
                            + "</html>");

                    amountLbl.setText("Предложить сумму ($):");

                    SpinnerModel sprModel = new SpinnerNumberModel(
                            companyCell.cost(), companyCell.cost(),
                            companyCell.cost() * 10, 1000);
                    amountSpr.setModel(sprModel);

                    ybttn.setActionCommand("P1");
                    ybttn.addActionListener(new ActionListener() {

                        public void actionPerformed(ActionEvent e) {
                            String actionCommand = e.getActionCommand();
                            if ("P1".equals(actionCommand)) {
                                dialog.setTitle("Игрок \"" + owner.name() + "\"");

                                questionLbl.setText("<html>"
                                        + "Игрок <font color="
                                        + HTMLColors.getName(p.color()) + ">\""
                                        + p.name() + "\"</font> предложил вам "
View Full Code Here

                + company.rent() + " $</i>"
                + "</html>"), c);

        c.gridy = 4;
        Color color = HTMLColors.black;
        ILandOwner owner = company.owner();
        if (owner instanceof Player) {
            color = ((Player) owner).color();
        }

        infoDialog.add(new JLabel("<html>"
View Full Code Here

        x = 0;
        y = CELL_HEIGHT - CELL_HEIGHT / 5;

        g.drawRect(x, y, CELL_WIDTH, CELL_HEIGHT - y);

        ILandOwner owner = company.owner();
        if (owner instanceof Player) {
            Player p = (Player) owner;

            Graphics2D g2d = (Graphics2D) g;
            GradientPaint gp = new GradientPaint(x, y, Color.WHITE,
View Full Code Here

TOP

Related Classes of monopoly.model.personality.ILandOwner

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.