Package ch.sahits.game.openpatrician.model.city

Examples of ch.sahits.game.openpatrician.model.city.ICity


   */
  private static void initPlayerInCities(IPlayer player) {
    ECityName[] cityNames = ECityName.values();
    for (int i = 0; i < cityNames.length; i++) {
      try {
        ICity city =CityFactory.createCityByName(cityNames[i]);
        city.moveIn(player);
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
  }
View Full Code Here


      }
    }
   
    // Add value of all buildings
    for (ECityName cityName : ECityName.values()) {
      ICity city;
      try {
        city = CityFactory.createCityByName(cityName); // TODO refactor this as bean
        List<IBuilding> buildings = owner.findBuildings(city);
        for (IBuilding building : buildings) {
          companyValue += building.getValue();
View Full Code Here

      // Sub title (dynamic)
      // City name
      y += positions.titleHeigth;
      int leftBorderX = getBounds().x+getInset().left;
      int x = leftBorderX + 20;
      ICity cityModel = city.getCity();
      GlyphVector gv = OpenPatricianPainter.createGlyphVector(g2d, cityModel.getName()+" "+cityModel.getPopulation(), 18);
      y += (int)Math.rint(positions.titleHeigth*2/3);
      g2d.drawGlyphVector(gv, x, y);
     
      // Barrel icon
      x += (int)Math.rint(gv.getVisualBounds().getWidth())+50;
      BufferedImage barrel = loader.getImage("barrel_icon");
      BufferedImage bale = loader.getImage("bale_icon");
      g2d.drawImage(barrel, x, y-(int)Math.rint(positions.titleHeigth), null); // Is y correct ???
     
      // loaded on ship and ship capacity
      x += 50;
      IShip ship = city.getActiveShip();
      StringBuilder sb = new StringBuilder();
      sb.append(ship.getLoad()).append(" / ").append(ship.getSize()).append(" ").append(ship.getName());
      gv = OpenPatricianPainter.createGlyphVector(g2d, sb.toString(), 18);
      g2d.drawGlyphVector(gv, x, y); // TODO this is a dynamic line
     
      BufferedImage waxSeal = loader.getImage("waxseal");
      // Table header
      y += positions.lineHeight; // more space to the title
      y += positions.lineHeight;
     
      // Table
      EWare[] wares = EWare.values();
      for (EWare ware : wares) {
        // Ware name
        y += positions.lineHeight;
       
        // Available amount in the city
        AmountablePrice<EWare> wareInCity = cityModel.getWare(ware);
        int availableAmount = wareInCity.getAmount();
        int value = availableAmount; // amount available
        if (value>0){
          gv = OpenPatricianPainter.createGlyphVector(g2d, String.valueOf(value), 18);
          g2d.drawGlyphVector(gv, positions.xCity, y);
View Full Code Here

          // Create a game model based on newGame
          // Create NewGameEvent(SingePlayer) with notice of the gameModel
          try {
            int homeTownIndex = home.getSelectedIndex();
            IMap gameMap = GameFactory.createMap(); // TODO consider custom maps
            ICity homeCity = CityFactory.createCityByName(ECityName.values()[homeTownIndex]);
            IPlayer player = GameFactory.createPlayer(name.getValue(), lastName.getValue(), homeCity, male.isSelected() && !female.isSelected(),difficulity.getStartingCapital());
            RandomNameLoader shipLoader = new RandomNameLoader("shipnames.properties");
            IShip ship = ShipFactory.createCrayer(shipLoader.getRandomName(), EShipUpgrade.LEVEL1);
            player.addShipp(ship);
View Full Code Here

TOP

Related Classes of ch.sahits.game.openpatrician.model.city.ICity

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.