mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 14:24:43 -04:00
Resolved #579 - When picking a construction and buying it, chosen construction reverts to previously chosen construction
This commit is contained in:
parent
70fd2be955
commit
9b9b21fe28
@ -18,6 +18,7 @@ import com.unciv.ui.worldscreen.optionstable.YesNoPopupTable
|
|||||||
class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScreen.skin){
|
class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScreen.skin){
|
||||||
|
|
||||||
var constructionScrollPane:ScrollPane?=null
|
var constructionScrollPane:ScrollPane?=null
|
||||||
|
var lastConstruction = ""
|
||||||
|
|
||||||
private fun getProductionButton(construction: String, buttonText: String, rejectionReason: String=""): Table {
|
private fun getProductionButton(construction: String, buttonText: String, rejectionReason: String=""): Table {
|
||||||
val pickProductionButton = Table()
|
val pickProductionButton = Table()
|
||||||
@ -35,6 +36,7 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre
|
|||||||
|
|
||||||
if(rejectionReason=="") {
|
if(rejectionReason=="") {
|
||||||
pickProductionButton.onClick {
|
pickProductionButton.onClick {
|
||||||
|
lastConstruction = cityScreen.city.cityConstructions.currentConstruction
|
||||||
cityScreen.city.cityConstructions.currentConstruction = construction
|
cityScreen.city.cityConstructions.currentConstruction = construction
|
||||||
cityScreen.city.cityStats.update()
|
cityScreen.city.cityStats.update()
|
||||||
cityScreen.update()
|
cityScreen.update()
|
||||||
@ -131,7 +133,8 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun addCurrentConstructionTable(city: CityInfo) {
|
private fun addCurrentConstructionTable(city: CityInfo) {
|
||||||
val construction = city.cityConstructions.getCurrentConstruction()
|
val cityConstructions = city.cityConstructions
|
||||||
|
val construction = cityConstructions.getCurrentConstruction()
|
||||||
|
|
||||||
row()
|
row()
|
||||||
val purchaseConstructionButton: TextButton
|
val purchaseConstructionButton: TextButton
|
||||||
@ -140,7 +143,9 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre
|
|||||||
purchaseConstructionButton = TextButton("Buy for [$buildingGoldCost] gold".tr(), CameraStageBaseScreen.skin)
|
purchaseConstructionButton = TextButton("Buy for [$buildingGoldCost] gold".tr(), CameraStageBaseScreen.skin)
|
||||||
purchaseConstructionButton.onClick("coin") {
|
purchaseConstructionButton.onClick("coin") {
|
||||||
YesNoPopupTable("Would you like to purchase [${construction.name}] for [$buildingGoldCost] gold?".tr(), {
|
YesNoPopupTable("Would you like to purchase [${construction.name}] for [$buildingGoldCost] gold?".tr(), {
|
||||||
city.cityConstructions.purchaseBuilding(construction.name)
|
cityConstructions.purchaseBuilding(construction.name)
|
||||||
|
if(lastConstruction!="" && cityConstructions.getConstruction(lastConstruction).isBuildable(cityConstructions))
|
||||||
|
city.cityConstructions.currentConstruction = lastConstruction
|
||||||
update()
|
update()
|
||||||
}, cityScreen)
|
}, cityScreen)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user