Hopefully the yield in the city screen looks better now

Added mountains
This commit is contained in:
Yair Morgenstern 2018-11-28 23:05:14 +02:00
parent c807ee5098
commit ce9d68e375
17 changed files with 425 additions and 372 deletions

View File

@ -352,11 +352,13 @@ All the following are from [the Noun Project](https://thenounproject.com) licenc
## Others
* [Circle](https://thenounproject.com/term/circle/1841891/) By Aybige
* [Arrow](https://thenounproject.com/term/arrow/18123/) By Joe Mortell
* [Arrow](https://thenounproject.com/term/arrow/18123/) By Joe Mortell for movement
* https://thenounproject.com/term/arrow/2032227/
* [Connection](https://thenounproject.com/search/?q=connection&i=1521886) By Travis Avery
* [Skull](https://thenounproject.com/search/?q=Skull&i=1030702) By Vladimir Belochkin
* [Skull](https://thenounproject.com/search/?q=Skull&i=1030702) By Vladimir Belochkin for disbanding units
* [Crosshair](https://thenounproject.com/search/?q=crosshairs&i=916030) By Bakunetsu Kaito
* [City](https://thenounproject.com/search/?q=city&i=571332) By Felix Westphal
* [Fire](https://thenounproject.com/search/?q=Fire&i=96564) By Lloyd Humphreys
* [Fire](https://thenounproject.com/search/?q=Fire&i=96564) By Lloyd Humphreys for
* [Sleep](https://thenounproject.com/search/?q=sleep&i=1760085) By Saeful Muslim
* [Banner](https://thenounproject.com/term/banner/866282/) By Emir Palavan for embarked units
* [Arrow](https://thenounproject.com/term/arrow/18123/) By uzeir syarief for moving between idle units

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 792 KiB

After

Width:  |  Height:  |  Size: 792 KiB

View File

@ -59,6 +59,12 @@
defenceBonus: 0.25,
RGB: [74,81,40]
},
{
name:"Mountain",
type:"Land",
impassable:true,
RGB: [89, 45, 0]
},
// Terrain features
{

View File

@ -3,7 +3,7 @@ package com.unciv
import com.unciv.logic.GameSaver
class GameSettings {
var showWorkedTiles: Boolean = true
var showWorkedTiles: Boolean = false
var showResourcesAndImprovements: Boolean = true
var language: String = "English"
var resolution: String = "1050x700"

View File

@ -94,6 +94,7 @@ class WorkerAutomation(val unit: MapUnit) {
(it.civilianUnit== null || it == currentTile)
&& it.improvement == null
&& it.isLand()
&& !it.getBaseTerrain().impassable
&& it.canBuildImprovement(chooseImprovement(it), unit.civInfo)
&& {val city=it.getCity(); city==null || it.getCity()?.civInfo == unit.civInfo}() // don't work tiles belonging to another civ
}.sortedByDescending { getPriority(it, unit.civInfo) }.toMutableList()

View File

@ -113,6 +113,7 @@ class MapUnit {
fun canPassThrough(tile: TileInfo):Boolean{
val tileOwner = tile.getOwner()
if(tile.getBaseTerrain().impassable) return false
val isOcean = tile.baseTerrain == "Ocean" // profiling showed that 3.5% of all nextTurn time is taken up by string equals in this function =|
if(tile.isWater() && type.isLandUnit()){
val techUniques = civInfo.tech.getUniques()

View File

@ -290,8 +290,12 @@ open class RandomMapGenerator {
}
fun randomizeTile(tileInfo: TileInfo){
RandomMapGenerator().addRandomTerrainFeature(tileInfo)
RandomMapGenerator().addRandomResourceToTile(tileInfo)
RandomMapGenerator().maybeAddAncientRuins(tileInfo)
if(tileInfo.getBaseTerrain().type==TerrainType.Land && Math.random()<0.05f){
tileInfo.baseTerrain = "Mountain"
tileInfo.setTransients()
}
addRandomTerrainFeature(tileInfo)
addRandomResourceToTile(tileInfo)
maybeAddAncientRuins(tileInfo)
}
}

View File

@ -13,7 +13,7 @@ import kotlin.math.abs
open class TileInfo {
@Transient lateinit var tileMap: TileMap
@Transient var owningCity:CityInfo?=null
@Transient lateinit var baseTerrainObject:Terrain
@Transient private lateinit var baseTerrainObject:Terrain
var militaryUnit:MapUnit?=null
var civilianUnit:MapUnit?=null
@ -253,6 +253,7 @@ open class TileInfo {
if(!defencePercentString.startsWith("-")) defencePercentString = "+$defencePercentString"
SB.appendln("[$defencePercentString] to unit defence".tr())
}
if(getBaseTerrain().impassable) SB.appendln("Impassible")
return SB.toString().trim()
}

View File

@ -51,7 +51,7 @@ class Terrain : NamedStats(), ICivilopedia {
var RGB: List<Int>? = null
var movementCost = 1
var defenceBonus:Float = 0f
var impassible = false
var impassable = false
fun getColor(): Color = colorFromRGB(RGB!![0], RGB!![1], RGB!![2])
}

View File

@ -1,9 +1,11 @@
package com.unciv.ui.cityscreen
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.unciv.models.stats.Stats
import com.unciv.ui.utils.ImageGetter
import com.unciv.ui.utils.surroundWithCircle
class YieldGroup : HorizontalGroup() {
@ -15,24 +17,28 @@ class YieldGroup : HorizontalGroup() {
pack()
}
fun getIcon(statName: String) =
ImageGetter.getStatIcon(statName).surroundWithCircle(20f)
.apply { circle.color= Color.BLACK;circle.color.a=0.5f }
private fun getStatIconsTable(statName: String, number: Int): Table {
val table = Table()
when (number) {
1 -> table.add(ImageGetter.getStatIcon(statName)).size(20f)
1 -> table.add(getIcon(statName))
2 -> {
table.add(ImageGetter.getStatIcon(statName)).size(20f).row()
table.add(ImageGetter.getStatIcon(statName)).size(20f)
table.add(getIcon(statName)).row()
table.add(getIcon(statName))
}
3 -> {
table.add(ImageGetter.getStatIcon(statName)).size(20f).colspan(2).row()
table.add(ImageGetter.getStatIcon(statName)).size(20f)
table.add(ImageGetter.getStatIcon(statName)).size(20f)
table.add(getIcon(statName)).colspan(2).row()
table.add(getIcon(statName))
table.add(getIcon(statName))
}
4 -> {
table.add(ImageGetter.getStatIcon(statName)).size(20f)
table.add(ImageGetter.getStatIcon(statName)).size(20f).row()
table.add(ImageGetter.getStatIcon(statName)).size(20f)
table.add(ImageGetter.getStatIcon(statName)).size(20f)
table.add(getIcon(statName))
table.add(getIcon(statName)).row()
table.add(getIcon(statName))
table.add(getIcon(statName))
}
else -> {
val largeImage = ImageGetter.getStatIcon(statName)

View File

@ -17,6 +17,7 @@ import com.unciv.ui.utils.center
open class TileGroup(var tileInfo: TileInfo) : Group() {
protected val hexagon = ImageGetter.getImage("TerrainIcons/Hexagon.png")
protected var baseTerrainImage: Image? = null
protected var terrainFeatureImage: Image? = null
protected var cityImage: Image? = null
@ -44,9 +45,22 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
addCircleImage()
addFogImage(groupSize)
addCrosshairImage()
addBaseTerrainImage()
isTransform = false
}
private fun addBaseTerrainImage() {
val imagePath = "TerrainIcons/"+tileInfo.baseTerrain
if(!ImageGetter.imageExists(imagePath)) return
baseTerrainImage = ImageGetter.getImage(imagePath)
baseTerrainImage!!.run {
color.a=0.25f
setSize(40f,40f)
center(this@TileGroup)
}
addActor(baseTerrainImage)
}
private fun addCircleImage() {
circleImage.width = 50f
circleImage.height = 50f

View File

@ -53,8 +53,12 @@ object ImageGetter {
}
}
fun imageExists(fileName:String): Boolean {
return atlas.findRegion(fileName)!=null
}
fun techIconExists(techName:String): Boolean {
return atlas.findRegion("TechIcons/$techName")!=null
return imageExists("TechIcons/$techName")
}
fun getStatIcon(statName: String): Image {

View File

@ -268,9 +268,9 @@ class WorldScreen : CameraStageBaseScreen() {
&& civInfo.viewableTiles.any { it.getUnits().any { unit -> unit.civInfo.isBarbarianCivilization() } })
displayTutorials("BarbarianEncountered")
if(civInfo.cities.size > 2) displayTutorials("SecondCity")
if(civInfo.happiness<0) displayTutorials("Unhappiness")
if(civInfo.happiness < 0) displayTutorials("Unhappiness")
if(civInfo.goldenAges.isGoldenAge()) displayTutorials("GoldenAge")
if(gameInfo.turns>=100) displayTutorials("ContactMe")
if(gameInfo.turns >= 100) displayTutorials("ContactMe")
val resources = civInfo.getCivResources()
if(resources.keys.any { it.resourceType==ResourceType.Luxury }) displayTutorials("LuxuryResource")
if(resources.keys.any { it.resourceType==ResourceType.Strategic}) displayTutorials("StrategicResource")