From f6b738a04a20b50a123bf63a7c81e1a87a8062b0 Mon Sep 17 00:00:00 2001 From: alkorolyov <49795502+alkorolyov@users.noreply.github.com> Date: Sat, 20 Jun 2020 10:29:13 +0200 Subject: [PATCH] Now clearCurrentMapButton and TerrainsAndResources clears rivers. --- .../unciv/ui/mapeditor/MapEditorMenuPopup.kt | 4 + .../ui/mapeditor/TileEditorOptionsTable.kt | 82 ++++++++++--------- 2 files changed, 47 insertions(+), 39 deletions(-) diff --git a/core/src/com/unciv/ui/mapeditor/MapEditorMenuPopup.kt b/core/src/com/unciv/ui/mapeditor/MapEditorMenuPopup.kt index 85bbe62320..f6d2192aa7 100644 --- a/core/src/com/unciv/ui/mapeditor/MapEditorMenuPopup.kt +++ b/core/src/com/unciv/ui/mapeditor/MapEditorMenuPopup.kt @@ -60,10 +60,14 @@ class MapEditorMenuPopup(var mapEditorScreen: MapEditorScreen): Popup(mapEditorS tile.baseTerrain = Constants.ocean tile.terrainFeature = null tile.naturalWonder = null + tile.hasBottomRiver=false + tile.hasBottomLeftRiver=false + tile.hasBottomRightRiver=false tile.resource = null tile.improvement = null tile.improvementInProgress = null tile.roadStatus = RoadStatus.None + tile.setTransients() tileGroup.update() diff --git a/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt b/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt index b3505e1915..bdf9183c2e 100644 --- a/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt +++ b/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt @@ -77,6 +77,49 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera add(editorPickTable).row() } + private fun setTerrainsAndResources(){ + + val baseTerrainTable = Table().apply { defaults().pad(20f) } + val terrainFeaturesTable = Table().apply { defaults().pad(20f) } + + terrainFeaturesTable.add(getHex(Color.WHITE, getRedCross(50f, 0.6f)).apply { + onClick { + tileAction = { + it.terrainFeature=null + it.naturalWonder = null + it.hasBottomRiver=false + it.hasBottomLeftRiver=false + it.hasBottomRightRiver=false + } + setCurrentHex(getHex(Color.WHITE, getRedCross(40f, 0.6f)), "Clear terrain features") + } + }).row() + + + addTerrainOptions(terrainFeaturesTable, baseTerrainTable) + addRiverToggleOptions(baseTerrainTable) + + + val resources = getResourceActors() + + background = ImageGetter.getBackground(Color.GRAY.cpy().apply { a = 0.7f }) + + val terrainsAndResourcesTable = Table() + terrainsAndResourcesTable.add(AutoScrollPane(baseTerrainTable).apply { setScrollingDisabled(true,false) }).height(scrollPanelHeight) + + terrainsAndResourcesTable.add(AutoScrollPane(terrainFeaturesTable).apply { setScrollingDisabled(true,false) }).height(scrollPanelHeight) + + val resourcesTable = Table() + for(resource in resources) resourcesTable.add(resource).row() + resourcesTable.pack() + terrainsAndResourcesTable.add(AutoScrollPane(resourcesTable).apply { setScrollingDisabled(true,false) }).height(scrollPanelHeight).row() + + terrainsAndResourcesTable.pack() + + editorPickTable.clear() + editorPickTable.add(terrainsAndResourcesTable) + } + private fun setImprovements() { editorPickTable.clear() @@ -189,7 +232,6 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera return nations } - private fun getRedCross(size: Float, alpha: Float): Actor { val redCross = ImageGetter.getImage("OtherIcons/Close") redCross.setSize( size, size) @@ -197,43 +239,6 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera return redCross } - private fun setTerrainsAndResources(){ - - val baseTerrainTable = Table().apply { defaults().pad(20f) } - val terrainFeaturesTable = Table().apply { defaults().pad(20f) } - - terrainFeaturesTable.add(getHex(Color.WHITE, getRedCross(50f, 0.6f)).apply { - onClick { - tileAction = { it.terrainFeature=null; it.naturalWonder = null } - setCurrentHex(getHex(Color.WHITE, getRedCross(40f, 0.6f)), "Clear terrain features") - } - }).row() - - - addTerrainOptions(terrainFeaturesTable, baseTerrainTable) - addRiverToggleOptions(baseTerrainTable) - - - val resources = getResourceActors() - - background = ImageGetter.getBackground(Color.GRAY.cpy().apply { a = 0.7f }) - - val terrainsAndResourcesTable = Table() - terrainsAndResourcesTable.add(AutoScrollPane(baseTerrainTable).apply { setScrollingDisabled(true,false) }).height(scrollPanelHeight) - - terrainsAndResourcesTable.add(AutoScrollPane(terrainFeaturesTable).apply { setScrollingDisabled(true,false) }).height(scrollPanelHeight) - - val resourcesTable = Table() - for(resource in resources) resourcesTable.add(resource).row() - resourcesTable.pack() - terrainsAndResourcesTable.add(AutoScrollPane(resourcesTable).apply { setScrollingDisabled(true,false) }).height(scrollPanelHeight).row() - - terrainsAndResourcesTable.pack() - - editorPickTable.clear() - editorPickTable.add(terrainsAndResourcesTable) - } - private fun getCrossedResource() : Actor { val redCross = getRedCross(45f, 0.5f) val group = IconCircleGroup(40f, redCross, false) @@ -241,7 +246,6 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera return group } - private fun getResourceActors(): ArrayList { val resources = ArrayList() resources.add(getHex(Color.WHITE, getCrossedResource()).apply {