mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-19 20:28:56 +07:00
Map editor leaves to main menu
This commit is contained in:
@ -68,11 +68,11 @@ class MultiplayerScreen(previousScreen: CameraStageBaseScreen) : PickerScreen()
|
|||||||
topTable.add(mainTable).row()
|
topTable.add(mainTable).row()
|
||||||
scrollPane.setScrollingDisabled(false, true)
|
scrollPane.setScrollingDisabled(false, true)
|
||||||
|
|
||||||
//leftTable Setup
|
// leftTable Setup
|
||||||
reloadGameListUI()
|
reloadGameListUI()
|
||||||
|
|
||||||
//A Button to add the currently running game to multiplayerGameList if not yet done
|
// A Button to add the currently running game to multiplayerGameList if not yet done
|
||||||
addCurrentGameButton()
|
// addCurrentGameButton()
|
||||||
|
|
||||||
//rightTable Setup
|
//rightTable Setup
|
||||||
copyUserIdButton.onClick {
|
copyUserIdButton.onClick {
|
||||||
|
@ -5,6 +5,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
|||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextField
|
import com.badlogic.gdx.scenes.scene2d.ui.TextField
|
||||||
import com.badlogic.gdx.utils.Json
|
import com.badlogic.gdx.utils.Json
|
||||||
import com.unciv.Constants
|
import com.unciv.Constants
|
||||||
|
import com.unciv.MenuScreen
|
||||||
import com.unciv.UncivGame
|
import com.unciv.UncivGame
|
||||||
import com.unciv.logic.MapSaver
|
import com.unciv.logic.MapSaver
|
||||||
import com.unciv.logic.map.MapType
|
import com.unciv.logic.map.MapType
|
||||||
@ -114,8 +115,8 @@ class MapEditorMenuPopup(mapEditorScreen: MapEditorScreen): Popup(mapEditorScree
|
|||||||
|
|
||||||
|
|
||||||
val exitMapEditorButton = "Exit map editor".toTextButton()
|
val exitMapEditorButton = "Exit map editor".toTextButton()
|
||||||
exitMapEditorButton.onClick { UncivGame.Current.setWorldScreen(); mapEditorScreen.dispose() }
|
|
||||||
add(exitMapEditorButton ).row()
|
add(exitMapEditorButton ).row()
|
||||||
|
exitMapEditorButton.onClick { mapEditorScreen.game.setScreen(MenuScreen()); mapEditorScreen.dispose() }
|
||||||
|
|
||||||
val closeOptionsButton = Constants.close.toTextButton()
|
val closeOptionsButton = Constants.close.toTextButton()
|
||||||
closeOptionsButton.onClick { close() }
|
closeOptionsButton.onClick { close() }
|
||||||
|
@ -5,12 +5,10 @@ import com.badlogic.gdx.math.Vector2
|
|||||||
import com.badlogic.gdx.scenes.scene2d.InputEvent
|
import com.badlogic.gdx.scenes.scene2d.InputEvent
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputListener
|
import com.badlogic.gdx.scenes.scene2d.InputListener
|
||||||
import com.badlogic.gdx.scenes.scene2d.actions.Actions
|
import com.badlogic.gdx.scenes.scene2d.actions.Actions
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
|
||||||
import com.unciv.logic.MapSaver
|
import com.unciv.logic.MapSaver
|
||||||
import com.unciv.logic.map.TileInfo
|
import com.unciv.logic.map.TileInfo
|
||||||
import com.unciv.logic.map.TileMap
|
import com.unciv.logic.map.TileMap
|
||||||
import com.unciv.models.ruleset.RulesetCache
|
import com.unciv.models.ruleset.RulesetCache
|
||||||
import com.unciv.models.translations.tr
|
|
||||||
import com.unciv.ui.utils.*
|
import com.unciv.ui.utils.*
|
||||||
|
|
||||||
class MapEditorScreen(): CameraStageBaseScreen() {
|
class MapEditorScreen(): CameraStageBaseScreen() {
|
||||||
@ -146,3 +144,4 @@ class MapEditorScreen(): CameraStageBaseScreen() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.unciv.ui.mapeditor
|
package com.unciv.ui.mapeditor
|
||||||
|
|
||||||
import com.unciv.ui.utils.AutoScrollPane as ScrollPane
|
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.scenes.scene2d.Actor
|
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||||
import com.badlogic.gdx.scenes.scene2d.Group
|
import com.badlogic.gdx.scenes.scene2d.Group
|
||||||
@ -19,7 +18,6 @@ import com.unciv.ui.tilegroups.TileGroup
|
|||||||
import com.unciv.ui.tilegroups.TileSetStrings
|
import com.unciv.ui.tilegroups.TileSetStrings
|
||||||
import com.unciv.ui.utils.*
|
import com.unciv.ui.utils.*
|
||||||
|
|
||||||
|
|
||||||
class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(CameraStageBaseScreen.skin){
|
class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(CameraStageBaseScreen.skin){
|
||||||
private val tileSetLocation = "TileSets/"+ UncivGame.Current.settings.tileSet +"/"
|
private val tileSetLocation = "TileSets/"+ UncivGame.Current.settings.tileSet +"/"
|
||||||
|
|
||||||
@ -30,7 +28,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
|
|||||||
var selectedResource: TileResource?=null
|
var selectedResource: TileResource?=null
|
||||||
|
|
||||||
var clearImprovement=false
|
var clearImprovement=false
|
||||||
var selectedImprovement:TileImprovement?=null
|
var selectedImprovement: TileImprovement?=null
|
||||||
|
|
||||||
var toggleBottomRightRiver=false
|
var toggleBottomRightRiver=false
|
||||||
var toggleBottomRiver=false
|
var toggleBottomRiver=false
|
||||||
@ -63,7 +61,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
|
|||||||
|
|
||||||
val sliderTab = Table()
|
val sliderTab = Table()
|
||||||
|
|
||||||
val slider = Slider(1f,5f,1f, false, skin)
|
val slider = Slider(1f, 5f, 1f, false, skin)
|
||||||
val sliderLabel = "{Brush Size} $brushSize".toLabel()
|
val sliderLabel = "{Brush Size} $brushSize".toLabel()
|
||||||
|
|
||||||
slider.onChange {
|
slider.onChange {
|
||||||
@ -76,7 +74,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
|
|||||||
sliderTab.add(slider)
|
sliderTab.add(slider)
|
||||||
|
|
||||||
add(sliderTab).row()
|
add(sliderTab).row()
|
||||||
add(ScrollPane(tabPickerTable).apply { this.width= mapEditorScreen.stage.width/3}).row()
|
add(AutoScrollPane(tabPickerTable).apply { this.width= mapEditorScreen.stage.width/3}).row()
|
||||||
|
|
||||||
add(editorPickTable).row()
|
add(editorPickTable).row()
|
||||||
}
|
}
|
||||||
@ -96,30 +94,30 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
|
|||||||
|
|
||||||
for(improvement in ruleset.tileImprovements.values){
|
for(improvement in ruleset.tileImprovements.values){
|
||||||
if(improvement.name.startsWith("Remove")) continue
|
if(improvement.name.startsWith("Remove")) continue
|
||||||
val improvementImage = getHex(Color.WHITE,ImageGetter.getImprovementIcon(improvement.name,40f))
|
val improvementImage = getHex(Color.WHITE, ImageGetter.getImprovementIcon(improvement.name, 40f))
|
||||||
improvementImage.onClick {
|
improvementImage.onClick {
|
||||||
clearSelection()
|
clearSelection()
|
||||||
selectedImprovement=improvement
|
selectedImprovement=improvement
|
||||||
val improvementIcon = getHex(Color.WHITE,ImageGetter.getImprovementIcon(improvement.name,40f))
|
val improvementIcon = getHex(Color.WHITE, ImageGetter.getImprovementIcon(improvement.name, 40f))
|
||||||
setCurrentHex(improvementIcon, improvement.name.tr()+"\n"+improvement.clone().toString())
|
setCurrentHex(improvementIcon, improvement.name.tr()+"\n"+improvement.clone().toString())
|
||||||
}
|
}
|
||||||
improvementsTable.add(improvementImage).row()
|
improvementsTable.add(improvementImage).row()
|
||||||
}
|
}
|
||||||
editorPickTable.add(ScrollPane(improvementsTable)).height(scrollPanelHeight)
|
editorPickTable.add(AutoScrollPane(improvementsTable)).height(scrollPanelHeight)
|
||||||
|
|
||||||
val nationsTable = Table()
|
val nationsTable = Table()
|
||||||
for(nation in ruleset.nations.values){
|
for(nation in ruleset.nations.values){
|
||||||
val nationImage = getHex(Color.WHITE,ImageGetter.getNationIndicator(nation,40f))
|
val nationImage = getHex(Color.WHITE, ImageGetter.getNationIndicator(nation, 40f))
|
||||||
nationImage.onClick {
|
nationImage.onClick {
|
||||||
clearSelection()
|
clearSelection()
|
||||||
selectedImprovement=TileImprovement().apply { name="StartingLocation "+nation.name }
|
selectedImprovement= TileImprovement().apply { name="StartingLocation "+nation.name }
|
||||||
val nationIcon = getHex(Color.WHITE,ImageGetter.getNationIndicator(nation,40f))
|
val nationIcon = getHex(Color.WHITE, ImageGetter.getNationIndicator(nation, 40f))
|
||||||
setCurrentHex(nationIcon, "[${nation.name}] starting location")
|
setCurrentHex(nationIcon, "[${nation.name}] starting location")
|
||||||
}
|
}
|
||||||
nationsTable.add(nationImage).row()
|
nationsTable.add(nationImage).row()
|
||||||
}
|
}
|
||||||
|
|
||||||
editorPickTable.add(ScrollPane(nationsTable)).height(scrollPanelHeight)
|
editorPickTable.add(AutoScrollPane(nationsTable)).height(scrollPanelHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getRedCross(size: Float, alpha: Float): Actor {
|
private fun getRedCross(size: Float, alpha: Float): Actor {
|
||||||
@ -152,14 +150,14 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
|
|||||||
background = ImageGetter.getBackground(Color.GRAY.cpy().apply { a = 0.7f })
|
background = ImageGetter.getBackground(Color.GRAY.cpy().apply { a = 0.7f })
|
||||||
|
|
||||||
val terrainsAndResourcesTable = Table()
|
val terrainsAndResourcesTable = Table()
|
||||||
terrainsAndResourcesTable.add(ScrollPane(baseTerrainTable).apply { setScrollingDisabled(true,false) }).height(scrollPanelHeight)
|
terrainsAndResourcesTable.add(AutoScrollPane(baseTerrainTable).apply { setScrollingDisabled(true,false) }).height(scrollPanelHeight)
|
||||||
|
|
||||||
terrainsAndResourcesTable.add(ScrollPane(terrainFeaturesTable).apply { setScrollingDisabled(true,false) }).height(scrollPanelHeight)
|
terrainsAndResourcesTable.add(AutoScrollPane(terrainFeaturesTable).apply { setScrollingDisabled(true,false) }).height(scrollPanelHeight)
|
||||||
|
|
||||||
val resourcesTable = Table()
|
val resourcesTable = Table()
|
||||||
for(resource in resources) resourcesTable.add(resource).row()
|
for(resource in resources) resourcesTable.add(resource).row()
|
||||||
resourcesTable.pack()
|
resourcesTable.pack()
|
||||||
terrainsAndResourcesTable.add(ScrollPane(resourcesTable).apply { setScrollingDisabled(true,false) }).height(scrollPanelHeight).row()
|
terrainsAndResourcesTable.add(AutoScrollPane(resourcesTable).apply { setScrollingDisabled(true,false) }).height(scrollPanelHeight).row()
|
||||||
|
|
||||||
terrainsAndResourcesTable.pack()
|
terrainsAndResourcesTable.pack()
|
||||||
|
|
||||||
@ -403,12 +401,12 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(tileInfo.getBaseTerrain().impassable || tileInfo.isWater)
|
if(tileInfo.getBaseTerrain().impassable || tileInfo.isWater)
|
||||||
tileInfo.roadStatus=RoadStatus.None
|
tileInfo.roadStatus= RoadStatus.None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun setCurrentHex(tileInfo: TileInfo, text:String){
|
private fun setCurrentHex(tileInfo: TileInfo, text:String){
|
||||||
val tileGroup = TileGroup(tileInfo,TileSetStrings())
|
val tileGroup = TileGroup(tileInfo, TileSetStrings())
|
||||||
.apply {
|
.apply {
|
||||||
showEntireMap=true
|
showEntireMap=true
|
||||||
forMapEditorIcon=true
|
forMapEditorIcon=true
|
||||||
@ -418,7 +416,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
|
|||||||
setCurrentHex(tileGroup,text)
|
setCurrentHex(tileGroup,text)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setCurrentHex(actor:Actor, text:String){
|
private fun setCurrentHex(actor: Actor, text:String){
|
||||||
currentHex.remove()
|
currentHex.remove()
|
||||||
val currentHexTable = Table()
|
val currentHexTable = Table()
|
||||||
currentHexTable.add(text.toLabel()).padRight(30f)
|
currentHexTable.add(text.toLabel()).padRight(30f)
|
||||||
|
Reference in New Issue
Block a user