Resolved #384 - can now sell one building per city per turn
This commit is contained in:
parent
adea36fb81
commit
2ec8225c20
3 changed files with 21 additions and 3 deletions
|
@ -21,8 +21,8 @@ android {
|
|||
applicationId "com.unciv.app"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 28
|
||||
versionCode 212
|
||||
versionName "2.13.11"
|
||||
versionCode 213
|
||||
versionName "2.13.12"
|
||||
}
|
||||
|
||||
// Had to add this crap for Travis to build, it wanted to sign the app
|
||||
|
|
|
@ -279,6 +279,7 @@ class CityInfo {
|
|||
cityConstructions.builtBuildings.remove(buildingName)
|
||||
cityConstructions.removeBuilding(buildingName)
|
||||
civInfo.gold += getGoldForSellingBuilding(buildingName)
|
||||
hasSoldBuildingThisTurn=true
|
||||
}
|
||||
//endregion
|
||||
}
|
|
@ -10,9 +10,11 @@ import com.badlogic.gdx.utils.Align
|
|||
import com.unciv.logic.city.CityInfo
|
||||
import com.unciv.logic.civilization.GreatPersonManager
|
||||
import com.unciv.models.gamebasics.Building
|
||||
import com.unciv.models.gamebasics.tr
|
||||
import com.unciv.models.stats.Stat
|
||||
import com.unciv.models.stats.Stats
|
||||
import com.unciv.ui.utils.*
|
||||
import com.unciv.ui.worldscreen.optionstable.YesNoPopupTable
|
||||
import java.text.DecimalFormat
|
||||
import java.util.*
|
||||
|
||||
|
@ -60,7 +62,22 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS
|
|||
val detailsString = building.getDescription(true,
|
||||
cityScreen.city.civInfo.policies.adoptedPolicies)
|
||||
wonderDetailsTable.add(detailsString.toLabel().apply { setWrap(true)})
|
||||
.width(cityScreen.stage.width/4 - 2*pad ) // when you set wrap, then you need to manually set the size of the label
|
||||
.width(cityScreen.stage.width/4 - 2*pad ).row() // when you set wrap, then you need to manually set the size of the label
|
||||
if(!building.isWonder) {
|
||||
val sellAmount = cityScreen.city.getGoldForSellingBuilding(building.name)
|
||||
val sellBuildingButton = TextButton("Sell for [$sellAmount] gold".tr(),skin)
|
||||
wonderDetailsTable.add(sellBuildingButton).pad(5f).row()
|
||||
sellBuildingButton.onClick {
|
||||
YesNoPopupTable("Are you sure you want to sell this [${building.name}]?".tr(),
|
||||
{
|
||||
cityScreen.city.sellBuilding(building.name)
|
||||
cityScreen.city.cityStats.update()
|
||||
cityScreen.update()
|
||||
}, cityScreen)
|
||||
}
|
||||
if(cityScreen.city.hasSoldBuildingThisTurn || sellAmount > cityScreen.city.civInfo.gold)
|
||||
sellBuildingButton.disable()
|
||||
}
|
||||
wonderDetailsTable.addSeparator()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue