Can no longer click 'next turn' if popups are open - #1289

This commit is contained in:
Yair Morgenstern 2019-11-05 15:21:28 +02:00
parent b2cd200856
commit 777802ab04
4 changed files with 577 additions and 577 deletions

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View file

@ -75,8 +75,7 @@ class SpecificUnitAutomation{
.asSequence()
.sortedByDescending { nearbyTileRankings[it] }
.take(5)
.toList()
var rank = top5Tiles.asSequence().map { nearbyTileRankings[it]!! }.sum()
var rank = top5Tiles.map { nearbyTileRankings[it]!! }.sum()
if (tileInfo.isCoastalTile()) rank += 5
val luxuryResourcesInCityArea = tileInfo.getTilesAtDistance(2).filter { it.resource!=null }

View file

@ -182,10 +182,6 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
techPolicyandVictoryHolder.setPosition(10f, topBar.y - techPolicyandVictoryHolder.height - 5f)
updateDiplomacyButton(viewingCiv)
updateNextTurnButton() // This must be before the notifications update, since its position is based on it
notificationsScroll.update(viewingCiv.notifications)
notificationsScroll.setPosition(stage.width - notificationsScroll.width - 5f,
nextTurnButton.y - notificationsScroll.height - 5f)
val isSomethingOpen = tutorials.isTutorialShowing || stage.actors.any { it is TradePopup }
|| alertPopupIsOpen
@ -198,6 +194,11 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
viewingCiv.tradeRequests.isNotEmpty() -> TradePopup(this)
}
}
updateNextTurnButton(isSomethingOpen) // This must be before the notifications update, since its position is based on it
notificationsScroll.update(viewingCiv.notifications)
notificationsScroll.setPosition(stage.width - notificationsScroll.width - 5f,
nextTurnButton.y - notificationsScroll.height - 5f)
}
private fun displayTutorialsOnUpdate() {
@ -388,7 +389,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
}
}
fun updateNextTurnButton() {
fun updateNextTurnButton(isSomethingOpen: Boolean) {
val text = when {
!isPlayersTurn -> "Waiting for other players..."
viewingCiv.shouldGoToDueUnit() -> "Next unit"
@ -400,7 +401,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
nextTurnButton.setText(text.tr())
nextTurnButton.color = if (text == "Next turn") Color.WHITE else Color.GRAY
nextTurnButton.pack()
if (alertPopupIsOpen || !isPlayersTurn || waitingForAutosave) nextTurnButton.disable()
if (isSomethingOpen || !isPlayersTurn || waitingForAutosave) nextTurnButton.disable()
else nextTurnButton.enable()
nextTurnButton.setPosition(stage.width - nextTurnButton.width - 10f, topBar.y - nextTurnButton.height - 10f)
}