Package com.drakulo.games.ais.core.building

Examples of com.drakulo.games.ais.core.building.BuildingData


  public static void loadBuildingsData() throws AisIOException {
    File folder = new File("./data/buildings");
    String[] configs = folder.list();
    File currentFile;
    BuildingData currentData;
    for (String confName : configs) {
      if (!confName.endsWith(FILE_EXT)) {
        // Ignore non config files
        continue;
      }
View Full Code Here


  public static BuildingData load(File f) throws AisIOException {
    SAXBuilder sxb = new SAXBuilder();
    try {
      Document document = sxb.build(f);
      Element root = document.getRootElement();
      BuildingData data = new BuildingData();
      List<Element> levels = root.getChild("levels").getChildren("level");
      for (Element levelElement : levels) {
        String value = levelElement.getAttributeValue("value");
        Integer level = "".equals(value) ? 0 : Integer.valueOf(value);
        data.putData(level, buildLevelData(levelElement));
      }

      return data;
    } catch (NumberFormatException e) {
      throw new AisIOException("Invalid file format for : " + f.getName());
View Full Code Here

    String name = FontHelper.firstToUpper(I18n.get(type.getI18n()));
    if (this.name.equals(name)) {
      return;
    }
    this.name = name;
    BuildingData data = BuildingIO.getBuildingData(type);
    BuildingHelper.copyMap(data.getLevelData(1).getProduction(), this.prod);
    BuildingHelper
        .copyMap(data.getLevelData(0).getUpgradeCost(), this.cost);
    BuildingHelper.copyMap(data.getLevelData(1).getStoreCapacity(),
        this.store);
  }
View Full Code Here

                  }
                });
              }
              GameData.getSelectedColony().addBuildingAction(nba);
              // Remove from the stock the building cost
              BuildingData data = BuildingIO.getBuildingData(nba
                  .getBuilding().getType());
              Map<Resource, BigDecimal> map = data
                  .getLevelData(0).getUpgradeCost();
              for (Resource r : resources) {
                GameData.getSelectedColony().updateResource(r,
                    map.get(r).negate());
              }
View Full Code Here

        // Building shortcuts are defined in buildings
        for (BuildingType t : BuildingType.values()) {
          if (t.getShortcut() != -1
              && input.isKeyPressed(t.getShortcut())) {
            // Building selected
            BuildingData data = BuildingIO.getBuildingData(t);
            BuildingAction ba = BuildingHelper.createAction(
                GameData.getSelectedColony(), t, data
                    .getLevelData(0).getUpgradeCost());
            setSelectedAction(ba);
            showBuildWindow(false);
            break;
          }
View Full Code Here

    }

    y += 25;
    x = startX;

    BuildingData data = BuildingIO.getBuildingData(this.selectedBuilding
        .getType());
    BuildingLevelData levelData = data.getLevelData(this.selectedBuilding
        .getLevel());
    Map<Resource, BigDecimal> prod = levelData.getProduction();
    Map<Resource, BigDecimal> cons = levelData.getConsumption();
    Map<Resource, BigDecimal> store = levelData.getStoreCapacity();
    Resource[] resources = Resource.values();
View Full Code Here

    final boolean actionOngoing = this.getSelectedBuildingAction() != null;

    // Show useful buttons
    // Upgrade button is shown if there is another level for the building
    BuildingData data = BuildingIO.getBuildingData(this.selectedBuilding
        .getType());
    BuildingLevelData nextLevel = data.getLevelData(this.selectedBuilding
        .getLevel() + 1);
    if (nextLevel != null) {
      // There is a level
      this.buildingButtons[0][2].show();
      // Is it OK with technologies?
View Full Code Here

TOP

Related Classes of com.drakulo.games.ais.core.building.BuildingData

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.