Getting to map editor from the main screen is much nicer

This commit is contained in:
Yair Morgenstern 2020-04-21 14:53:34 +03:00
parent 5aae57d848
commit 081f8cb4a6
3 changed files with 15 additions and 13 deletions

View File

@ -69,28 +69,29 @@ class MenuScreen: CameraStageBaseScreen() {
private fun openMapEditorPopup() {
val mapEditorPopup = Popup(this)
mapEditorPopup.defaults().pad(10f)
mapEditorPopup.addGoodSizedLabel("Map editor".tr()).row()
val tableBackground = ImageGetter.getBackground(colorFromRGB(29, 102, 107))
// Create a new map
mapEditorPopup.addButton("New map") {
game.setScreen(NewMapScreen())
mapEditorPopup.close()
}
val newMapButton = getTableBlock("New map", "OtherIcons/New") { game.setScreen(NewMapScreen()) }
newMapButton.background = tableBackground
mapEditorPopup.add(newMapButton).row()
// Load the map
mapEditorPopup.addButton("Load map") {
val loadMapButton = getTableBlock("Load map", "OtherIcons/Load") {
val loadMapScreen = LoadMapScreen(null)
loadMapScreen.closeButton.isVisible = true
loadMapScreen.closeButton.onClick {
game.setWorldScreen()
game.setScreen(MenuScreen())
loadMapScreen.dispose()
}
game.setScreen(loadMapScreen)
mapEditorPopup.close()
}
loadMapButton.background = tableBackground
mapEditorPopup.add(loadMapButton).row()
mapEditorPopup.add(getTableBlock("Close", "OtherIcons/Close") { mapEditorPopup.close() }
.apply { background=tableBackground })
mapEditorPopup.addCloseButton()
mapEditorPopup.open(force = true)
}

View File

@ -3,6 +3,7 @@ package com.unciv.ui.mapeditor
import com.unciv.ui.utils.AutoScrollPane as ScrollPane
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.unciv.MenuScreen
import com.unciv.UncivGame
import com.unciv.logic.map.MapGenerator
import com.unciv.logic.map.MapParameters
@ -21,7 +22,7 @@ class NewMapScreen : PickerScreen() {
private var generatedMap: TileMap? = null
init {
setDefaultCloseAction()
setDefaultCloseAction(MenuScreen())
val newMapScreenOptionsTable = Table(skin).apply {
pad(10f)

View File

@ -231,7 +231,7 @@ object ImageGetter {
Constants.modernEra -> techIconColor = colorFromRGB(33, 150, 243)
Constants.informationEra -> techIconColor = colorFromRGB(0, 150, 136)
Constants.futureEra -> techIconColor = colorFromRGB(76,176,81)
else -> Color.WHITE
else -> Color.WHITE.cpy()
}
return getImage("TechIcons/$techName").apply { color = techIconColor.lerp(Color.BLACK,0.6f) }
.surroundWithCircle(circleSize)