mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-04 15:27:50 +07:00
Resolved #2503 - Resizing the game no longer returns you to the main menu
This commit is contained in:
@ -152,7 +152,7 @@ class UncivGame(
|
|||||||
|
|
||||||
// Maybe this will solve the resume error on chrome OS, issue 322? Worth a shot
|
// Maybe this will solve the resume error on chrome OS, issue 322? Worth a shot
|
||||||
override fun resize(width: Int, height: Int) {
|
override fun resize(width: Int, height: Int) {
|
||||||
resume()
|
screen.resize(width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
|
@ -23,15 +23,15 @@ class MapEditorScreen(): CameraStageBaseScreen() {
|
|||||||
private val showHideEditorOptionsButton = ">".toTextButton()
|
private val showHideEditorOptionsButton = ">".toTextButton()
|
||||||
|
|
||||||
|
|
||||||
constructor(mapNameToLoad: String?): this() {
|
constructor(mapNameToLoad: String?) : this() {
|
||||||
var mapToLoad = mapNameToLoad
|
var mapToLoad = mapNameToLoad
|
||||||
if (mapToLoad == null) {
|
if (mapToLoad == null) {
|
||||||
val existingSaves = MapSaver.getMaps()
|
val existingSaves = MapSaver.getMaps()
|
||||||
if(existingSaves.isNotEmpty())
|
if (existingSaves.isNotEmpty())
|
||||||
mapToLoad = existingSaves.first()
|
mapToLoad = existingSaves.first()
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mapToLoad != null){
|
if (mapToLoad != null) {
|
||||||
mapName = mapToLoad
|
mapName = mapToLoad
|
||||||
tileMap = MapSaver.loadMap(mapName)
|
tileMap = MapSaver.loadMap(mapName)
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ class MapEditorScreen(): CameraStageBaseScreen() {
|
|||||||
initialize()
|
initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(map: TileMap): this() {
|
constructor(map: TileMap) : this() {
|
||||||
tileMap = map
|
tileMap = map
|
||||||
initialize()
|
initialize()
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ class MapEditorScreen(): CameraStageBaseScreen() {
|
|||||||
|
|
||||||
val optionsMenuButton = "Menu".toTextButton()
|
val optionsMenuButton = "Menu".toTextButton()
|
||||||
optionsMenuButton.onClick {
|
optionsMenuButton.onClick {
|
||||||
if(popups.any { it is MapEditorMenuPopup })
|
if (popups.any { it is MapEditorMenuPopup })
|
||||||
return@onClick // already open
|
return@onClick // already open
|
||||||
MapEditorMenuPopup(this).open(force = true)
|
MapEditorMenuPopup(this).open(force = true)
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ class MapEditorScreen(): CameraStageBaseScreen() {
|
|||||||
optionsMenuButton.y = 30f
|
optionsMenuButton.y = 30f
|
||||||
stage.addActor(optionsMenuButton)
|
stage.addActor(optionsMenuButton)
|
||||||
|
|
||||||
mapHolder.addCaptureListener(object: InputListener() {
|
mapHolder.addCaptureListener(object : InputListener() {
|
||||||
var isDragging = false
|
var isDragging = false
|
||||||
var isPainting = false
|
var isPainting = false
|
||||||
var touchDownTime = System.currentTimeMillis()
|
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))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -572,7 +572,6 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
|||||||
|
|
||||||
override fun resize(width: Int, height: Int) {
|
override fun resize(width: Int, height: Int) {
|
||||||
if (stage.viewport.screenWidth != width || stage.viewport.screenHeight != height) {
|
if (stage.viewport.screenWidth != width || stage.viewport.screenHeight != height) {
|
||||||
super.resize(width, height)
|
|
||||||
game.worldScreen = WorldScreen(viewingCiv) // start over.
|
game.worldScreen = WorldScreen(viewingCiv) // start over.
|
||||||
game.setWorldScreen()
|
game.setWorldScreen()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user