Cities connected to capital have a connected symbol next to them

Unit information displays XP to next promotion
This commit is contained in:
Yair Morgenstern 2018-06-21 22:52:24 +03:00
parent 415add2417
commit bed7a37a6b
9 changed files with 26 additions and 13 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -195,4 +195,14 @@
] ]
], ],
SecondCity: [
[
"You have founded your second city!",
"Connecting your cities to the capital by roads",
" will generate gold via the trade route.",
"Note that each road costs 1 gold maintainance per turn, "
" so it may be more economical to wait until the cities grow!"
]
]
} }

View File

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.game" applicationId "com.unciv.game"
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 26 targetSdkVersion 26
versionCode 87 versionCode 89
versionName "2.5.3" versionName "2.5.4.2"
} }
buildTypes { buildTypes {
release { release {

View File

@ -16,8 +16,7 @@ class UnCivGame : Game() {
* This exists so that when debugging we can see the entire map. * This exists so that when debugging we can see the entire map.
* Remember to turn this to false before commit and upload! * Remember to turn this to false before commit and upload!
*/ */
val viewEntireMapForDebug = true val viewEntireMapForDebug = false
lateinit var worldScreen: WorldScreen lateinit var worldScreen: WorldScreen

View File

@ -14,8 +14,7 @@ import com.unciv.models.stats.Stats
import kotlin.math.min import kotlin.math.min
class CityInfo { class CityInfo {
@Transient @Transient lateinit var civInfo: CivilizationInfo
lateinit var civInfo: CivilizationInfo
var location: Vector2 = Vector2.Zero var location: Vector2 = Vector2.Zero
var name: String = "" var name: String = ""
var health = 200 var health = 200

View File

@ -255,7 +255,7 @@ class CityStats {
this.currentCityStats = stats this.currentCityStats = stats
} }
private fun isConnectedToCapital(roadType: RoadStatus): Boolean { fun isConnectedToCapital(roadType: RoadStatus): Boolean {
if(cityInfo.civInfo.cities.count()<2) return false// first city! if(cityInfo.civInfo.cities.count()<2) return false// first city!
val capitalTile = cityInfo.civInfo.getCapital().getCenterTile() val capitalTile = cityInfo.civInfo.getCapital().getCenterTile()
val tilesReached = HashSet<TileInfo>() val tilesReached = HashSet<TileInfo>()

View File

@ -215,8 +215,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
} }
} }
if(improvementImage!=null){ if(improvementImage!=null){
if(viewable) improvementImage!!.color= Color.WHITE if(!viewable) improvementImage!!.color= Color.WHITE.cpy().apply { a=0.7f }
else improvementImage!!.color= Color.WHITE.cpy().apply { a=0.7f }
} }
} }

View File

@ -1,13 +1,13 @@
package com.unciv.ui.tilegroups package com.unciv.ui.tilegroups
import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.graphics.Color
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.Table import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.utils.Align import com.badlogic.gdx.utils.Align
import com.unciv.UnCivGame import com.unciv.UnCivGame
import com.unciv.logic.city.CityInfo import com.unciv.logic.city.CityInfo
import com.unciv.logic.map.MapUnit import com.unciv.logic.map.MapUnit
import com.unciv.logic.map.RoadStatus
import com.unciv.logic.map.TileInfo import com.unciv.logic.map.TileInfo
import com.unciv.models.gamebasics.unit.UnitType import com.unciv.models.gamebasics.unit.UnitType
import com.unciv.ui.cityscreen.CityScreen import com.unciv.ui.cityscreen.CityScreen
@ -101,9 +101,15 @@ class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) {
add(fireImage).size(20f).padLeft(5f) add(fireImage).size(20f).padLeft(5f)
} }
if(city.isCapital()){ if(city.isCapital()){
val starImage = Image(ImageGetter.getDrawable("OtherIcons/Star.png").tint(Color.LIGHT_GRAY)) val starImage = ImageGetter.getImage("OtherIcons/Star.png").apply { color = Color.LIGHT_GRAY}
add(starImage).size(20f).padLeft(5f) add(starImage).size(20f).padLeft(5f)
} else{add()} // this is so the health bar is always 2 columns wide }
else if (city.cityStats.isConnectedToCapital(RoadStatus.Road)){
val connectionImage = ImageGetter.getStatIcon("CityConnection")
add(connectionImage).size(20f).padLeft(5f)
}
else{add()} // this is so the health bar is always 2 columns wide
add(label).pad(10f) add(label).pad(10f)
pack() pack()
setOrigin(Align.center) setOrigin(Align.center)

View File

@ -70,7 +70,7 @@ class UnitTable(val worldScreen: WorldScreen) : Table(){
if (unit.getBaseUnit().rangedStrength!=0) if (unit.getBaseUnit().rangedStrength!=0)
unitLabelText += "\n"+"Ranged strength".tr()+": "+unit.getBaseUnit().rangedStrength unitLabelText += "\n"+"Ranged strength".tr()+": "+unit.getBaseUnit().rangedStrength
unitLabelText += "\n"+"XP".tr()+": "+unit.promotions.XP unitLabelText += "\n"+"XP".tr()+": "+unit.promotions.XP+"/"+unit.promotions.xpForNextPromotion()
if(unit.isFortified() && unit.getFortificationTurns()>0) if(unit.isFortified() && unit.getFortificationTurns()>0)
unitLabelText+="\n+"+unit.getFortificationTurns()*20+"% fortification" unitLabelText+="\n+"+unit.getFortificationTurns()*20+"% fortification"