Package de.ailis.xadrian.data.factories

Examples of de.ailis.xadrian.data.factories.SectorFactory


    {
        super.paintComponent(graphics);
       
        final int maxW = getWidth();
        final int maxH = getHeight();
        final SectorFactory sectorFactory = this.game.getSectorFactory();
        final int uniWidth = sectorFactory.getMaxX() * 100 + 150;
        final int uniHeight = sectorFactory.getMaxY() * 100 + 150;
        final float scaleX = (float) maxW / uniWidth;
        final float scaleY = (float) maxH / uniHeight;
        final float uniAR = (float) uniWidth / uniHeight;
        final float winAR = maxW / (float) maxH;
        final int width, height;

        if (uniAR > winAR)
        {
            width = maxW;
            height = maxW * uniHeight / uniWidth;
            this.scale = scaleX;
        }
        else
        {
            height = maxH;
            width = maxH * uniWidth / uniHeight;
            this.scale = scaleY;
        }
       
        if (width <= 0 || height <= 0) return;

        if (this.buffer == null || this.buffer.getWidth() != width
            || this.buffer.getHeight() != height)
            this.buffer = new BufferedImage(width, height,
                BufferedImage.TYPE_INT_ARGB);
        final Graphics2D g = this.buffer.createGraphics();

        final SortedSet<Sector> sectors = sectorFactory.getSectors();

        g.setColor(Color.BLACK);
        g.fillRect(0, 0, width, height);
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);
View Full Code Here


        if (version == 4) gameId = root.attributeValue("game");
        final Game game = GameFactory.getInstance().getGame(gameId);

        final Complex complex = new Complex(game);
        final FactoryFactory factoryFactory = game.getFactoryFactory();
        final SectorFactory sectorFactory = game.getSectorFactory();
        final WareFactory wareFactory = game.getWareFactory();
        final SunFactory sunsFactory = game.getSunFactory();

        complex.setSuns(sunsFactory.getSun(Integer.parseInt(root
            .attributeValue("suns"))));
        complex.setSector(sectorFactory
            .getSector(root.attributeValue("sector")));
        complex.setAddBaseComplex(Boolean.parseBoolean(root.attributeValue(
            "addBaseComplex", "false")));
        complex.showingProductionStats = Boolean.parseBoolean(root
            .attributeValue("showingProductionStats", "false"));
View Full Code Here

        this.nid = nid;
        this.messageId = "game." + id;
        this.sunFactory = new SunFactory(this);
        this.raceFactory = new RaceFactory(this);
        this.wareFactory = new WareFactory(this);
        this.sectorFactory = new SectorFactory(this);
        this.factoryFactory = new FactoryFactory(this);
    }
View Full Code Here

TOP

Related Classes of de.ailis.xadrian.data.factories.SectorFactory

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.