From 6cda5bb8ad0b1e2929b7334b036ee62f5512c6c0 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 24 Feb 2019 13:07:34 +0200 Subject: [PATCH] Fixed #467 - popups on separate screens affected each other --- android/build.gradle | 4 ++-- core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt | 1 + .../unciv/ui/worldscreen/optionstable/PopupTable.kt | 10 +++------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 7f8d892e..8241e4d3 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,8 +21,8 @@ android { applicationId "com.unciv.app" minSdkVersion 14 targetSdkVersion 28 - versionCode 206 - versionName "2.13.6" + versionCode 207 + versionName "2.13.7" } // Had to add this crap for Travis to build, it wanted to sign the app diff --git a/core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt b/core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt index 069d1dfb..83c093d2 100644 --- a/core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt +++ b/core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt @@ -19,6 +19,7 @@ open class CameraStageBaseScreen : Screen { var game: UnCivGame = UnCivGame.Current var stage: Stage var tutorials = Tutorials() + var hasPopupOpen = false init { val resolutions: List = game.settings.resolution.split("x").map { it.toInt().toFloat() } diff --git a/core/src/com/unciv/ui/worldscreen/optionstable/PopupTable.kt b/core/src/com/unciv/ui/worldscreen/optionstable/PopupTable.kt index 82fffaa3..1065ad3c 100644 --- a/core/src/com/unciv/ui/worldscreen/optionstable/PopupTable.kt +++ b/core/src/com/unciv/ui/worldscreen/optionstable/PopupTable.kt @@ -40,8 +40,8 @@ open class PopupTable(val screen: CameraStageBaseScreen): Table(CameraStageBaseS class YesNoPopupTable(question:String, action:()->Unit, screen: CameraStageBaseScreen = UnCivGame.Current.worldScreen) : PopupTable(screen){ init{ - if(!isOpen) { - isOpen=true + if(!screen.hasPopupOpen) { + screen.hasPopupOpen=true add(question.toLabel()).colspan(2).row() add(TextButton("No".tr(), skin).onClick { close() }) @@ -52,10 +52,6 @@ class YesNoPopupTable(question:String, action:()->Unit, fun close(){ remove() - isOpen=false - } - - companion object { - var isOpen=false + screen.hasPopupOpen=false } } \ No newline at end of file