mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 05:46:43 -04:00
Fixed queue showing "Consumes 1" when no resource is consumed
Plus linting
This commit is contained in:
parent
5328efa233
commit
7d9b56e3b1
@ -39,7 +39,8 @@ open class TileInfo {
|
|||||||
// This will be called often - farm can be built on Hill and tundra if adjacent to fresh water
|
// This will be called often - farm can be built on Hill and tundra if adjacent to fresh water
|
||||||
// and farms on adjacent to fresh water tiles will have +1 additional Food after researching Civil Service
|
// and farms on adjacent to fresh water tiles will have +1 additional Food after researching Civil Service
|
||||||
@delegate:Transient
|
@delegate:Transient
|
||||||
val isAdjacentToFreshwater: Boolean by lazy { matchesUniqueFilter("River") || matchesUniqueFilter("Fresh water") || neighbors.any { it.matchesUniqueFilter("Fresh water") } }
|
val isAdjacentToFreshwater: Boolean by lazy { matchesUniqueFilter("River") || matchesUniqueFilter("Fresh water")
|
||||||
|
|| neighbors.any { it.matchesUniqueFilter("Fresh water") } }
|
||||||
|
|
||||||
var militaryUnit: MapUnit? = null
|
var militaryUnit: MapUnit? = null
|
||||||
var civilianUnit: MapUnit? = null
|
var civilianUnit: MapUnit? = null
|
||||||
|
@ -181,8 +181,8 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS
|
|||||||
for ((key, value) in cityStats.baseStatList)
|
for ((key, value) in cityStats.baseStatList)
|
||||||
relevantBaseStats[key] = value.get(stat)
|
relevantBaseStats[key] = value.get(stat)
|
||||||
else relevantBaseStats.putAll(cityStats.happinessList)
|
else relevantBaseStats.putAll(cityStats.happinessList)
|
||||||
for(key in relevantBaseStats.keys.toList())
|
for (key in relevantBaseStats.keys.toList())
|
||||||
if(relevantBaseStats[key]==0f) relevantBaseStats.remove(key)
|
if (relevantBaseStats[key] == 0f) relevantBaseStats.remove(key)
|
||||||
|
|
||||||
if (relevantBaseStats.isEmpty()) continue
|
if (relevantBaseStats.isEmpty()) continue
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS
|
|||||||
else statValuesTable.add("$decimal%".toLabel()).row() // negative bonus
|
else statValuesTable.add("$decimal%".toLabel()).row() // negative bonus
|
||||||
}
|
}
|
||||||
|
|
||||||
if(stat!=Stat.Happiness) {
|
if (stat != Stat.Happiness) {
|
||||||
statValuesTable.add("Final".toLabel(fontSize = FONT_SIZE_STAT_INFO_HEADER)).colspan(2).padTop(20f).row()
|
statValuesTable.add("Final".toLabel(fontSize = FONT_SIZE_STAT_INFO_HEADER)).colspan(2).padTop(20f).row()
|
||||||
var finalTotal = 0f
|
var finalTotal = 0f
|
||||||
for (entry in cityStats.finalStatList) {
|
for (entry in cityStats.finalStatList) {
|
||||||
|
@ -7,7 +7,7 @@ import com.badlogic.gdx.utils.Align
|
|||||||
import com.unciv.models.translations.tr
|
import com.unciv.models.translations.tr
|
||||||
import com.unciv.ui.utils.*
|
import com.unciv.ui.utils.*
|
||||||
|
|
||||||
class CityScreenCityPickerTable(val cityScreen: CityScreen) : Table(){
|
class CityScreenCityPickerTable(val cityScreen: CityScreen) : Table() {
|
||||||
|
|
||||||
fun update() {
|
fun update() {
|
||||||
val city = cityScreen.city
|
val city = cityScreen.city
|
||||||
@ -25,18 +25,18 @@ class CityScreenCityPickerTable(val cityScreen: CityScreen) : Table(){
|
|||||||
} else add()
|
} else add()
|
||||||
|
|
||||||
val cityNameTable = Table()
|
val cityNameTable = Table()
|
||||||
if(city.isBeingRazed){
|
if (city.isBeingRazed) {
|
||||||
val fireImage = ImageGetter.getImage("OtherIcons/Fire")
|
val fireImage = ImageGetter.getImage("OtherIcons/Fire")
|
||||||
cityNameTable.add(fireImage).size(20f).padRight(5f)
|
cityNameTable.add(fireImage).size(20f).padRight(5f)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(city.isCapital()){
|
if (city.isCapital()) {
|
||||||
val starImage = ImageGetter.getImage("OtherIcons/Star").apply { color= Color.LIGHT_GRAY }
|
val starImage = ImageGetter.getImage("OtherIcons/Star").apply { color = Color.LIGHT_GRAY }
|
||||||
cityNameTable.add(starImage).size(20f).padRight(5f)
|
cityNameTable.add(starImage).size(20f).padRight(5f)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(city.isPuppet){
|
if (city.isPuppet) {
|
||||||
val starImage = ImageGetter.getImage("OtherIcons/Puppet").apply { color= Color.LIGHT_GRAY }
|
val starImage = ImageGetter.getImage("OtherIcons/Puppet").apply { color = Color.LIGHT_GRAY }
|
||||||
cityNameTable.add(starImage).size(20f).padRight(5f)
|
cityNameTable.add(starImage).size(20f).padRight(5f)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class CityScreenCityPickerTable(val cityScreen: CityScreen) : Table(){
|
|||||||
textArea.alignment = Align.center
|
textArea.alignment = Align.center
|
||||||
editCityNamePopup.add(textArea).colspan(2).row()
|
editCityNamePopup.add(textArea).colspan(2).row()
|
||||||
editCityNamePopup.addCloseButton()
|
editCityNamePopup.addCloseButton()
|
||||||
editCityNamePopup.addButton("Save".tr()){
|
editCityNamePopup.addButton("Save".tr()) {
|
||||||
city.name = textArea.text
|
city.name = textArea.text
|
||||||
cityScreen.game.setScreen(CityScreen(city))
|
cityScreen.game.setScreen(CityScreen(city))
|
||||||
}
|
}
|
||||||
@ -62,14 +62,14 @@ class CityScreenCityPickerTable(val cityScreen: CityScreen) : Table(){
|
|||||||
|
|
||||||
cityNameTable.add(currentCityLabel)
|
cityNameTable.add(currentCityLabel)
|
||||||
|
|
||||||
add(cityNameTable).width(stage.width/4)
|
add(cityNameTable).width(stage.width / 4)
|
||||||
|
|
||||||
|
|
||||||
if (civInfo.cities.size > 1) {
|
if (civInfo.cities.size > 1) {
|
||||||
|
|
||||||
val nextCityButton = Table() // so we gt a wider clickable area than just the image itself
|
val nextCityButton = Table() // so we gt a wider clickable area than just the image itself
|
||||||
val image = ImageGetter.getImage("OtherIcons/BackArrow")
|
val image = ImageGetter.getImage("OtherIcons/BackArrow")
|
||||||
image.setSize(25f,25f)
|
image.setSize(25f, 25f)
|
||||||
image.setOrigin(Align.center)
|
image.setOrigin(Align.center)
|
||||||
image.rotation = 180f
|
image.rotation = 180f
|
||||||
image.color = civInfo.nation.getInnerColor()
|
image.color = civInfo.nation.getInnerColor()
|
||||||
@ -80,4 +80,4 @@ class CityScreenCityPickerTable(val cityScreen: CityScreen) : Table(){
|
|||||||
pack()
|
pack()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -40,7 +40,7 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo, tileSetStrin
|
|||||||
baseLayerGroup.color.a = 0.5f
|
baseLayerGroup.color.a = 0.5f
|
||||||
}
|
}
|
||||||
|
|
||||||
tileInfo.isWorked() && tileInfo.getWorkingCity()!=city -> {
|
tileInfo.isWorked() && tileInfo.getWorkingCity() != city -> {
|
||||||
// Don't fade out, but don't add a population icon either.
|
// Don't fade out, but don't add a population icon either.
|
||||||
baseLayerGroup.color.a = 0.5f
|
baseLayerGroup.color.a = 0.5f
|
||||||
}
|
}
|
||||||
@ -72,13 +72,12 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo, tileSetStrin
|
|||||||
yieldGroup.setScale(0.7f)
|
yieldGroup.setScale(0.7f)
|
||||||
yieldGroup.toFront()
|
yieldGroup.toFront()
|
||||||
yieldGroup.centerX(this)
|
yieldGroup.centerX(this)
|
||||||
yieldGroup.y= height * 0.25f - yieldGroup.height / 2
|
yieldGroup.y = height * 0.25f - yieldGroup.height / 2
|
||||||
|
|
||||||
if (tileInfo.isWorked()) {
|
if (tileInfo.isWorked()) {
|
||||||
yieldGroup.color = Color.WHITE
|
yieldGroup.color = Color.WHITE
|
||||||
}
|
} else if (!tileInfo.isCityCenter()) {
|
||||||
else if(!tileInfo.isCityCenter()){
|
yieldGroup.color = Color.GRAY.cpy().apply { a = 0.5f }
|
||||||
yieldGroup.color = Color.GRAY.cpy().apply { a=0.5f }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,12 +88,8 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo, tileSetStrin
|
|||||||
populationIcon.setPosition(width / 2 - populationIcon.width / 2,
|
populationIcon.setPosition(width / 2 - populationIcon.width / 2,
|
||||||
height * 0.85f - populationIcon.height / 2)
|
height * 0.85f - populationIcon.height / 2)
|
||||||
|
|
||||||
if (tileInfo.isWorked()) {
|
if (tileInfo.isWorked()) populationIcon.color = Color.WHITE
|
||||||
populationIcon.color = Color.WHITE
|
else if (!tileInfo.isCityCenter()) populationIcon.color = Color.GRAY.cpy()
|
||||||
}
|
|
||||||
else if(!tileInfo.isCityCenter()){
|
|
||||||
populationIcon.color = Color.GRAY.cpy()
|
|
||||||
}
|
|
||||||
|
|
||||||
populationIcon.toFront()
|
populationIcon.toFront()
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,8 @@ import com.unciv.ui.utils.AutoScrollPane as ScrollPane
|
|||||||
|
|
||||||
class ConstructionInfoTable(val city: CityInfo): Table() {
|
class ConstructionInfoTable(val city: CityInfo): Table() {
|
||||||
val selectedConstructionTable = Table()
|
val selectedConstructionTable = Table()
|
||||||
init{
|
|
||||||
|
init {
|
||||||
selectedConstructionTable.background = ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK, 0.5f))
|
selectedConstructionTable.background = ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK, 0.5f))
|
||||||
add(selectedConstructionTable).pad(2f).fill()
|
add(selectedConstructionTable).pad(2f).fill()
|
||||||
background = ImageGetter.getBackground(Color.WHITE)
|
background = ImageGetter.getBackground(Color.WHITE)
|
||||||
@ -41,7 +42,7 @@ class ConstructionInfoTable(val city: CityInfo): Table() {
|
|||||||
val cityConstructions = city.cityConstructions
|
val cityConstructions = city.cityConstructions
|
||||||
|
|
||||||
//val selectedConstructionTable = Table()
|
//val selectedConstructionTable = Table()
|
||||||
selectedConstructionTable.background = ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK,0.5f))
|
selectedConstructionTable.background = ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK, 0.5f))
|
||||||
selectedConstructionTable.pad(10f)
|
selectedConstructionTable.pad(10f)
|
||||||
|
|
||||||
selectedConstructionTable.add(
|
selectedConstructionTable.add(
|
||||||
@ -55,8 +56,7 @@ class ConstructionInfoTable(val city: CityInfo): Table() {
|
|||||||
val turnsToComplete = cityConstructions.turnsToConstruction(construction.name)
|
val turnsToComplete = cityConstructions.turnsToConstruction(construction.name)
|
||||||
buildingText += ("\r\n" + "Cost".tr() + " " + construction.getProductionCost(city.civInfo).toString()).tr()
|
buildingText += ("\r\n" + "Cost".tr() + " " + construction.getProductionCost(city.civInfo).toString()).tr()
|
||||||
buildingText += turnOrTurns(turnsToComplete)
|
buildingText += turnOrTurns(turnsToComplete)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
buildingText += specialConstruction.getProductionTooltip(city)
|
buildingText += specialConstruction.getProductionTooltip(city)
|
||||||
}
|
}
|
||||||
selectedConstructionTable.add(buildingText.toLabel()).row()
|
selectedConstructionTable.add(buildingText.toLabel()).row()
|
||||||
@ -65,7 +65,7 @@ class ConstructionInfoTable(val city: CityInfo): Table() {
|
|||||||
val description: String = when (construction) {
|
val description: String = when (construction) {
|
||||||
is BaseUnit -> construction.getDescription(true)
|
is BaseUnit -> construction.getDescription(true)
|
||||||
is Building -> construction.getDescription(true, city.civInfo, city.civInfo.gameInfo.ruleSet)
|
is Building -> construction.getDescription(true, city.civInfo, city.civInfo.gameInfo.ruleSet)
|
||||||
is PerpetualConstruction -> construction.description.replace("[rate]","[${construction.getConversionRate(city)}]") .tr()
|
is PerpetualConstruction -> construction.description.replace("[rate]", "[${construction.getConversionRate(city)}]").tr()
|
||||||
else -> "" // Should never happen
|
else -> "" // Should never happen
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,9 +228,10 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre
|
|||||||
else turnOrTurns(turnsToComplete)
|
else turnOrTurns(turnsToComplete)
|
||||||
|
|
||||||
val constructionResource = cityConstructions.getConstruction(name).getResourceRequirements()
|
val constructionResource = cityConstructions.getConstruction(name).getResourceRequirements()
|
||||||
|
for ((resource, amount) in constructionResource)
|
||||||
|
if (amount == 1) text += "\n" + "Consumes 1 [$resource]".tr()
|
||||||
|
else text += "\n" + "Consumes [$amount] [$resource]".tr()
|
||||||
|
|
||||||
if (constructionResource != null)
|
|
||||||
text += "\n" + "Consumes 1 [$constructionResource]".tr()
|
|
||||||
|
|
||||||
table.defaults().pad(2f).minWidth(40f)
|
table.defaults().pad(2f).minWidth(40f)
|
||||||
if (isFirstConstructionOfItsKind) table.add(getProgressBar(name)).minWidth(5f)
|
if (isFirstConstructionOfItsKind) table.add(getProgressBar(name)).minWidth(5f)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user