mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 06:16:37 -04:00
Resolved #3520 - picker screens go back on Back button / Esc
This commit is contained in:
parent
af326100fc
commit
09d44bfcd2
@ -128,6 +128,10 @@ class MainMenuScreen: CameraStageBaseScreen() {
|
|||||||
stage.addActor(scroll)
|
stage.addActor(scroll)
|
||||||
|
|
||||||
onBackButtonClicked {
|
onBackButtonClicked {
|
||||||
|
if(hasOpenPopups()) {
|
||||||
|
closeAllPopups()
|
||||||
|
return@onBackButtonClicked
|
||||||
|
}
|
||||||
val promptWindow = Popup(this)
|
val promptWindow = Popup(this)
|
||||||
promptWindow.addGoodSizedLabel("Do you want to exit the game?".tr())
|
promptWindow.addGoodSizedLabel("Do you want to exit the game?".tr())
|
||||||
promptWindow.row()
|
promptWindow.row()
|
||||||
|
@ -46,11 +46,13 @@ open class PickerScreen : CameraStageBaseScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun setDefaultCloseAction(previousScreen: CameraStageBaseScreen?=null) {
|
fun setDefaultCloseAction(previousScreen: CameraStageBaseScreen?=null) {
|
||||||
closeButton.onClick {
|
val closeAction = {
|
||||||
if (previousScreen != null) game.setScreen(previousScreen)
|
if (previousScreen != null) game.setScreen(previousScreen)
|
||||||
else game.setWorldScreen()
|
else game.setWorldScreen()
|
||||||
dispose()
|
dispose()
|
||||||
}
|
}
|
||||||
|
closeButton.onClick(closeAction)
|
||||||
|
onBackButtonClicked(closeAction)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setRightSideButtonEnabled(bool: Boolean) {
|
fun setRightSideButtonEnabled(bool: Boolean) {
|
||||||
@ -59,7 +61,7 @@ open class PickerScreen : CameraStageBaseScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected fun pick(rightButtonText: String) {
|
protected fun pick(rightButtonText: String) {
|
||||||
if(UncivGame.Current.worldScreen.isPlayersTurn) rightSideButton.enable()
|
if (UncivGame.Current.worldScreen.isPlayersTurn) rightSideButton.enable()
|
||||||
rightSideButton.setText(rightButtonText)
|
rightSideButton.setText(rightButtonText)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user