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