mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-18 11:49:19 +07:00
Can no longer pass the turn when popups have not been dealt with
This commit is contained in:
@ -343,7 +343,7 @@
|
||||
French:"Votre soi-disant 'amitié' ne vaut rien."
|
||||
}
|
||||
|
||||
"You have publically denounced us!":{
|
||||
"You have publicly denounced us!":{
|
||||
Italian:"Ci hai denunciato pubblicamente di fronte al mondo!"
|
||||
French:"Vous nous avez dénoncé publiquement!"
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ class UnitAutomation{
|
||||
fun tryPillageImprovement(unit: MapUnit, unitDistanceToTiles: HashMap<TileInfo, Float>) : Boolean {
|
||||
if(unit.type.isCivilian()) return false
|
||||
val tilesInDistance = unitDistanceToTiles.filter {it.value < unit.currentMovement}.keys
|
||||
.filter { unit.canMoveTo(it) && it.improvement != null && UnitActions().canPillage(unit,it) }
|
||||
.filter { unit.canMoveTo(it) && UnitActions().canPillage(unit,it) }
|
||||
|
||||
if (tilesInDistance.isEmpty()) return false
|
||||
val tileToPillage = tilesInDistance.maxBy { it.getDefensiveBonus() }!!
|
||||
|
@ -19,6 +19,7 @@ import com.unciv.logic.trade.TradeType
|
||||
import com.unciv.models.gamebasics.tr
|
||||
import com.unciv.ui.utils.*
|
||||
import com.unciv.ui.worldscreen.optionstable.YesNoPopupTable
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
class DiplomacyScreen:CameraStageBaseScreen() {
|
||||
|
||||
@ -38,6 +39,9 @@ class DiplomacyScreen:CameraStageBaseScreen() {
|
||||
|
||||
val closeButton = TextButton("Close".tr(), skin)
|
||||
closeButton.onClick { UnCivGame.Current.setWorldScreen() }
|
||||
closeButton.label.setFontSize(24)
|
||||
closeButton.labelCell.pad(10f)
|
||||
closeButton.pack()
|
||||
closeButton.y = stage.height - closeButton.height - 10
|
||||
closeButton.x = 10f
|
||||
stage.addActor(closeButton) // This must come after the split pane so it will be above, that the button will be clickable
|
||||
@ -240,13 +244,14 @@ class DiplomacyScreen:CameraStageBaseScreen() {
|
||||
DeclaredFriendshipWithOurAllies -> "You have declared friendship with our allies"
|
||||
OpenBorders -> "Our open borders have brought us closer together."
|
||||
BetrayedDeclarationOfFriendship -> "Your so-called 'friendship' is worth nothing."
|
||||
Denunciation -> "You have publically denounced us!"
|
||||
Denunciation -> "You have publicly denounced us!"
|
||||
DenouncedOurAllies -> "You have denounced our allies"
|
||||
DenouncedOurEnemies -> "You have denounced our enemies"
|
||||
BetrayedPromiseToNotSettleCitiesNearUs -> "You betrayed your promise to not settle cities near us"
|
||||
}
|
||||
text = text.tr() + " "
|
||||
if (modifier.value > 0) text += "+"
|
||||
text += modifier.value.toInt()
|
||||
text += modifier.value.roundToInt()
|
||||
val color = if (modifier.value < 0) Color.RED else Color.GREEN
|
||||
diplomacyModifiersTable.add(text.toLabel().setFontColor(color)).row()
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import com.unciv.ui.worldscreen.optionstable.PopupTable
|
||||
class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): PopupTable(worldScreen){
|
||||
fun getCloseButton(text:String): TextButton {
|
||||
val button = TextButton(text.tr(), skin)
|
||||
button.onClick { close() }
|
||||
button.onClick { close(); worldScreen.shouldUpdate=true }
|
||||
return button
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,6 @@ class WorldScreen : CameraStageBaseScreen() {
|
||||
|
||||
updateTechButton(cloneCivilization)
|
||||
updateDiplomacyButton(cloneCivilization)
|
||||
updateNextTurnButton()
|
||||
|
||||
bottomBar.update(tileMapHolder.selectedTile) // has to come before tilemapholder update because the tilemapholder actions depend on the selected unit!
|
||||
battleTable.update()
|
||||
@ -174,6 +173,7 @@ class WorldScreen : CameraStageBaseScreen() {
|
||||
&& currentPlayerCiv.popupAlerts.any() && !AlertPopup.isOpen ->
|
||||
AlertPopup(this,currentPlayerCiv.popupAlerts.first())
|
||||
}
|
||||
updateNextTurnButton()
|
||||
}
|
||||
|
||||
private fun updateDiplomacyButton(civInfo: CivilizationInfo) {
|
||||
@ -300,6 +300,8 @@ class WorldScreen : CameraStageBaseScreen() {
|
||||
nextTurnButton.setText(text.tr())
|
||||
nextTurnButton.color = if(text=="Next turn") Color.WHITE else Color.GRAY
|
||||
nextTurnButton.pack()
|
||||
if(AlertPopup.isOpen) nextTurnButton.disable()
|
||||
else nextTurnButton.enable()
|
||||
nextTurnButton.setPosition(stage.width - nextTurnButton.width - 10f, topBar.y - nextTurnButton.height - 10f)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user