Game now fits to the screen, without 'extra bits'

Roads now make movement cost 1/2 before machinery and 1/3 after
This commit is contained in:
Yair Morgenstern 2017-12-05 13:47:33 +02:00
parent 060be89e55
commit 635e8ce08a
7 changed files with 33 additions and 24 deletions

View File

@ -21,7 +21,7 @@ android {
applicationId "com.unciv.game"
minSdkVersion 9
targetSdkVersion 25
versionCode 6
versionCode 8
versionName "0.9"
}
buildTypes {

View File

@ -94,7 +94,10 @@ public class TileMap{
for(TileInfo tileToCheck : tilesToCheck)
for (TileInfo maybeUpdatedTile : getTilesInDistance(tileToCheck.position,1)) {
float distanceBetweenTiles = maybeUpdatedTile.getLastTerrain().movementCost;
if(tileToCheck.roadStatus!=RoadStatus.None && maybeUpdatedTile.roadStatus!=RoadStatus.None) distanceBetweenTiles = 1/3f;
if(tileToCheck.roadStatus!=RoadStatus.None && maybeUpdatedTile.roadStatus!=RoadStatus.None) {
if(CivilizationInfo.current().tech.isResearched("Machinery")) distanceBetweenTiles = 1 / 3f;
else distanceBetweenTiles = 1/2f;
}
if(tileToCheck.roadStatus==RoadStatus.Railroad && maybeUpdatedTile.roadStatus==RoadStatus.Railroad) distanceBetweenTiles = 1/10f;
float totalDistanceToTile = distanceToTiles.get(tileToCheck)+ distanceBetweenTiles;
if (!distanceToTiles.containsKey(maybeUpdatedTile) || distanceToTiles.get(maybeUpdatedTile) > totalDistanceToTile) {

View File

@ -10,7 +10,9 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.utils.viewport.ExtendViewport;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.ScreenViewport;
import java.util.HashMap;
@ -24,7 +26,8 @@ public class CameraStageBaseScreen implements Screen {
public CameraStageBaseScreen(UnCivGame game) {
this.game = game;
stage = new Stage(new FitViewport(1000,600),batch);
stage = new Stage(new ExtendViewport(1000,600
),batch);// FitViewport(1000,600)
Gdx.input.setInputProcessor(stage);
}

View File

@ -198,12 +198,12 @@ public class CityScreen extends CameraStageBaseScreen {
CityStatsTable.row();
HashMap<String,String> CityStatsValues = new LinkedHashMap<String, String>();
CityStatsValues.put("production",Math.round(stats.production) +"");
CityStatsValues.put("food",Math.round(stats.food)
CityStatsValues.put("Production",Math.round(stats.production) +"");
CityStatsValues.put("Food",Math.round(stats.food)
+" ("+cityInfo.foodStored+"/"+cityInfo.foodToNextPopulation()+")");
CityStatsValues.put("gold",Math.round(stats.gold) +"");
CityStatsValues.put("science",Math.round(stats.science) +"");
CityStatsValues.put("culture",Math.round(stats.culture)
CityStatsValues.put("Gold",Math.round(stats.gold) +"");
CityStatsValues.put("Science",Math.round(stats.science) +"");
CityStatsValues.put("Culture",Math.round(stats.culture)
+" ("+cityInfo.cultureStored+"/"+cityInfo.getCultureToNextTile()+")");
CityStatsValues.put("Population",cityInfo.getFreePopulation()+"/"+cityInfo.population);
@ -251,11 +251,11 @@ public class CityScreen extends CameraStageBaseScreen {
TileTable.row();
HashMap<String,Float> TileStatsValues = new HashMap<String, Float>();
TileStatsValues.put("production",stats.production);
TileStatsValues.put("food",stats.food);
TileStatsValues.put("gold",stats.gold);
TileStatsValues.put("science",stats.science);
TileStatsValues.put("culture",stats.culture);
TileStatsValues.put("Production",stats.production);
TileStatsValues.put("Food",stats.food);
TileStatsValues.put("Gold",stats.gold);
TileStatsValues.put("Science",stats.science);
TileStatsValues.put("Culture",stats.culture);
for(String key : TileStatsValues.keySet()){
if(TileStatsValues.get(key) == 0) continue; // this tile gives nothing of this stat, so why even display it?

View File

@ -8,11 +8,14 @@ import com.unciv.civinfo.CivilizationInfo;
import com.unciv.civinfo.Unit;
import com.unciv.game.pickerscreens.GameSaver;
import com.unciv.models.gamebasics.BasicHelp;
import com.unciv.models.gamebasics.Building;
import com.unciv.models.gamebasics.GameBasics;
import com.unciv.models.gamebasics.Technology;
import com.unciv.models.LinqHashMap;
import com.unciv.models.gamebasics.TechColumn;
import com.unciv.models.gamebasics.Terrain;
import com.unciv.models.gamebasics.TileImprovement;
import com.unciv.models.gamebasics.TileResource;
public class UnCivGame extends Game {
@ -64,9 +67,9 @@ public class UnCivGame extends Game {
}
private void SetupGameBasics() {
GameBasics.Buildings = CreateHashmap(com.unciv.models.gamebasics.Building.class,GetFromJson(com.unciv.models.gamebasics.Building[].class,"Buildings"));
GameBasics.Terrains = CreateHashmap(com.unciv.models.gamebasics.Terrain.class,GetFromJson(com.unciv.models.gamebasics.Terrain[].class,"Terrains"));
GameBasics.TileResources = CreateHashmap(com.unciv.models.gamebasics.TileResource.class,GetFromJson(com.unciv.models.gamebasics.TileResource[].class,"TileResources"));
GameBasics.Buildings = CreateHashmap(Building.class,GetFromJson(Building[].class,"Buildings"));
GameBasics.Terrains = CreateHashmap(Terrain.class,GetFromJson(Terrain[].class,"Terrains"));
GameBasics.TileResources = CreateHashmap(TileResource.class,GetFromJson(TileResource[].class,"TileResources"));
GameBasics.TileImprovements = CreateHashmap(TileImprovement.class,GetFromJson(TileImprovement[].class,"TileImprovements"));
GameBasics.Helps = CreateHashmap(BasicHelp.class,GetFromJson(BasicHelp[].class,"BasicHelp"));
@ -79,7 +82,7 @@ public class UnCivGame extends Game {
GameBasics.Technologies.put(tech.name,tech);
}
}
for(com.unciv.models.gamebasics.Building building : GameBasics.Buildings.values()){
for(Building building : GameBasics.Buildings.values()){
if(building.requiredTech == null) continue;
TechColumn column = building.GetRequiredTech().column;
building.cost = building.isWonder ? column.wonderCost : column.buildingCost;

View File

@ -312,11 +312,11 @@ public class WorldScreen extends CameraStageBaseScreen {
HashMap<String,Float> TileStatsValues = new HashMap<String, Float>();
TileStatsValues.put("production",stats.production);
TileStatsValues.put("food",stats.food);
TileStatsValues.put("gold",stats.gold);
TileStatsValues.put("science",stats.science);
TileStatsValues.put("culture",stats.culture);
TileStatsValues.put("Production",stats.production);
TileStatsValues.put("Food",stats.food);
TileStatsValues.put("Gold",stats.gold);
TileStatsValues.put("Science",stats.science);
TileStatsValues.put("Culture",stats.culture);
for(String key : TileStatsValues.keySet()){
if(TileStatsValues.get(key) == 0) continue; // this tile gives nothing of this stat, so why even display it?

View File

@ -1,6 +1,6 @@
#Mon Oct 09 11:06:23 IDT 2017
#Tue Dec 05 12:43:36 IST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip