From cc0a9994718c8c390845a90c07ae6e70f6b2936d Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sat, 9 Feb 2019 23:26:59 +0200 Subject: [PATCH] Added "exit map editor" button to map editor --- .../{MapScreenOptionsTable.kt => MapEditorOptionsTable.kt} | 6 +++++- core/src/com/unciv/ui/mapeditor/MapEditorScreen.kt | 2 +- .../ui/worldscreen/optionstable/WorldScreenOptionsTable.kt | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) rename core/src/com/unciv/ui/mapeditor/{MapScreenOptionsTable.kt => MapEditorOptionsTable.kt} (81%) diff --git a/core/src/com/unciv/ui/mapeditor/MapScreenOptionsTable.kt b/core/src/com/unciv/ui/mapeditor/MapEditorOptionsTable.kt similarity index 81% rename from core/src/com/unciv/ui/mapeditor/MapScreenOptionsTable.kt rename to core/src/com/unciv/ui/mapeditor/MapEditorOptionsTable.kt index 6d0aa822..c25dc17f 100644 --- a/core/src/com/unciv/ui/mapeditor/MapScreenOptionsTable.kt +++ b/core/src/com/unciv/ui/mapeditor/MapEditorOptionsTable.kt @@ -9,7 +9,7 @@ import com.unciv.ui.utils.CameraStageBaseScreen import com.unciv.ui.utils.onClick import com.unciv.ui.worldscreen.optionstable.PopupTable -class MapScreenOptionsTable(mapEditorScreen: MapEditorScreen): PopupTable(mapEditorScreen){ +class MapEditorOptionsTable(mapEditorScreen: MapEditorScreen): PopupTable(mapEditorScreen){ init{ val mapNameEditor = TextField(mapEditorScreen.mapName, CameraStageBaseScreen.skin) mapNameEditor.addListener{ mapEditorScreen.mapName=mapNameEditor.text; true } @@ -26,6 +26,10 @@ class MapScreenOptionsTable(mapEditorScreen: MapEditorScreen): PopupTable(mapEdi loadMapButton.onClick { MapScreenLoadTable(mapEditorScreen); remove() } add(loadMapButton).row() + val exitMapEditorButton = TextButton("Exit map editor".tr(), CameraStageBaseScreen.skin) + exitMapEditorButton.onClick { UnCivGame.Current.setWorldScreen(); mapEditorScreen.dispose() } + add(exitMapEditorButton ).row() + val closeOptionsButtton = TextButton("Close".tr(), CameraStageBaseScreen.skin) closeOptionsButtton.onClick { remove() } add(closeOptionsButtton).row() diff --git a/core/src/com/unciv/ui/mapeditor/MapEditorScreen.kt b/core/src/com/unciv/ui/mapeditor/MapEditorScreen.kt index 9d117797..49448020 100644 --- a/core/src/com/unciv/ui/mapeditor/MapEditorScreen.kt +++ b/core/src/com/unciv/ui/mapeditor/MapEditorScreen.kt @@ -77,7 +77,7 @@ class MapEditorScreen(var mapToLoad:String?=null): CameraStageBaseScreen(){ val saveMapButton = TextButton("Options".tr(),skin) saveMapButton.onClick { - MapScreenOptionsTable(this) + MapEditorOptionsTable(this) } stage.addActor(saveMapButton) } diff --git a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt index 72f5b665..30b92b96 100644 --- a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt +++ b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt @@ -3,9 +3,9 @@ package com.unciv.ui.worldscreen.optionstable import com.unciv.UnCivGame import com.unciv.models.gamebasics.tr import com.unciv.ui.CivilopediaScreen -import com.unciv.ui.mapeditor.MapEditorScreen import com.unciv.ui.NewGameScreen import com.unciv.ui.VictoryScreen +import com.unciv.ui.mapeditor.MapEditorScreen import com.unciv.ui.pickerscreens.PolicyPickerScreen import com.unciv.ui.saves.LoadScreen import com.unciv.ui.saves.SaveScreen @@ -14,7 +14,7 @@ import com.unciv.ui.worldscreen.WorldScreen class WorldScreenOptionsTable(val worldScreen: WorldScreen) : PopupTable(worldScreen) { init { - addButton("Map editor - IN PROGRESS".tr()){ + addButton("Map editor".tr()){ UnCivGame.Current.screen = MapEditorScreen() remove() }