From 081f8cb4a62959efe9dd4b6c5e6eae72c417cda4 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 21 Apr 2020 14:53:34 +0300 Subject: [PATCH] Getting to map editor from the main screen is much nicer --- core/src/com/unciv/MenuScreen.kt | 23 ++++++++++--------- .../com/unciv/ui/mapeditor/NewMapScreen.kt | 3 ++- core/src/com/unciv/ui/utils/ImageGetter.kt | 2 +- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/core/src/com/unciv/MenuScreen.kt b/core/src/com/unciv/MenuScreen.kt index 03ad09cd72..0248816aef 100644 --- a/core/src/com/unciv/MenuScreen.kt +++ b/core/src/com/unciv/MenuScreen.kt @@ -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) } diff --git a/core/src/com/unciv/ui/mapeditor/NewMapScreen.kt b/core/src/com/unciv/ui/mapeditor/NewMapScreen.kt index 292f3494d1..73856e535c 100644 --- a/core/src/com/unciv/ui/mapeditor/NewMapScreen.kt +++ b/core/src/com/unciv/ui/mapeditor/NewMapScreen.kt @@ -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) diff --git a/core/src/com/unciv/ui/utils/ImageGetter.kt b/core/src/com/unciv/ui/utils/ImageGetter.kt index d1696afcf5..f26342e3fa 100644 --- a/core/src/com/unciv/ui/utils/ImageGetter.kt +++ b/core/src/com/unciv/ui/utils/ImageGetter.kt @@ -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)