Google play-able
Units with no turns left are now grayed out Added culture pool to cities and tiles being added to cities when pool fills Changed tile icon order and placing of resource icon
This commit is contained in:
parent
a6ae95946c
commit
d125c6ba3e
19 changed files with 123 additions and 55 deletions
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/uncivicon"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/GdxTheme" >
|
android:theme="@style/GdxTheme" >
|
||||||
<activity
|
<activity
|
||||||
|
|
BIN
android/android-release.apk
Normal file
BIN
android/android-release.apk
Normal file
Binary file not shown.
|
@ -18,10 +18,10 @@ android {
|
||||||
exclude 'META-INF/robovm/ios/robovm.xml'
|
exclude 'META-INF/robovm/ios/robovm.xml'
|
||||||
}
|
}
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.mygdx.game"
|
applicationId "com.unciv.game"
|
||||||
minSdkVersion 9
|
minSdkVersion 9
|
||||||
targetSdkVersion 25
|
targetSdkVersion 25
|
||||||
versionCode 1
|
versionCode 3
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
@ -79,7 +79,7 @@ task run(type: Exec) {
|
||||||
}
|
}
|
||||||
|
|
||||||
def adb = path + "/platform-tools/adb"
|
def adb = path + "/platform-tools/adb"
|
||||||
commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.mygdx.game/AndroidLauncher'
|
commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.unciv.game/AndroidLauncher'
|
||||||
}
|
}
|
||||||
|
|
||||||
// sets up the Android Eclipse project, using the old Ant based build.
|
// sets up the Android Eclipse project, using the old Ant based build.
|
||||||
|
|
BIN
android/res/drawable-hdpi/uncivicon.png
Normal file
BIN
android/res/drawable-hdpi/uncivicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
BIN
android/res/drawable-mdpi/uncivicon.png
Normal file
BIN
android/res/drawable-mdpi/uncivicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
BIN
android/res/drawable-xhdpi/uncivicon.png
Normal file
BIN
android/res/drawable-xhdpi/uncivicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
android/res/drawable-xxhdpi/uncivicon.png
Normal file
BIN
android/res/drawable-xxhdpi/uncivicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
BIN
android/res/drawable-xxxhdpi/uncivicon.png
Normal file
BIN
android/res/drawable-xxxhdpi/uncivicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
|
@ -20,9 +20,9 @@ allprojects {
|
||||||
apply plugin: "eclipse"
|
apply plugin: "eclipse"
|
||||||
apply plugin: "idea"
|
apply plugin: "idea"
|
||||||
|
|
||||||
version = '1.0'
|
version = '1.0.1'
|
||||||
ext {
|
ext {
|
||||||
appName = "my-gdx-game"
|
appName = "unciv-game"
|
||||||
gdxVersion = '1.9.6'
|
gdxVersion = '1.9.6'
|
||||||
roboVMVersion = '2.3.1'
|
roboVMVersion = '2.3.1'
|
||||||
box2DLightsVersion = '1.4'
|
box2DLightsVersion = '1.4'
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class CityBuildings
|
||||||
if(IsBuilt(building.Name)) return false;
|
if(IsBuilt(building.Name)) return false;
|
||||||
// if (building.Name.equals("Worker") || building.Name.equals("Settler")) return false;
|
// if (building.Name.equals("Worker") || building.Name.equals("Settler")) return false;
|
||||||
if(building.ResourceRequired) {
|
if(building.ResourceRequired) {
|
||||||
boolean containsResourceWithImprovement = GetCity().GetCityTiles()
|
boolean containsResourceWithImprovement = GetCity().getCityTiles()
|
||||||
.any(new Predicate<TileInfo>() {
|
.any(new Predicate<TileInfo>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean evaluate(TileInfo tile) {
|
public boolean evaluate(TileInfo tile) {
|
||||||
|
|
|
@ -5,9 +5,12 @@ import com.badlogic.gdx.utils.Predicate;
|
||||||
import com.unciv.game.HexMath;
|
import com.unciv.game.HexMath;
|
||||||
import com.unciv.game.UnCivGame;
|
import com.unciv.game.UnCivGame;
|
||||||
import com.unciv.models.LinqCollection;
|
import com.unciv.models.LinqCollection;
|
||||||
|
import com.unciv.models.gamebasics.ResourceType;
|
||||||
|
import com.unciv.models.gamebasics.TileResource;
|
||||||
import com.unciv.models.stats.FullStats;
|
import com.unciv.models.stats.FullStats;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
public class CityInfo {
|
public class CityInfo {
|
||||||
public final Vector2 cityLocation;
|
public final Vector2 cityLocation;
|
||||||
|
@ -15,10 +18,13 @@ public class CityInfo {
|
||||||
|
|
||||||
public CityBuildings cityBuildings;
|
public CityBuildings cityBuildings;
|
||||||
public CityPopulation cityPopulation;
|
public CityPopulation cityPopulation;
|
||||||
|
public int cultureStored;
|
||||||
|
private int tilesClaimed;
|
||||||
|
|
||||||
|
|
||||||
public LinqCollection<Vector2> CityTileLocations = new LinqCollection<Vector2>();
|
public LinqCollection<Vector2> CityTileLocations = new LinqCollection<Vector2>();
|
||||||
|
|
||||||
public LinqCollection<TileInfo> GetCityTiles(){
|
public LinqCollection<TileInfo> getCityTiles(){
|
||||||
return CityTileLocations.select(new com.unciv.models.LinqCollection.Func<Vector2, TileInfo>() {
|
return CityTileLocations.select(new com.unciv.models.LinqCollection.Func<Vector2, TileInfo>() {
|
||||||
@Override
|
@Override
|
||||||
public TileInfo GetBy(Vector2 arg0) {
|
public TileInfo GetBy(Vector2 arg0) {
|
||||||
|
@ -27,13 +33,23 @@ public class CityInfo {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] CityNames = new String[]{"Assur", "Ninveh", "Nimrud", "Kar-Tukuli-Ninurta", "Dur-Sharrukin"};
|
private String[] CityNames = new String[]{"Assur", "Ninveh", "Nimrud", "Kar-Tukuli-Ninurta", "Dur-Sharrukin"};
|
||||||
|
|
||||||
public CityInfo(){
|
public CityInfo(){
|
||||||
cityLocation = Vector2.Zero;
|
cityLocation = Vector2.Zero;
|
||||||
} // for json parsing, we need to have a default constructor
|
} // for json parsing, we need to have a default constructor
|
||||||
|
|
||||||
public CityInfo(CivilizationInfo civInfo, Vector2 cityLocation) {
|
public int getCultureToNextTile(){
|
||||||
|
// This one has conflicting sources -
|
||||||
|
// http://civilization.wikia.com/wiki/Mathematics_of_Civilization_V says it's 20+(10(t-1))^1.1
|
||||||
|
// https://www.reddit.com/r/civ/comments/58rxkk/how_in_gods_name_do_borders_expand_in_civ_vi/ has it
|
||||||
|
// (per game XML files) at 6*(t+0.4813)^1.3
|
||||||
|
// The second seems to be more based, so I'll go with that
|
||||||
|
double a = 6*Math.pow(tilesClaimed+1.4813,1.3);
|
||||||
|
return (int)Math.round(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
CityInfo(CivilizationInfo civInfo, Vector2 cityLocation) {
|
||||||
Name = CityNames[civInfo.Cities.size()];
|
Name = CityNames[civInfo.Cities.size()];
|
||||||
this.cityLocation = cityLocation;
|
this.cityLocation = cityLocation;
|
||||||
cityBuildings = new CityBuildings(this);
|
cityBuildings = new CityBuildings(this);
|
||||||
|
@ -45,23 +61,23 @@ public class CityInfo {
|
||||||
CityTileLocations.add(vector);
|
CityTileLocations.add(vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoAssignWorker();
|
autoAssignWorker();
|
||||||
civInfo.Cities.add(this);
|
civInfo.Cities.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<String> GetLuxuryResources() {
|
ArrayList<String> getLuxuryResources() {
|
||||||
ArrayList<String> LuxuryResources = new ArrayList<String>();
|
ArrayList<String> LuxuryResources = new ArrayList<String>();
|
||||||
for (TileInfo tileInfo : GetCityTiles()) {
|
for (TileInfo tileInfo : getCityTiles()) {
|
||||||
com.unciv.models.gamebasics.TileResource resource = tileInfo.GetTileResource();
|
com.unciv.models.gamebasics.TileResource resource = tileInfo.GetTileResource();
|
||||||
if (resource != null && resource.ResourceType.equals("Luxury") && resource.Improvement.equals(tileInfo.Improvement))
|
if (resource != null && resource.ResourceType == ResourceType.Luxury && resource.Improvement.equals(tileInfo.Improvement))
|
||||||
LuxuryResources.add(tileInfo.Resource);
|
LuxuryResources.add(tileInfo.Resource);
|
||||||
}
|
}
|
||||||
return LuxuryResources;
|
return LuxuryResources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int GetWorkingPopulation() {
|
private int getWorkingPopulation() {
|
||||||
return GetCityTiles().count(new Predicate<TileInfo>() {
|
return getCityTiles().count(new Predicate<TileInfo>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean evaluate(TileInfo arg0) {
|
public boolean evaluate(TileInfo arg0) {
|
||||||
return arg0.IsWorked;
|
return arg0.IsWorked;
|
||||||
|
@ -69,12 +85,12 @@ public class CityInfo {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetFreePopulation() {
|
public int getFreePopulation() {
|
||||||
return cityPopulation.Population - GetWorkingPopulation();
|
return cityPopulation.Population - getWorkingPopulation();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean HasNonWorkingPopulation() {
|
public boolean hasNonWorkingPopulation() {
|
||||||
return GetFreePopulation() > 0;
|
return getFreePopulation() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FullStats getCityStats() {
|
public FullStats getCityStats() {
|
||||||
|
@ -85,11 +101,11 @@ public class CityInfo {
|
||||||
stats.Science += cityPopulation.Population;
|
stats.Science += cityPopulation.Population;
|
||||||
|
|
||||||
// Working ppl
|
// Working ppl
|
||||||
for (TileInfo cell : GetCityTiles()) {
|
for (TileInfo cell : getCityTiles()) {
|
||||||
if (cell.IsWorked || cell.IsCityCenter()) stats.add(cell.GetTileStats());
|
if (cell.IsWorked || cell.IsCityCenter()) stats.add(cell.GetTileStats());
|
||||||
}
|
}
|
||||||
//idle ppl
|
//idle ppl
|
||||||
stats.Production += GetFreePopulation();
|
stats.Production += getFreePopulation();
|
||||||
stats.Food -= cityPopulation.Population * 2;
|
stats.Food -= cityPopulation.Population * 2;
|
||||||
|
|
||||||
stats.add(cityBuildings.GetStats());
|
stats.add(cityBuildings.GetStats());
|
||||||
|
@ -97,27 +113,60 @@ public class CityInfo {
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NextTurn() {
|
void nextTurn() {
|
||||||
FullStats stats = getCityStats();
|
FullStats stats = getCityStats();
|
||||||
|
|
||||||
if (cityBuildings.CurrentBuilding.equals(cityBuildings.Settler) && stats.Food > 0) {
|
if (cityBuildings.CurrentBuilding.equals(CityBuildings.Settler) && stats.Food > 0) {
|
||||||
stats.Production += stats.Food;
|
stats.Production += stats.Food;
|
||||||
stats.Food = 0;
|
stats.Food = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cityPopulation.NextTurn(stats.Food)) AutoAssignWorker();
|
if (cityPopulation.NextTurn(stats.Food)) autoAssignWorker();
|
||||||
|
|
||||||
cityBuildings.NextTurn(stats.Production);
|
cityBuildings.NextTurn(stats.Production);
|
||||||
|
|
||||||
for (TileInfo tileInfo : GetCityTiles()) {
|
for (TileInfo tileInfo : getCityTiles()) {
|
||||||
tileInfo.NextTurn();
|
tileInfo.NextTurn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cultureStored+=stats.Culture;
|
||||||
|
if(cultureStored>=getCultureToNextTile()){
|
||||||
|
addNewTile();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AutoAssignWorker() {
|
private void addNewTile(){
|
||||||
|
cultureStored -= getCultureToNextTile();
|
||||||
|
tilesClaimed++;
|
||||||
|
LinqCollection<Vector2> possibleNewTileVectors = new LinqCollection<Vector2>();
|
||||||
|
for (TileInfo tile : getCityTiles())
|
||||||
|
for (Vector2 vector : HexMath.GetAdjacentVectors(tile.Position))
|
||||||
|
if(!CityTileLocations.contains(vector) && !possibleNewTileVectors.contains(vector))
|
||||||
|
possibleNewTileVectors.add(vector);
|
||||||
|
|
||||||
|
LinqCollection<TileInfo> possibleNewTiles = new LinqCollection<TileInfo>();
|
||||||
|
TileMap tileMap = UnCivGame.Current.civInfo.tileMap;
|
||||||
|
for (Vector2 vector : possibleNewTileVectors)
|
||||||
|
if(tileMap.contains(vector) && tileMap.get(vector).GetCity()==null)
|
||||||
|
possibleNewTiles.add(tileMap.get(vector));
|
||||||
|
|
||||||
|
TileInfo TileChosen=null;
|
||||||
|
double TileChosenRank=0;
|
||||||
|
for(TileInfo tile : possibleNewTiles){
|
||||||
|
double rank = rankTile(tile);
|
||||||
|
if(rank>TileChosenRank){
|
||||||
|
TileChosenRank = rank;
|
||||||
|
TileChosen = tile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CityTileLocations.add(TileChosen.Position);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void autoAssignWorker() {
|
||||||
double maxValue = 0;
|
double maxValue = 0;
|
||||||
TileInfo toWork = null;
|
TileInfo toWork = null;
|
||||||
for (TileInfo tileInfo : GetCityTiles()) {
|
for (TileInfo tileInfo : getCityTiles()) {
|
||||||
if (tileInfo.IsWorked || tileInfo.IsCityCenter()) continue;
|
if (tileInfo.IsWorked || tileInfo.IsCityCenter()) continue;
|
||||||
FullStats stats = tileInfo.GetTileStats();
|
FullStats stats = tileInfo.GetTileStats();
|
||||||
|
|
||||||
|
@ -129,4 +178,17 @@ public class CityInfo {
|
||||||
}
|
}
|
||||||
toWork.IsWorked = true;
|
toWork.IsWorked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private double rankTile(TileInfo tile){
|
||||||
|
FullStats stats = tile.GetTileStats();
|
||||||
|
double rank=0;
|
||||||
|
if(stats.Food<2) rank+=stats.Food;
|
||||||
|
else rank += 2 + (stats.Food-2)/2; // 1 point for each food up to 2, from there on half a point
|
||||||
|
rank+=stats.Gold/2;
|
||||||
|
rank+=stats.Production;
|
||||||
|
rank+=stats.Science;
|
||||||
|
rank+=stats.Culture;
|
||||||
|
if(tile.Improvement==null) rank+=0.5; // Improvement potential!
|
||||||
|
return rank;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
package com.unciv.civinfo;
|
package com.unciv.civinfo;
|
||||||
|
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.unciv.game.pickerscreens.GameSaver;
|
|
||||||
import com.unciv.models.LinqCollection;
|
import com.unciv.models.LinqCollection;
|
||||||
import com.unciv.models.gamebasics.GameBasics;
|
import com.unciv.models.gamebasics.GameBasics;
|
||||||
import com.unciv.models.stats.CivStats;
|
import com.unciv.models.stats.CivStats;
|
||||||
|
@ -47,7 +46,7 @@ public class CivilizationInfo {
|
||||||
civStats.add(nextTurnStats);
|
civStats.add(nextTurnStats);
|
||||||
if(Cities.size() > 0) Tech.NextTurn(nextTurnStats.Science);
|
if(Cities.size() > 0) Tech.NextTurn(nextTurnStats.Science);
|
||||||
|
|
||||||
for (CityInfo city : Cities.as(CityInfo.class)) city.NextTurn();
|
for (CityInfo city : Cities.as(CityInfo.class)) city.nextTurn();
|
||||||
|
|
||||||
for(TileInfo tile : tileMap.values()) if(tile.Unit!=null) tile.Unit.CurrentMovement = tile.Unit.MaxMovement;
|
for(TileInfo tile : tileMap.values()) if(tile.Unit!=null) tile.Unit.CurrentMovement = tile.Unit.MaxMovement;
|
||||||
|
|
||||||
|
@ -61,7 +60,7 @@ public class CivilizationInfo {
|
||||||
HashSet<String> LuxuryResources = new HashSet<String>();
|
HashSet<String> LuxuryResources = new HashSet<String>();
|
||||||
for (CityInfo city : Cities) {
|
for (CityInfo city : Cities) {
|
||||||
statsForTurn.add(city.getCityStats());
|
statsForTurn.add(city.getCityStats());
|
||||||
LuxuryResources.addAll(city.GetLuxuryResources());
|
LuxuryResources.addAll(city.getLuxuryResources());
|
||||||
}
|
}
|
||||||
statsForTurn.Happiness += LuxuryResources.size() * 5; // 5 happiness for each unique luxury in civ
|
statsForTurn.Happiness += LuxuryResources.size() * 5; // 5 happiness for each unique luxury in civ
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.unciv.game.HexMath;
|
||||||
import com.unciv.models.LinqCollection;
|
import com.unciv.models.LinqCollection;
|
||||||
import com.unciv.models.LinqHashMap;
|
import com.unciv.models.LinqHashMap;
|
||||||
import com.unciv.models.gamebasics.GameBasics;
|
import com.unciv.models.gamebasics.GameBasics;
|
||||||
|
import com.unciv.models.gamebasics.ResourceType;
|
||||||
import com.unciv.models.gamebasics.Terrain;
|
import com.unciv.models.gamebasics.Terrain;
|
||||||
import com.unciv.models.gamebasics.TileResource;
|
import com.unciv.models.gamebasics.TileResource;
|
||||||
|
|
||||||
|
@ -58,11 +59,11 @@ public class TileMap{
|
||||||
|
|
||||||
TileResource resource = null;
|
TileResource resource = null;
|
||||||
if (Math.random() < 1 / 5f) {
|
if (Math.random() < 1 / 5f) {
|
||||||
resource = GetRandomResource(TileResources, "Bonus");
|
resource = GetRandomResource(TileResources, ResourceType.Bonus);
|
||||||
} else if (Math.random() < 1 / 7f) {
|
} else if (Math.random() < 1 / 7f) {
|
||||||
resource = GetRandomResource(TileResources, "Strategic");
|
resource = GetRandomResource(TileResources, ResourceType.Strategic);
|
||||||
} else if (Math.random() < 1 / 10f) {
|
} else if (Math.random() < 1 / 10f) {
|
||||||
resource = GetRandomResource(TileResources, "Luxury");
|
resource = GetRandomResource(TileResources, ResourceType.Luxury);
|
||||||
}
|
}
|
||||||
if (resource != null) tileInfo.Resource = resource.Name;
|
if (resource != null) tileInfo.Resource = resource.Name;
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ public class TileMap{
|
||||||
|
|
||||||
public LinqCollection<TileInfo> values(){return tiles.linqValues();}
|
public LinqCollection<TileInfo> values(){return tiles.linqValues();}
|
||||||
|
|
||||||
public TileResource GetRandomResource(LinqCollection<TileResource> resources, final String resourceType) {
|
public TileResource GetRandomResource(LinqCollection<TileResource> resources, final ResourceType resourceType) {
|
||||||
return resources.where(new Predicate<TileResource>() {
|
return resources.where(new Predicate<TileResource>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean evaluate(TileResource arg0) {
|
public boolean evaluate(TileResource arg0) {
|
||||||
|
|
|
@ -8,7 +8,6 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Group;
|
import com.badlogic.gdx.scenes.scene2d.Group;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
|
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||||
|
@ -135,13 +134,13 @@ public class CityScreen extends CameraStageBaseScreen {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!cityInfo.GetCityTiles().contains(tileInfo)) group.setColor(0,0,0,0.3f);
|
if(!cityInfo.getCityTiles().contains(tileInfo)) group.setColor(0,0,0,0.3f);
|
||||||
else if(!tileInfo.IsCityCenter()) {
|
else if(!tileInfo.IsCityCenter()) {
|
||||||
group.addPopulationIcon();
|
group.addPopulationIcon();
|
||||||
group.populationImage.addListener(new ClickListener() {
|
group.populationImage.addListener(new ClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void clicked(InputEvent event, float x, float y) {
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
if (cityInfo.GetFreePopulation() > 0 || tileInfo.IsWorked)
|
if (cityInfo.getFreePopulation() > 0 || tileInfo.IsWorked)
|
||||||
tileInfo.IsWorked = !tileInfo.IsWorked;
|
tileInfo.IsWorked = !tileInfo.IsWorked;
|
||||||
updateCityTable();
|
updateCityTable();
|
||||||
}
|
}
|
||||||
|
@ -204,8 +203,8 @@ public class CityScreen extends CameraStageBaseScreen {
|
||||||
CityStatsValues.put("Food",stats.Food+" ("+cityInfo.cityPopulation.FoodStored+"/"+cityInfo.cityPopulation.FoodToNextPopulation()+")");
|
CityStatsValues.put("Food",stats.Food+" ("+cityInfo.cityPopulation.FoodStored+"/"+cityInfo.cityPopulation.FoodToNextPopulation()+")");
|
||||||
CityStatsValues.put("Gold",stats.Gold+"");
|
CityStatsValues.put("Gold",stats.Gold+"");
|
||||||
CityStatsValues.put("Science",stats.Science+"");
|
CityStatsValues.put("Science",stats.Science+"");
|
||||||
CityStatsValues.put("Culture",stats.Culture+"");
|
CityStatsValues.put("Culture",stats.Culture+" ("+cityInfo.cultureStored+"/"+cityInfo.getCultureToNextTile()+")");
|
||||||
CityStatsValues.put("Population",cityInfo.GetFreePopulation()+"/"+cityInfo.cityPopulation.Population);
|
CityStatsValues.put("Population",cityInfo.getFreePopulation()+"/"+cityInfo.cityPopulation.Population);
|
||||||
|
|
||||||
for(String key : CityStatsValues.keySet()){
|
for(String key : CityStatsValues.keySet()){
|
||||||
CityStatsTable.add(ImageGetter.getStatIcon(key)).align(Align.right);
|
CityStatsTable.add(ImageGetter.getStatIcon(key)).align(Align.right);
|
||||||
|
|
|
@ -28,10 +28,10 @@ public class TileGroup extends Group {
|
||||||
addActor(terrainImage);
|
addActor(terrainImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void addPopulationIcon(){
|
void addPopulationIcon(){
|
||||||
populationImage = ImageGetter.getStatIcon("Population");
|
populationImage = ImageGetter.getStatIcon("Population");
|
||||||
populationImage.setAlign(Align.bottomRight);
|
populationImage.moveBy(0, terrainImage.getHeight()-populationImage.getHeight()); // top left
|
||||||
populationImage.setX(terrainImage.getWidth()-populationImage.getWidth());
|
|
||||||
addActor(populationImage);
|
addActor(populationImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,8 +46,8 @@ public class TileGroup extends Group {
|
||||||
if (tileInfo.HasViewableResource() && resourceImage == null) { // Need to add the resource image!
|
if (tileInfo.HasViewableResource() && resourceImage == null) { // Need to add the resource image!
|
||||||
String fileName = "ResourceIcons/" + tileInfo.Resource + "_(Civ5).png";
|
String fileName = "ResourceIcons/" + tileInfo.Resource + "_(Civ5).png";
|
||||||
Image image = ImageGetter.getImageByFilename(fileName);
|
Image image = ImageGetter.getImageByFilename(fileName);
|
||||||
image.setScale(0.5f);
|
image.setSize(20,20);
|
||||||
image.setOrigin(Align.topRight);
|
image.moveBy(terrainImage.getWidth()-image.getWidth(), 0); // bottom right
|
||||||
resourceImage = image;
|
resourceImage = image;
|
||||||
addActor(image);
|
addActor(image);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public class TileGroup extends Group {
|
||||||
if (tileInfo.Unit != null && unitImage == null) {
|
if (tileInfo.Unit != null && unitImage == null) {
|
||||||
unitImage = ImageGetter.getImageByFilename("StatIcons/" + tileInfo.Unit.Name + "_(Civ5).png");
|
unitImage = ImageGetter.getImageByFilename("StatIcons/" + tileInfo.Unit.Name + "_(Civ5).png");
|
||||||
addActor(unitImage);
|
addActor(unitImage);
|
||||||
unitImage.setSize(20, 20);
|
unitImage.setSize(20, 20); // not moved - is at bottom left
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tileInfo.Unit == null && unitImage != null) {
|
if (tileInfo.Unit == null && unitImage != null) {
|
||||||
|
@ -63,12 +63,18 @@ public class TileGroup extends Group {
|
||||||
unitImage = null;
|
unitImage = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(unitImage!=null){
|
||||||
|
if(tileInfo.Unit.CurrentMovement==0) unitImage.setColor(Color.GRAY);
|
||||||
|
else unitImage.setColor(Color.WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (tileInfo.Improvement != null && improvementImage == null) {
|
if (tileInfo.Improvement != null && improvementImage == null) {
|
||||||
improvementImage = ImageGetter.getImageByFilename("ImprovementIcons/" + tileInfo.Improvement.replace(' ','_') + "_(Civ5).png");
|
improvementImage = ImageGetter.getImageByFilename("ImprovementIcons/" + tileInfo.Improvement.replace(' ','_') + "_(Civ5).png");
|
||||||
addActor(improvementImage);
|
addActor(improvementImage);
|
||||||
improvementImage.setSize(20, 20);
|
improvementImage.setSize(20, 20);
|
||||||
improvementImage.moveBy(0, terrainImage.getHeight() - improvementImage.getHeight());
|
improvementImage.moveBy(terrainImage.getWidth()-improvementImage.getWidth(),
|
||||||
|
terrainImage.getHeight() - improvementImage.getHeight()); // top right
|
||||||
}
|
}
|
||||||
|
|
||||||
if(populationImage!=null){
|
if(populationImage!=null){
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class WorldScreen extends CameraStageBaseScreen {
|
||||||
stage.addActor(TileTable);
|
stage.addActor(TileTable);
|
||||||
|
|
||||||
Drawable tileTableBackground = new TextureRegionDrawable(new TextureRegion(new Texture("skin/tileTableBackground.png")))
|
Drawable tileTableBackground = new TextureRegionDrawable(new TextureRegion(new Texture("skin/tileTableBackground.png")))
|
||||||
.tint(new Color(0x0040804f));
|
.tint(new Color(0x004085bf));
|
||||||
tileTableBackground.setMinHeight(0);
|
tileTableBackground.setMinHeight(0);
|
||||||
tileTableBackground.setMinWidth(0);
|
tileTableBackground.setMinWidth(0);
|
||||||
TileTable.setBackground(tileTableBackground);
|
TileTable.setBackground(tileTableBackground);
|
||||||
|
@ -63,7 +63,7 @@ public class WorldScreen extends CameraStageBaseScreen {
|
||||||
|
|
||||||
TextureRegionDrawable civBackground = new TextureRegionDrawable(new TextureRegion(new Texture("skin/civTableBackground.png")));
|
TextureRegionDrawable civBackground = new TextureRegionDrawable(new TextureRegion(new Texture("skin/civTableBackground.png")));
|
||||||
// civBackground.tint(new Color(0x0040804f));
|
// civBackground.tint(new Color(0x0040804f));
|
||||||
CivTable.setBackground(civBackground.tint(new Color(0x0040804f)));
|
CivTable.setBackground(civBackground.tint(new Color(0x004085bf)));
|
||||||
|
|
||||||
stage.addActor(CivTable);
|
stage.addActor(CivTable);
|
||||||
|
|
||||||
|
@ -267,6 +267,7 @@ public class WorldScreen extends CameraStageBaseScreen {
|
||||||
lastScale = scrollPane.getScaleX();
|
lastScale = scrollPane.getScaleX();
|
||||||
}
|
}
|
||||||
float scale = (float) Math.sqrt(distance / initialDistance) * lastScale;
|
float scale = (float) Math.sqrt(distance / initialDistance) * lastScale;
|
||||||
|
if(scale<1) return;
|
||||||
scrollPane.setScale(scale);
|
scrollPane.setScale(scale);
|
||||||
game.settings.tilesZoom = scale;
|
game.settings.tilesZoom = scale;
|
||||||
}
|
}
|
||||||
|
@ -375,7 +376,8 @@ public class WorldScreen extends CameraStageBaseScreen {
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(!GameBasics.TileImprovements.linqValues().any(new Predicate<TileImprovement>() {
|
if(selectedTile.Unit.CurrentMovement==0 ||
|
||||||
|
!GameBasics.TileImprovements.linqValues().any(new Predicate<TileImprovement>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean evaluate(TileImprovement arg0) {
|
public boolean evaluate(TileImprovement arg0) {
|
||||||
return selectedTile.CanBuildImprovement(arg0);
|
return selectedTile.CanBuildImprovement(arg0);
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package com.unciv.models.gamebasics;
|
package com.unciv.models.gamebasics;
|
||||||
|
|
||||||
/**
|
public enum ResourceType{
|
||||||
* Created by LENOVO on 11/25/2017.
|
Luxury,
|
||||||
*/
|
Strategic,
|
||||||
|
Bonus
|
||||||
class ResourceType {
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import com.unciv.models.stats.FullStats;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
public class TileResource extends NamedStats implements ICivilopedia {
|
public class TileResource extends NamedStats implements ICivilopedia {
|
||||||
public String ResourceType;
|
public ResourceType ResourceType;
|
||||||
public Collection<String> TerrainsCanBeFoundOn;
|
public Collection<String> TerrainsCanBeFoundOn;
|
||||||
public String Improvement;
|
public String Improvement;
|
||||||
public FullStats ImprovementStats;
|
public FullStats ImprovementStats;
|
||||||
|
|
BIN
keystore.jks
Normal file
BIN
keystore.jks
Normal file
Binary file not shown.
Loading…
Reference in a new issue