Fixed #467 - popups on separate screens affected each other

This commit is contained in:
Yair Morgenstern 2019-02-24 13:07:34 +02:00
parent b73077baa4
commit 6cda5bb8ad
3 changed files with 6 additions and 9 deletions

View file

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.app" applicationId "com.unciv.app"
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 28 targetSdkVersion 28
versionCode 206 versionCode 207
versionName "2.13.6" versionName "2.13.7"
} }
// Had to add this crap for Travis to build, it wanted to sign the app // Had to add this crap for Travis to build, it wanted to sign the app

View file

@ -19,6 +19,7 @@ open class CameraStageBaseScreen : Screen {
var game: UnCivGame = UnCivGame.Current var game: UnCivGame = UnCivGame.Current
var stage: Stage var stage: Stage
var tutorials = Tutorials() var tutorials = Tutorials()
var hasPopupOpen = false
init { init {
val resolutions: List<Float> = game.settings.resolution.split("x").map { it.toInt().toFloat() } val resolutions: List<Float> = game.settings.resolution.split("x").map { it.toInt().toFloat() }

View file

@ -40,8 +40,8 @@ open class PopupTable(val screen: CameraStageBaseScreen): Table(CameraStageBaseS
class YesNoPopupTable(question:String, action:()->Unit, class YesNoPopupTable(question:String, action:()->Unit,
screen: CameraStageBaseScreen = UnCivGame.Current.worldScreen) : PopupTable(screen){ screen: CameraStageBaseScreen = UnCivGame.Current.worldScreen) : PopupTable(screen){
init{ init{
if(!isOpen) { if(!screen.hasPopupOpen) {
isOpen=true screen.hasPopupOpen=true
add(question.toLabel()).colspan(2).row() add(question.toLabel()).colspan(2).row()
add(TextButton("No".tr(), skin).onClick { close() }) add(TextButton("No".tr(), skin).onClick { close() })
@ -52,10 +52,6 @@ class YesNoPopupTable(question:String, action:()->Unit,
fun close(){ fun close(){
remove() remove()
isOpen=false screen.hasPopupOpen=false
}
companion object {
var isOpen=false
} }
} }