Fixed annoying "can't click next turn" bug!

This commit is contained in:
Yair Morgenstern 2019-08-27 14:57:40 +03:00
parent 5ae8f0d6ff
commit 8ef09a816a
3 changed files with 6 additions and 9 deletions

View File

@ -21,7 +21,7 @@ class UnCivGame(val version: String) : Game() {
* This exists so that when debugging we can see the entire map.
* Remember to turn this to false before commit and upload!
*/
val viewEntireMapForDebug = false
val viewEntireMapForDebug = true
// For when you need to test something in an advanced game and don't have time to faff around
val superchargedForDebug = false

View File

@ -98,16 +98,12 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu
}
}
open()
isOpen = true
worldScreen.alertPopupIsOpen = true
}
fun close(){
worldScreen.viewingCiv.popupAlerts.remove(popupAlert)
isOpen = false
worldScreen.alertPopupIsOpen = false
remove()
}
companion object {
var isOpen = false
}
}

View File

@ -46,6 +46,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
private val nextTurnButton = createNextTurnButton()
private val notificationsScroll: NotificationsScroll
var alertPopupIsOpen = false // if we have an alert popup and then we changed screens, the old one shouldn't affect us
init {
topBar.setPosition(0f, stage.height - topBar.height)
@ -139,7 +140,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
nextTurnButton.y - notificationsScroll.height - 5f)
val isSomethingOpen = tutorials.isTutorialShowing || stage.actors.any { it is TradePopup }
|| AlertPopup.isOpen
|| alertPopupIsOpen
if(!isSomethingOpen) {
when {
!gameInfo.oneMoreTurnMode && gameInfo.civilizations.any { it.victoryManager.hasWon() } -> game.screen = VictoryScreen()
@ -324,7 +325,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 (AlertPopup.isOpen || !isPlayersTurn) nextTurnButton.disable()
if (alertPopupIsOpen || !isPlayersTurn) nextTurnButton.disable()
else nextTurnButton.enable()
nextTurnButton.setPosition(stage.width - nextTurnButton.width - 10f, topBar.y - nextTurnButton.height - 10f)
}