i++;
}
this.background = ImageManager.getGfx("space_background");
this.exploreButton = new ImageButton("exploration");
this.exploreButton.setTitle(I18n.get("planet.explore_sector"));
this.exploreButton.setActionHandler(new ActionHandler() {
@Override
public void run() {
if (PlanetState.this.selectedColony == null) {
// TODO play error sound
} else {
startZoneSelectionForExploration();
}
}
});
exploreButton.setHoverHandler(new ActionHandler() {
@Override
public void run() {
// Exploration = 2500 Gas
Map<Resource, BigDecimal> costMap = new HashMap<Resource, BigDecimal>();
costMap.put(Resource.GAS, BigDecimal.valueOf(2500));
resources.setMap(costMap);
resources.show();
}
});
add(this.exploreButton);
this.viewButton = new ImageButton("home");
this.viewButton.setTitle(I18n.get("planet.go_to_colony"));
this.viewButton.setActionHandler(new ActionHandler() {
@Override
public void run() {
if (PlanetState.this.selectedColony == null) {
// TODO play error sound
} else {
GameData.setSelectedColony(PlanetState.this.selectedColony);
GameData.getGame().enterState(AloneInSpace.SECTOR_STATE);
}
}
});
add(this.viewButton);
this.colonizeButton = new ImageButton("top_right_expand");
this.colonizeButton.setTitle(I18n.get("planet.colonize"));
this.colonizeButton.setActionHandler(new ActionHandler() {
@Override
public void run() {
if (PlanetState.this.selectedColony == null) {
// TODO play error sound
} else {
// TODO Externalize
Map<Resource, BigDecimal> costMap = new HashMap<Resource, BigDecimal>();
for (Resource r : Resource.values()) {
costMap.put(r, BigDecimal.valueOf(10000));
}
if (ResourceHelper.enoughResourcesFor(costMap)) {
startZoneSelectionForColonization();
} else {
// TODO Play error sound
}
}
}
});
this.colonizeButton.setHoverHandler(new ActionHandler() {
@Override
public void run() {
// Colonization = 10.000 each
Map<Resource, BigDecimal> costMap = new HashMap<Resource, BigDecimal>();
for (Resource r : Resource.values()) {
costMap.put(r, BigDecimal.valueOf(10000));
}
resources.setMap(costMap);
resources.show();
}
});
add(this.colonizeButton);
transferButton = new ImageButton("transfer");
transferButton.setTitle(I18n.get("planet.transfer"));
transferButton.setActionHandler(new ActionHandler() {
@Override
public void run() {