Resolved #2503 - Resizing the game no longer returns you to the main menu

This commit is contained in:
Yair Morgenstern 2020-04-24 11:04:11 +03:00
parent 289bf62e99
commit 5a8b6fdb19
3 changed files with 13 additions and 8 deletions

View File

@ -152,7 +152,7 @@ class UncivGame(
// Maybe this will solve the resume error on chrome OS, issue 322? Worth a shot
override fun resize(width: Int, height: Int) {
resume()
screen.resize(width, height)
}
override fun dispose() {

View File

@ -23,15 +23,15 @@ class MapEditorScreen(): CameraStageBaseScreen() {
private val showHideEditorOptionsButton = ">".toTextButton()
constructor(mapNameToLoad: String?): this() {
constructor(mapNameToLoad: String?) : this() {
var mapToLoad = mapNameToLoad
if (mapToLoad == null) {
val existingSaves = MapSaver.getMaps()
if(existingSaves.isNotEmpty())
if (existingSaves.isNotEmpty())
mapToLoad = existingSaves.first()
}
if(mapToLoad != null){
if (mapToLoad != null) {
mapName = mapToLoad
tileMap = MapSaver.loadMap(mapName)
}
@ -39,7 +39,7 @@ class MapEditorScreen(): CameraStageBaseScreen() {
initialize()
}
constructor(map: TileMap): this() {
constructor(map: TileMap) : this() {
tileMap = map
initialize()
}
@ -73,7 +73,7 @@ class MapEditorScreen(): CameraStageBaseScreen() {
val optionsMenuButton = "Menu".toTextButton()
optionsMenuButton.onClick {
if(popups.any { it is MapEditorMenuPopup })
if (popups.any { it is MapEditorMenuPopup })
return@onClick // already open
MapEditorMenuPopup(this).open(force = true)
}
@ -84,7 +84,7 @@ class MapEditorScreen(): CameraStageBaseScreen() {
optionsMenuButton.y = 30f
stage.addActor(optionsMenuButton)
mapHolder.addCaptureListener(object: InputListener() {
mapHolder.addCaptureListener(object : InputListener() {
var isDragging = false
var isPainting = false
var touchDownTime = System.currentTimeMillis()
@ -141,6 +141,12 @@ class MapEditorScreen(): CameraStageBaseScreen() {
}
})
}
override fun resize(width: Int, height: Int) {
if (stage.viewport.screenWidth != width || stage.viewport.screenHeight != height) {
game.setScreen(MapEditorScreen(mapHolder.tileMap))
}
}
}

View File

@ -572,7 +572,6 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
override fun resize(width: Int, height: Int) {
if (stage.viewport.screenWidth != width || stage.viewport.screenHeight != height) {
super.resize(width, height)
game.worldScreen = WorldScreen(viewingCiv) // start over.
game.setWorldScreen()
}