From 8ef09a816a6dab0ef3df5703c36e4650114a201f Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 27 Aug 2019 14:57:40 +0300 Subject: [PATCH] Fixed annoying "can't click next turn" bug! --- core/src/com/unciv/UnCivGame.kt | 2 +- core/src/com/unciv/ui/worldscreen/AlertPopup.kt | 8 ++------ core/src/com/unciv/ui/worldscreen/WorldScreen.kt | 5 +++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/core/src/com/unciv/UnCivGame.kt b/core/src/com/unciv/UnCivGame.kt index ec229394fb..cee9055240 100644 --- a/core/src/com/unciv/UnCivGame.kt +++ b/core/src/com/unciv/UnCivGame.kt @@ -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 diff --git a/core/src/com/unciv/ui/worldscreen/AlertPopup.kt b/core/src/com/unciv/ui/worldscreen/AlertPopup.kt index a461f79cdd..af37eca665 100644 --- a/core/src/com/unciv/ui/worldscreen/AlertPopup.kt +++ b/core/src/com/unciv/ui/worldscreen/AlertPopup.kt @@ -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 - } } \ No newline at end of file diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index c60fc26d51..8758eed9c9 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -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) }