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() { private fun openMapEditorPopup() {
val mapEditorPopup = Popup(this) 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 val newMapButton = getTableBlock("New map", "OtherIcons/New") { game.setScreen(NewMapScreen()) }
mapEditorPopup.addButton("New map") { newMapButton.background = tableBackground
game.setScreen(NewMapScreen()) mapEditorPopup.add(newMapButton).row()
mapEditorPopup.close()
}
// Load the map val loadMapButton = getTableBlock("Load map", "OtherIcons/Load") {
mapEditorPopup.addButton("Load map") {
val loadMapScreen = LoadMapScreen(null) val loadMapScreen = LoadMapScreen(null)
loadMapScreen.closeButton.isVisible = true loadMapScreen.closeButton.isVisible = true
loadMapScreen.closeButton.onClick { loadMapScreen.closeButton.onClick {
game.setWorldScreen() game.setScreen(MenuScreen())
loadMapScreen.dispose() loadMapScreen.dispose()
} }
game.setScreen(loadMapScreen) 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) 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.unciv.ui.utils.AutoScrollPane as ScrollPane
import com.badlogic.gdx.Gdx import com.badlogic.gdx.Gdx
import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.unciv.MenuScreen
import com.unciv.UncivGame import com.unciv.UncivGame
import com.unciv.logic.map.MapGenerator import com.unciv.logic.map.MapGenerator
import com.unciv.logic.map.MapParameters import com.unciv.logic.map.MapParameters
@ -21,7 +22,7 @@ class NewMapScreen : PickerScreen() {
private var generatedMap: TileMap? = null private var generatedMap: TileMap? = null
init { init {
setDefaultCloseAction() setDefaultCloseAction(MenuScreen())
val newMapScreenOptionsTable = Table(skin).apply { val newMapScreenOptionsTable = Table(skin).apply {
pad(10f) pad(10f)

View File

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