Added specialists and great person generation!
BIN
android/assets/ImprovementIcons/Academy_(Civ5).png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
android/assets/ImprovementIcons/Customs_house_(Civ5).png
Normal file
After Width: | Height: | Size: 5.5 KiB |
BIN
android/assets/ImprovementIcons/Landmark_(Civ5).png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
android/assets/ImprovementIcons/Manufactory_(Civ5).png
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
android/assets/StatIcons/Great_artist_(Civ5).png
Normal file
After Width: | Height: | Size: 77 KiB |
BIN
android/assets/StatIcons/Great_engineer_(Civ5).png
Normal file
After Width: | Height: | Size: 45 KiB |
BIN
android/assets/StatIcons/Great_merchant_(Civ5).png
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
android/assets/StatIcons/Great_scientist_(Civ5).png
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
android/assets/StatIcons/populationBlue.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
android/assets/StatIcons/populationBrown.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
android/assets/StatIcons/populationGray.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
android/assets/StatIcons/populationGreen.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
android/assets/StatIcons/populationPurple.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
android/assets/StatIcons/populationYellow.png
Normal file
After Width: | Height: | Size: 12 KiB |
@ -20,7 +20,7 @@
|
||||
},
|
||||
{
|
||||
name:"Granary",
|
||||
description: "Wheat, bananas and deer produce +1 food.",
|
||||
description: "",
|
||||
food:2,
|
||||
resourceBonusStats:{food:1},
|
||||
maintainance:1,
|
||||
@ -80,7 +80,7 @@
|
||||
greatPersonPoints:{production:1},
|
||||
isWonder:true,
|
||||
unique:"WorkerConstruction",
|
||||
requiredTech:"Writing"
|
||||
requiredTech:"Masonry"
|
||||
},
|
||||
{
|
||||
name:"Temple",
|
||||
@ -111,7 +111,7 @@
|
||||
},
|
||||
{
|
||||
name:"Stable",
|
||||
description: "Cattle, sheep and horses provide +1 production.",
|
||||
description: "",
|
||||
maintainance:1,
|
||||
requiredNearbyImprovedResources:["Horses","Sheep","Cattle"]
|
||||
resourceBonusStats:{production:1},
|
||||
@ -169,6 +169,14 @@
|
||||
isWonder:true,
|
||||
requiredTech:"Theology"
|
||||
},
|
||||
{
|
||||
name:"Hagia Sophia",
|
||||
description: "+33% great person generation in all cities",
|
||||
culture:1,
|
||||
isWonder:true,
|
||||
unique:"GreatPersonGenerationIncrease",
|
||||
requiredTech:"Theology"
|
||||
},
|
||||
{
|
||||
name:"Chichen Itza",
|
||||
description: "Length of golden ages increased +50%",
|
||||
@ -355,7 +363,7 @@
|
||||
},
|
||||
{
|
||||
name:"The Louvre",
|
||||
description: "Free Great Artist appears near the city - TODO",
|
||||
description: "Free Great Artist appears near the city",
|
||||
culture:1,
|
||||
happiness:4,
|
||||
isWonder:true,
|
||||
|
@ -56,7 +56,7 @@
|
||||
name:"The Wheel",
|
||||
row:6,
|
||||
prerequisites:["Animal Husbandry"],
|
||||
description:"Allows construction or roads to your capilat city, providing gold from trade"
|
||||
description:"Allows construction of roads to your capital city, providing gold from trade"
|
||||
},
|
||||
{
|
||||
name:"Masonry",
|
||||
@ -127,7 +127,7 @@
|
||||
name:"Theology",
|
||||
row:2,
|
||||
prerequisites:["Calendar","Philosophy"],
|
||||
description:"Unclear what this does in Vanilla civ"
|
||||
description:"Enables construction of Monasteries, the Hagia Sophia and Notre Dame, providing culture, Great Person generation, and happiness, respectively"
|
||||
},
|
||||
{
|
||||
name:"Civil Service",
|
||||
@ -228,7 +228,7 @@
|
||||
name:"Printing Press",
|
||||
row:8,
|
||||
prerequisites:["Machinery","Physics"],
|
||||
description:"Eables construction of the Theatre and Taj Mahal, increasing happiness"
|
||||
description:"Enables construction of the Theatre and Taj Mahal, increasing happiness"
|
||||
},
|
||||
{
|
||||
name:"Gunpowder",
|
||||
|
@ -151,7 +151,8 @@
|
||||
terrainsCanBeFoundOn:["Grassland","Plains","Desert","Hill"],
|
||||
gold:2,
|
||||
improvement:"Mine",
|
||||
improvementStats:{gold:1}
|
||||
improvementStats:{gold:1},
|
||||
building:"Mint"
|
||||
},
|
||||
{
|
||||
name:"Silver",
|
||||
@ -159,7 +160,8 @@
|
||||
terrainsCanBeFoundOn:["Desert","Tundra","Hill"],
|
||||
gold:2,
|
||||
improvement:"Mine",
|
||||
improvementStats:{gold:1}
|
||||
improvementStats:{gold:1},
|
||||
building:"Mint"
|
||||
},
|
||||
{
|
||||
name:"Incense",
|
||||
@ -167,7 +169,8 @@
|
||||
terrainsCanBeFoundOn:["Plains","Desert"],
|
||||
gold:3,
|
||||
improvement:"Plantation",
|
||||
improvementStats:{gold:1}
|
||||
improvementStats:{gold:1},
|
||||
building:"Monastery"
|
||||
},
|
||||
{
|
||||
name:"Ivory",
|
||||
@ -199,7 +202,8 @@
|
||||
terrainsCanBeFoundOn:["Grassland","Plains"],
|
||||
gold:2,
|
||||
improvement:"Plantation",
|
||||
improvementStats:{gold:1}
|
||||
improvementStats:{gold:1},
|
||||
building:"Monastery"
|
||||
},
|
||||
{
|
||||
name:"Sugar",
|
||||
|
BIN
android/assets/skin/whiteDot.png
Normal file
After Width: | Height: | Size: 120 B |
@ -165,6 +165,7 @@ public class CityConstructions
|
||||
CivilizationInfo.current().civStats.gold -= getConstruction(buildingName).getGoldCost();
|
||||
getConstruction(buildingName).postBuildEvent(this);
|
||||
if(currentConstruction.equals(buildingName)) chooseNextConstruction();
|
||||
getCity().updateCityStats();
|
||||
}
|
||||
|
||||
public String getCityProductionTextForCityButton(){
|
||||
|
@ -19,6 +19,7 @@ public class CityInfo {
|
||||
private int tilesClaimed;
|
||||
public int population = 1;
|
||||
public int foodStored = 0;
|
||||
public FullStats specialists = new FullStats();
|
||||
|
||||
public FullStats cityStats; // This is so we won't have to calculate this multiple times - takes a lot of time, especially on phones!
|
||||
|
||||
@ -95,17 +96,15 @@ public class CityInfo {
|
||||
return cityResources;
|
||||
}
|
||||
|
||||
private int getWorkingPopulation() {
|
||||
return getTilesInRange().count(new Predicate<TileInfo>() {
|
||||
public int getFreePopulation() {
|
||||
int workingPopulation = getTilesInRange().count(new Predicate<TileInfo>() {
|
||||
@Override
|
||||
public boolean evaluate(TileInfo arg0) {
|
||||
return name.equals(arg0.workingCity);
|
||||
}
|
||||
})-1; // 1 is the city center
|
||||
}
|
||||
|
||||
public int getFreePopulation() {
|
||||
return population - getWorkingPopulation();
|
||||
int specialistNum = (int) (specialists.science+specialists.production+specialists.culture+specialists.gold);
|
||||
return population - workingPopulation - specialistNum;
|
||||
}
|
||||
|
||||
public boolean hasNonWorkingPopulation() {
|
||||
@ -121,6 +120,12 @@ public class CityInfo {
|
||||
if (name.equals(cell.workingCity))
|
||||
stats.add(cell.getTileStats(this));
|
||||
|
||||
// Specialists
|
||||
stats.culture+=specialists.culture*3;
|
||||
stats.production+=specialists.production*2;
|
||||
stats.science+=specialists.science*3;
|
||||
stats.gold+=specialists.gold*2;
|
||||
|
||||
//idle ppl
|
||||
stats.production += getFreePopulation();
|
||||
|
||||
@ -200,6 +205,14 @@ public class CityInfo {
|
||||
addNewTile();
|
||||
CivilizationInfo.current().notifications.add(name+" has expanded its borders!");
|
||||
}
|
||||
|
||||
CivilizationInfo civInfo = CivilizationInfo.current();
|
||||
float greatPersonGenerationMultiplier = 3;
|
||||
if(civInfo.getBuildingUniques().contains("GreatPersonGenerationIncrease")) greatPersonGenerationMultiplier*=1.33;
|
||||
civInfo.greatPersonPoints.gold+=specialists.gold*greatPersonGenerationMultiplier;
|
||||
civInfo.greatPersonPoints.production+=specialists.production*greatPersonGenerationMultiplier;
|
||||
civInfo.greatPersonPoints.culture+=specialists.culture*greatPersonGenerationMultiplier;
|
||||
civInfo.greatPersonPoints.science+=specialists.science*greatPersonGenerationMultiplier;
|
||||
}
|
||||
|
||||
private void addNewTile(){
|
||||
|
@ -80,11 +80,16 @@ public class CivilizationInfo {
|
||||
|
||||
if(cities.size() > 0) tech.nextTurn((int)nextTurnStats.science);
|
||||
|
||||
for (CityInfo city : cities) city.nextTurn();
|
||||
for (CityInfo city : cities) {
|
||||
city.nextTurn();
|
||||
}
|
||||
|
||||
for(TileInfo tile : tileMap.values()) tile.nextTurn();
|
||||
|
||||
checkGreatPersonGeneration();
|
||||
|
||||
for (CityInfo city : cities) city.updateCityStats();
|
||||
|
||||
turns++;
|
||||
if(isGoldenAge()) turnsLeftForCurrentGoldenAge--;
|
||||
|
||||
@ -95,10 +100,39 @@ public class CivilizationInfo {
|
||||
}
|
||||
}
|
||||
|
||||
public void addGreatPerson(String unitName){ // This is also done by some wonders and social policies, remember
|
||||
tileMap.placeUnitNearTile(cities.get(0).cityLocation,unitName);
|
||||
notifications.add("A "+unitName+" has been born!");
|
||||
}
|
||||
|
||||
public void checkGreatPersonGeneration(){
|
||||
if(greatPersonPoints.science>pointsForNextGreatPerson){
|
||||
greatPersonPoints.science-=pointsForNextGreatPerson;
|
||||
pointsForNextGreatPerson*=2;
|
||||
addGreatPerson("Great Scientist");
|
||||
}
|
||||
if(greatPersonPoints.production>pointsForNextGreatPerson){
|
||||
greatPersonPoints.production-=pointsForNextGreatPerson;
|
||||
pointsForNextGreatPerson*=2;
|
||||
addGreatPerson("Great Engineer");
|
||||
}
|
||||
if(greatPersonPoints.culture>pointsForNextGreatPerson){
|
||||
greatPersonPoints.culture-=pointsForNextGreatPerson;
|
||||
pointsForNextGreatPerson*=2;
|
||||
addGreatPerson("Great Artist");
|
||||
}
|
||||
if(greatPersonPoints.gold>pointsForNextGreatPerson){
|
||||
greatPersonPoints.gold-=pointsForNextGreatPerson;
|
||||
pointsForNextGreatPerson*=2;
|
||||
addGreatPerson("Great Merchant");
|
||||
}
|
||||
}
|
||||
|
||||
public void enterGoldenAge(){
|
||||
int turnsToGoldenAge = 10;
|
||||
if(getBuildingUniques().contains("GoldenAgeLengthIncrease")) turnsToGoldenAge*=1.5;
|
||||
turnsLeftForCurrentGoldenAge += turnsToGoldenAge;
|
||||
notifications.add("You have entered a golden age!");
|
||||
}
|
||||
|
||||
public CivStats getStatsForNextTurn() {
|
||||
|
@ -126,7 +126,7 @@ public class TileMap{
|
||||
}
|
||||
|
||||
public void placeUnitNearTile(Vector2 position, final String unit){
|
||||
getTilesInDistance(position,1).first(new Predicate<TileInfo>() {
|
||||
getTilesInDistance(position,2).first(new Predicate<TileInfo>() {
|
||||
@Override
|
||||
public boolean evaluate(TileInfo arg0) {
|
||||
return arg0.unit==null;
|
||||
|
@ -1,14 +1,11 @@
|
||||
package com.unciv.game;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.badlogic.gdx.graphics.Pixmap.Blending;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.scenes.scene2d.Group;
|
||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||
import com.badlogic.gdx.scenes.scene2d.Touchable;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||
@ -16,13 +13,15 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
import com.unciv.civinfo.CityInfo;
|
||||
import com.unciv.civinfo.CivilizationInfo;
|
||||
import com.unciv.civinfo.IConstruction;
|
||||
import com.unciv.civinfo.TileInfo;
|
||||
import com.unciv.game.pickerscreens.ConstructionPickerScreen;
|
||||
import com.unciv.game.utils.CameraStageBaseScreen;
|
||||
import com.unciv.game.utils.HexMath;
|
||||
import com.unciv.game.utils.ImageGetter;
|
||||
import com.unciv.models.gamebasics.Building;
|
||||
import com.unciv.models.stats.FullStats;
|
||||
|
||||
@ -30,16 +29,19 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
public class CityScreen extends com.unciv.game.utils.CameraStageBaseScreen {
|
||||
public class CityScreen extends CameraStageBaseScreen {
|
||||
|
||||
TileInfo selectedTile = null;
|
||||
float buttonScale = game.settings.buttonScale;
|
||||
Table TileTable = new Table();
|
||||
Table BuildingsTable = new Table();
|
||||
Table CityStatsTable = new Table();
|
||||
Table CityPickerTable = new Table();
|
||||
TextButton TechButton = new TextButton("Exit city",skin);
|
||||
public ArrayList<TileGroup> tileGroups = new ArrayList<TileGroup>();
|
||||
|
||||
public CityInfo getCity(){return game.civInfo.getCurrentCity();}
|
||||
|
||||
public CityScreen(final UnCivGame game) {
|
||||
super(game);
|
||||
new Label("",skin).getStyle().font.getData().setScale(game.settings.labelScale);
|
||||
@ -47,22 +49,96 @@ public class CityScreen extends com.unciv.game.utils.CameraStageBaseScreen {
|
||||
addTiles();
|
||||
stage.addActor(TileTable);
|
||||
|
||||
|
||||
Drawable tileTableBackground = new TextureRegionDrawable(new TextureRegion(new Texture("skin/tileTableBackground.png")))
|
||||
Drawable tileTableBackground = ImageGetter.getDrawable("skin/tileTableBackground.png")
|
||||
.tint(new Color(0x0040804f));
|
||||
tileTableBackground.setMinHeight(0);
|
||||
tileTableBackground.setMinWidth(0);
|
||||
TileTable.setBackground(tileTableBackground);
|
||||
|
||||
Table BuildingsTableContainer = new Table();
|
||||
BuildingsTableContainer.pad(20);
|
||||
BuildingsTableContainer.setBackground(tileTableBackground);
|
||||
BuildingsTableContainer.add(new Label("Buildings",skin)).row();
|
||||
updateBuildingsTable();
|
||||
ScrollPane buildingsScroll = new ScrollPane(BuildingsTable);
|
||||
BuildingsTableContainer.add(buildingsScroll).height(stage.getHeight()/2);
|
||||
|
||||
BuildingsTableContainer.pack();
|
||||
BuildingsTableContainer.setPosition(stage.getWidth()-BuildingsTableContainer.getWidth(),
|
||||
stage.getHeight()-BuildingsTableContainer.getHeight());
|
||||
|
||||
CityStatsTable.setBackground(tileTableBackground);
|
||||
updateCityTable();
|
||||
stage.addActor(CityStatsTable);
|
||||
|
||||
updateGoToWorldButton();
|
||||
stage.addActor(TechButton);
|
||||
|
||||
updateCityPickerTable();
|
||||
stage.addActor(CityPickerTable);
|
||||
stage.addActor(BuildingsTableContainer);
|
||||
update();
|
||||
}
|
||||
|
||||
private void update(){
|
||||
updateBuildingsTable();
|
||||
updateCityPickerTable();
|
||||
updateCityTable();
|
||||
updateGoToWorldButton();
|
||||
updateTileTable();
|
||||
updateTileGroups();
|
||||
}
|
||||
|
||||
|
||||
private void updateTileGroups(){
|
||||
for(TileGroup HG : tileGroups) {
|
||||
HG.update();
|
||||
}
|
||||
}
|
||||
|
||||
private Image getSpecialistIcon(String imageName, final boolean isFilled, final FullStats specialistType) {
|
||||
Image specialist = ImageGetter.getImage(imageName);
|
||||
specialist.setSize(20,20);
|
||||
if(!isFilled) specialist.setColor(Color.GRAY);
|
||||
specialist.addListener(new ClickListener(){
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
if(isFilled) getCity().specialists.add(specialistType.minus()); //unassign
|
||||
else if(getCity().getFreePopulation()==0) return;
|
||||
else getCity().specialists.add(specialistType); //assign!
|
||||
getCity().updateCityStats();
|
||||
update();
|
||||
}
|
||||
});
|
||||
return specialist;
|
||||
}
|
||||
|
||||
private void updateBuildingsTable(){
|
||||
BuildingsTable.clear();
|
||||
|
||||
|
||||
for(Building building : getCity().cityConstructions.getBuiltBuildings()){
|
||||
BuildingsTable.add(new Label(building.name,skin)).pad(10);
|
||||
if(building.specialistSlots==null) BuildingsTable.add();
|
||||
else {
|
||||
Table specialists = new Table();
|
||||
specialists.row().size(20).pad(10);
|
||||
for (int i = 0; i < building.specialistSlots.production; i++) {
|
||||
specialists.add(getSpecialistIcon("StatIcons/populationBrown.png",
|
||||
getCity().specialists.production > i, new FullStats(){{production=1;}}) );
|
||||
}
|
||||
for (int i = 0; i < building.specialistSlots.science; i++) {
|
||||
specialists.add(getSpecialistIcon("StatIcons/populationBlue.png",
|
||||
getCity().specialists.science > i, new FullStats(){{science=1;}}) );
|
||||
}
|
||||
for (int i = 0; i < building.specialistSlots.culture; i++) {
|
||||
specialists.add(getSpecialistIcon("StatIcons/populationPurple.png",
|
||||
getCity().specialists.culture > i, new FullStats(){{culture=1;}}) );
|
||||
}
|
||||
for (int i = 0; i < building.specialistSlots.gold; i++) {
|
||||
specialists.add(getSpecialistIcon("StatIcons/populationYellow.png",
|
||||
getCity().specialists.gold > i, new FullStats(){{gold=1;}}) );
|
||||
}
|
||||
BuildingsTable.add(specialists);
|
||||
}
|
||||
BuildingsTable.row();
|
||||
}
|
||||
BuildingsTable.pack();
|
||||
}
|
||||
|
||||
private void updateCityPickerTable() {
|
||||
@ -73,7 +149,7 @@ public class CityScreen extends com.unciv.game.utils.CameraStageBaseScreen {
|
||||
prevCityButton.addListener(new ClickListener() {
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
com.unciv.civinfo.CivilizationInfo ci = game.civInfo;
|
||||
CivilizationInfo ci = game.civInfo;
|
||||
if (ci.currentCity == 0) ci.currentCity = ci.cities.size()-1;
|
||||
else ci.currentCity--;
|
||||
game.setScreen(new CityScreen(game));
|
||||
@ -83,7 +159,7 @@ public class CityScreen extends com.unciv.game.utils.CameraStageBaseScreen {
|
||||
CityPickerTable.add(prevCityButton);
|
||||
}
|
||||
|
||||
Label currentCityLabel = new Label(game.civInfo.getCurrentCity().name, skin);
|
||||
Label currentCityLabel = new Label(getCity().name, skin);
|
||||
currentCityLabel.setFontScale(2);
|
||||
CityPickerTable.add(currentCityLabel);
|
||||
|
||||
@ -92,7 +168,7 @@ public class CityScreen extends com.unciv.game.utils.CameraStageBaseScreen {
|
||||
nextCityButton.addListener(new ClickListener() {
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
com.unciv.civinfo.CivilizationInfo ci = game.civInfo;
|
||||
CivilizationInfo ci = game.civInfo;
|
||||
if (ci.currentCity == ci.cities.size()-1) ci.currentCity = 0;
|
||||
else ci.currentCity++;
|
||||
game.setScreen(new CityScreen(game));
|
||||
@ -112,7 +188,7 @@ public class CityScreen extends com.unciv.game.utils.CameraStageBaseScreen {
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
game.setWorldScreen();
|
||||
game.worldScreen.setCenterPosition(game.civInfo.getCurrentCity().cityLocation);
|
||||
game.worldScreen.setCenterPosition(getCity().cityLocation);
|
||||
dispose();
|
||||
}
|
||||
});
|
||||
@ -122,7 +198,7 @@ public class CityScreen extends com.unciv.game.utils.CameraStageBaseScreen {
|
||||
}
|
||||
|
||||
private void addTiles() {
|
||||
final CityInfo cityInfo = game.civInfo.getCurrentCity();
|
||||
final CityInfo cityInfo = getCity();
|
||||
|
||||
Group allTiles = new Group();
|
||||
|
||||
@ -132,11 +208,13 @@ public class CityScreen extends com.unciv.game.utils.CameraStageBaseScreen {
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
selectedTile = tileInfo;
|
||||
updateTileTable();
|
||||
update();
|
||||
}
|
||||
});
|
||||
|
||||
if(!cityInfo.getTilesInRange().contains(tileInfo)) group.setColor(0,0,0,0.3f);
|
||||
if(!cityInfo.getTilesInRange().contains(tileInfo) ||
|
||||
(tileInfo.workingCity!=null && !tileInfo.workingCity.equals(cityInfo.name)))
|
||||
group.setColor(0,0,0,0.3f);
|
||||
else if(!tileInfo.isCityCenter()) {
|
||||
group.addPopulationIcon();
|
||||
group.populationImage.addListener(new ClickListener() {
|
||||
@ -145,12 +223,12 @@ public class CityScreen extends com.unciv.game.utils.CameraStageBaseScreen {
|
||||
if(tileInfo.workingCity ==null && cityInfo.getFreePopulation() > 0) tileInfo.workingCity = cityInfo.name;
|
||||
else if(cityInfo.name.equals(tileInfo.workingCity)) tileInfo.workingCity = null;
|
||||
cityInfo.updateCityStats();
|
||||
updateCityTable();
|
||||
update();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Vector2 positionalVector = com.unciv.game.utils.HexMath.Hex2WorldCoords(tileInfo.position.cpy().sub(cityInfo.cityLocation));
|
||||
Vector2 positionalVector = HexMath.Hex2WorldCoords(tileInfo.position.cpy().sub(cityInfo.cityLocation));
|
||||
int groupSize = 50;
|
||||
group.setPosition(stage.getWidth()/2 + positionalVector.x*0.8f * groupSize,
|
||||
stage.getHeight()/2 + positionalVector.y*0.8f * groupSize);
|
||||
@ -189,7 +267,7 @@ public class CityScreen extends com.unciv.game.utils.CameraStageBaseScreen {
|
||||
}
|
||||
|
||||
private void updateCityTable() {
|
||||
final CityInfo cityInfo = game.civInfo.getCurrentCity();
|
||||
final CityInfo cityInfo = getCity();
|
||||
FullStats stats = cityInfo.cityStats;
|
||||
CityStatsTable.pad(20);
|
||||
CityStatsTable.columnDefaults(0).padRight(10);
|
||||
@ -213,12 +291,12 @@ public class CityScreen extends com.unciv.game.utils.CameraStageBaseScreen {
|
||||
CityStatsValues.put("Population",cityInfo.getFreePopulation()+"/"+cityInfo.population);
|
||||
|
||||
for(String key : CityStatsValues.keySet()){
|
||||
CityStatsTable.add(com.unciv.game.utils.ImageGetter.getStatIcon(key)).align(Align.right);
|
||||
CityStatsTable.add(ImageGetter.getStatIcon(key)).align(Align.right);
|
||||
CityStatsTable.add(new Label(CityStatsValues.get(key),skin)).align(Align.left);
|
||||
CityStatsTable.row();
|
||||
}
|
||||
|
||||
String CurrentBuilding = game.civInfo.getCurrentCity().cityConstructions.currentConstruction;
|
||||
String CurrentBuilding = getCity().cityConstructions.currentConstruction;
|
||||
|
||||
String BuildingText = "Pick building";
|
||||
if(CurrentBuilding != null) BuildingText = cityInfo.cityConstructions.getCityProductionTextForCityButton();
|
||||
@ -236,7 +314,6 @@ public class CityScreen extends com.unciv.game.utils.CameraStageBaseScreen {
|
||||
|
||||
|
||||
// https://forums.civfanatics.com/threads/rush-buying-formula.393892/
|
||||
|
||||
IConstruction construction = cityInfo.cityConstructions.getCurrentConstruction();
|
||||
if(construction != null && !(construction instanceof Building && ((Building)construction).isWonder)) {
|
||||
CityStatsTable.row();
|
||||
@ -246,7 +323,7 @@ public class CityScreen extends com.unciv.game.utils.CameraStageBaseScreen {
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
cityInfo.cityConstructions.purchaseBuilding(cityInfo.cityConstructions.currentConstruction);
|
||||
updateCityTable();
|
||||
update();
|
||||
}
|
||||
});
|
||||
if(buildingGoldCost > game.civInfo.civStats.gold){
|
||||
@ -266,7 +343,7 @@ public class CityScreen extends com.unciv.game.utils.CameraStageBaseScreen {
|
||||
if(selectedTile == null) return;
|
||||
TileTable.clearChildren();
|
||||
|
||||
CityInfo city =game.civInfo.getCurrentCity();
|
||||
CityInfo city = getCity();
|
||||
FullStats stats = selectedTile.getTileStats(city);
|
||||
TileTable.pad(20);
|
||||
TileTable.columnDefaults(0).padRight(10);
|
||||
@ -288,7 +365,7 @@ public class CityScreen extends com.unciv.game.utils.CameraStageBaseScreen {
|
||||
|
||||
for(String key : TileStatsValues.keySet()){
|
||||
if(TileStatsValues.get(key) == 0) continue; // this tile gives nothing of this stat, so why even display it?
|
||||
TileTable.add(com.unciv.game.utils.ImageGetter.getStatIcon(key)).align(Align.right);
|
||||
TileTable.add(ImageGetter.getStatIcon(key)).align(Align.right);
|
||||
TileTable.add(new Label(Math.round(TileStatsValues.get(key))+"",skin)).align(Align.left);
|
||||
TileTable.row();
|
||||
}
|
||||
@ -298,30 +375,5 @@ public class CityScreen extends com.unciv.game.utils.CameraStageBaseScreen {
|
||||
TileTable.setPosition(stage.getWidth()-10- TileTable.getWidth(), 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float delta) {
|
||||
for(TileGroup HG : tileGroups) {
|
||||
HG.update();
|
||||
}
|
||||
|
||||
super.render(delta);
|
||||
}
|
||||
|
||||
public static Pixmap getPixmapRoundedRectangle(int width, int height, int radius, int color) {
|
||||
Pixmap pixmap = new Pixmap(width, height, Pixmap.Format.RGBA8888);
|
||||
pixmap.setBlending(Blending.None);
|
||||
pixmap.setColor(color);
|
||||
|
||||
pixmap.fillRectangle(0, radius, pixmap.getWidth(), pixmap.getHeight()-2*radius);
|
||||
pixmap.fillRectangle(radius, 0, pixmap.getWidth() - 2*radius, pixmap.getHeight());
|
||||
|
||||
pixmap.fillCircle(radius, radius, radius);
|
||||
pixmap.fillCircle(radius, pixmap.getHeight()-radius, radius);
|
||||
pixmap.fillCircle(pixmap.getWidth()-radius, radius, radius);
|
||||
pixmap.fillCircle(pixmap.getWidth()-radius, pixmap.getHeight()-radius, radius);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,8 @@ public class TileGroup extends Group {
|
||||
|
||||
|
||||
void addPopulationIcon(){
|
||||
populationImage = ImageGetter.getStatIcon("Population");
|
||||
populationImage = ImageGetter.getImage("StatIcons/populationGreen.png");
|
||||
populationImage.setSize(20,20);
|
||||
populationImage.moveBy(0, terrainImage.getHeight()-populationImage.getHeight()); // top left
|
||||
addActor(populationImage);
|
||||
}
|
||||
@ -68,7 +69,7 @@ public class TileGroup extends Group {
|
||||
}
|
||||
|
||||
if (tileInfo.unit != null && unitImage == null) {
|
||||
unitImage = ImageGetter.getImage("StatIcons/" + tileInfo.unit.name + "_(Civ5).png");
|
||||
unitImage = ImageGetter.getImage("StatIcons/" + tileInfo.unit.name.replace(" ","_") + "_(Civ5).png");
|
||||
addActor(unitImage);
|
||||
unitImage.setSize(20, 20); // not moved - is at bottom left
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class WorldScreen extends CameraStageBaseScreen {
|
||||
tileTable.setBackground(tileTableBackground);
|
||||
OptionsTable.setBackground(tileTableBackground);
|
||||
|
||||
NotificationsTable.background(ImageGetter.getDrawable(ImageGetter.WhiteDot).tint(new Color(0x004085bf)));
|
||||
NotificationsTable.background(ImageGetter.getSingleColorDrawable(new Color(0x004085bf)));
|
||||
|
||||
TextureRegionDrawable civBackground = ImageGetter.getDrawable("skin/civTableBackground.png");
|
||||
CivTable.setBackground(civBackground.tint(new Color(0x004085bf)));
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.unciv.game.utils;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
||||
@ -21,6 +22,10 @@ public class ImageGetter {
|
||||
return new TextureRegionDrawable(getTextureRegion(fileName));
|
||||
}
|
||||
|
||||
public static Drawable getSingleColorDrawable(Color color){
|
||||
return getDrawable("skin/whiteDot.png").tint(color);
|
||||
}
|
||||
|
||||
private static TextureRegion getTextureRegion(String fileName) {
|
||||
if (!textureRegionByFileName.containsKey(fileName))
|
||||
textureRegionByFileName.put(fileName, new TextureRegion(new Texture(Gdx.files.internal(fileName))));
|
||||
|
@ -165,6 +165,7 @@ public class Building extends NamedStats implements IConstruction, ICivilopedia
|
||||
constructions.builtBuildings.add(providesFreeBuilding);
|
||||
if (freeTechs != 0) UnCivGame.Current.civInfo.tech.freeTechs += freeTechs;
|
||||
if("EmpireEntersGoldenAge".equals(unique)) CivilizationInfo.current().enterGoldenAge();
|
||||
if("FreeGreatArtistAppears".equals(unique)) CivilizationInfo.current().addGreatPerson("Great Artist");
|
||||
if("WorkerConstruction".equals(unique)){
|
||||
CivilizationInfo.current().tileMap.placeUnitNearTile(constructions.cityLocation,"Worker");
|
||||
CivilizationInfo.current().tileMap.placeUnitNearTile(constructions.cityLocation,"Worker");
|
||||
|
@ -23,6 +23,17 @@ public class FullStats extends CivStats // also used for hex stats, since it's b
|
||||
production +=other.production;
|
||||
}
|
||||
|
||||
public FullStats minus(){
|
||||
FullStats sub = new FullStats();
|
||||
sub.gold=-gold;
|
||||
sub.science=-science;
|
||||
sub.happiness=-happiness;
|
||||
sub.culture=-culture;
|
||||
sub.food=-food;
|
||||
sub.production=-production;
|
||||
return sub;
|
||||
}
|
||||
|
||||
public String display(float value, String name){
|
||||
return ", " + (value>0 ? "+" : "") + Math.round(value) + " "+name;
|
||||
}
|
||||
|