diff --git a/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt b/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt index f97b2e4002..d7e5969cdc 100644 --- a/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt +++ b/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt @@ -180,6 +180,8 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre val text = name.tr() + turnOrTurns(turnsToComplete) table.defaults().pad(2f).minWidth(40f) + if(isFirstConstructionOfItsKind) table.add(getProgressBar(name)).minWidth(5f) + else table.add().minWidth(5f) table.add(ImageGetter.getConstructionImage(name).surroundWithCircle(40f)).padRight(10f) table.add(text.toLabel()).expandX().fillX().left() @@ -198,6 +200,18 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre return table } + fun getProgressBar(constructionName:String): Table { + val cityConstructions = cityScreen.city.cityConstructions + val construction = cityConstructions.getConstruction(constructionName) + if (construction is PerpetualConstruction) return Table() + if (cityConstructions.getWorkDone(constructionName) == 0) return Table() + + val constructionPercentage = cityConstructions.getWorkDone(constructionName) / + construction.getProductionCost(cityConstructions.cityInfo.civInfo).toFloat() + return ImageGetter.getProgressBarVertical(2f, 30f, constructionPercentage, + Color.BROWN.cpy().lerp(Color.WHITE, 0.5f), Color.WHITE) + } + private fun getProductionButton(construction: String, buttonText: String, rejectionReason: String = ""): Table { val pickProductionButton = Table() @@ -209,6 +223,7 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre pickProductionButton.background = ImageGetter.getBackground(Color.GREEN.cpy().lerp(Color.BLACK, 0.5f)) } + pickProductionButton.add(getProgressBar(construction)).padRight(5f) pickProductionButton.add(ImageGetter.getConstructionImage(construction).surroundWithCircle(40f)).padRight(10f) pickProductionButton.add(buttonText.toLabel()).expandX().fillX().left() diff --git a/core/src/com/unciv/ui/tilegroups/CityButton.kt b/core/src/com/unciv/ui/tilegroups/CityButton.kt index ce43dc0ae7..d6960571c8 100644 --- a/core/src/com/unciv/ui/tilegroups/CityButton.kt +++ b/core/src/com/unciv/ui/tilegroups/CityButton.kt @@ -250,7 +250,7 @@ class CityButton(val city: CityInfo, internal val tileGroup: WorldTileGroup, ski image.centerY(group) image.x = group.width-image.width - // center the circle on thee production image + // center the circle on the production image circle.x = image.x + (image.width-circle.width)/2 circle.y = image.y + (image.height-circle.height)/2