Display price for temporary unavailable purchases (#2344)

This commit is contained in:
Jack Rainy
2020-04-06 20:06:24 +03:00
committed by GitHub
parent 4bb92e2ffe
commit e869eb26f7

View File

@ -333,11 +333,9 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre
val button = TextButton("", CameraStageBaseScreen.skin) val button = TextButton("", CameraStageBaseScreen.skin)
if (construction == null || !construction.canBePurchased() if (construction == null || !construction.canBePurchased()
|| !construction.isBuildable(cityConstructions)
|| !UncivGame.Current.worldScreen.isPlayersTurn
|| city.isPuppet || city.isInResistance()
|| !city.canPurchase(construction)
) { ) {
// fully disable a "buy" button only for "priceless" buildings such as wonders
// for all other cases, the price should be displayed
button.setText("Buy".tr()) button.setText("Buy".tr())
button.disable() button.disable()
} else { } else {
@ -354,7 +352,11 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre
YesNoPopup(purchasePrompt, { purchaseConstruction(construction) }, cityScreen, { cityScreen.update() }).open() YesNoPopup(purchasePrompt, { purchaseConstruction(construction) }, cityScreen, { cityScreen.update() }).open()
} }
if (constructionGoldCost > city.civInfo.gold) if ( !construction.isBuildable(cityConstructions)
|| !UncivGame.Current.worldScreen.isPlayersTurn
|| city.isPuppet || city.isInResistance()
|| !city.canPurchase(construction)
|| constructionGoldCost > city.civInfo.gold )
button.disable() button.disable()
} }