mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 13:55:54 -04:00
Continue work on Scenario functionality (#2726)
* Hide all scenarios functionality behind switch in Unciv class. * Refactoring: 1) abstract class changed to interface 2) rulset added to GameSetupInfo class Fixed screen bug during map editing * Added Load/Edit/Delete buttons for scenario functionality. * Hide recently added scenario buttons behind debugSwitch.
This commit is contained in:
parent
46dd66d343
commit
9547b82054
@ -15,10 +15,7 @@ import com.unciv.logic.map.MapSize
|
|||||||
import com.unciv.logic.map.MapType
|
import com.unciv.logic.map.MapType
|
||||||
import com.unciv.models.ruleset.RulesetCache
|
import com.unciv.models.ruleset.RulesetCache
|
||||||
import com.unciv.ui.MultiplayerScreen
|
import com.unciv.ui.MultiplayerScreen
|
||||||
import com.unciv.ui.mapeditor.EditorMapHolder
|
import com.unciv.ui.mapeditor.*
|
||||||
import com.unciv.ui.mapeditor.LoadMapScreen
|
|
||||||
import com.unciv.ui.mapeditor.MapEditorScreen
|
|
||||||
import com.unciv.ui.mapeditor.NewMapScreen
|
|
||||||
import com.unciv.ui.newgamescreen.GameSetupInfo
|
import com.unciv.ui.newgamescreen.GameSetupInfo
|
||||||
import com.unciv.ui.newgamescreen.NewGameScreen
|
import com.unciv.ui.newgamescreen.NewGameScreen
|
||||||
import com.unciv.ui.saves.LoadGameScreen
|
import com.unciv.ui.saves.LoadGameScreen
|
||||||
@ -130,9 +127,25 @@ class MainMenuScreen: CameraStageBaseScreen() {
|
|||||||
}
|
}
|
||||||
game.setScreen(loadMapScreen)
|
game.setScreen(loadMapScreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
loadMapButton.background = tableBackground
|
loadMapButton.background = tableBackground
|
||||||
mapEditorPopup.add(loadMapButton).row()
|
mapEditorPopup.add(loadMapButton).row()
|
||||||
|
|
||||||
|
if (UncivGame.Current.scenarioDebugSwitch) {
|
||||||
|
val loadScenarioButton = getTableBlock("Load scenario", "OtherIcons/Load") {
|
||||||
|
val loadScenarioScreen = LoadScenarioScreen(null)
|
||||||
|
loadScenarioScreen.closeButton.isVisible = true
|
||||||
|
loadScenarioScreen.closeButton.onClick {
|
||||||
|
game.setScreen(MainMenuScreen())
|
||||||
|
loadScenarioScreen.dispose()
|
||||||
|
}
|
||||||
|
game.setScreen(loadScenarioScreen)
|
||||||
|
}
|
||||||
|
|
||||||
|
loadScenarioButton.background = tableBackground
|
||||||
|
mapEditorPopup.add(loadScenarioButton).row()
|
||||||
|
}
|
||||||
|
|
||||||
mapEditorPopup.add(getTableBlock("Close", "OtherIcons/Close") { mapEditorPopup.close() }
|
mapEditorPopup.add(getTableBlock("Close", "OtherIcons/Close") { mapEditorPopup.close() }
|
||||||
.apply { background=tableBackground })
|
.apply { background=tableBackground })
|
||||||
|
|
||||||
|
@ -36,10 +36,11 @@ object MapSaver {
|
|||||||
|
|
||||||
fun deleteMap(mapName: String) = getMap(mapName).delete()
|
fun deleteMap(mapName: String) = getMap(mapName).delete()
|
||||||
|
|
||||||
|
fun deleteScenario(scenarioName: String) = getScenario(scenarioName).delete()
|
||||||
|
|
||||||
fun getMaps() = Gdx.files.local(mapsFolder).list().map { it.name() }
|
fun getMaps() = Gdx.files.local(mapsFolder).list().map { it.name() }
|
||||||
|
|
||||||
fun getScenarios() = Gdx.files.local(scenariosFolder).list().map { it.name() }
|
fun getScenarios() = Gdx.files.local(scenariosFolder).list().map { it.name() }
|
||||||
|
|
||||||
fun mapFromJson(json:String): TileMap = json().fromJson(TileMap::class.java, json)
|
fun mapFromJson(json:String): TileMap = json().fromJson(TileMap::class.java, json)
|
||||||
|
|
||||||
}
|
}
|
@ -31,7 +31,7 @@ class EditorMapHolder(internal val mapEditorScreen: MapEditorScreen, internal va
|
|||||||
// This is a hack to make the unit icons render correctly on the game, even though the map isn't part of a game
|
// This is a hack to make the unit icons render correctly on the game, even though the map isn't part of a game
|
||||||
// and the units aren't assigned to any "real" CivInfo
|
// and the units aren't assigned to any "real" CivInfo
|
||||||
tileGroup.tileInfo.getUnits().forEach { it.civInfo= CivilizationInfo()
|
tileGroup.tileInfo.getUnits().forEach { it.civInfo= CivilizationInfo()
|
||||||
.apply { nation=mapEditorScreen.ruleset.nations[it.owner]!! } }
|
.apply { nation=mapEditorScreen.gameSetupInfo.ruleset.nations[it.owner]!! } }
|
||||||
|
|
||||||
tileGroup.showEntireMap = true
|
tileGroup.showEntireMap = true
|
||||||
tileGroup.update()
|
tileGroup.update()
|
||||||
|
83
core/src/com/unciv/ui/mapeditor/LoadScenarioScreen.kt
Normal file
83
core/src/com/unciv/ui/mapeditor/LoadScenarioScreen.kt
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
package com.unciv.ui.mapeditor
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx
|
||||||
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||||
|
import com.unciv.UncivGame
|
||||||
|
import com.unciv.logic.MapSaver
|
||||||
|
import com.unciv.logic.map.Scenario
|
||||||
|
import com.unciv.logic.map.TileMap
|
||||||
|
import com.unciv.models.translations.tr
|
||||||
|
import com.unciv.ui.pickerscreens.PickerScreen
|
||||||
|
import com.unciv.ui.saves.Gzip
|
||||||
|
import com.unciv.ui.utils.*
|
||||||
|
|
||||||
|
class LoadScenarioScreen(previousMap: TileMap?): PickerScreen(){
|
||||||
|
var chosenScenario = ""
|
||||||
|
val deleteScenarioButton = "Delete scenario".toTextButton()
|
||||||
|
|
||||||
|
init {
|
||||||
|
rightSideButton.setText("Load scenario".tr())
|
||||||
|
rightSideButton.onClick {
|
||||||
|
UncivGame.Current.setScreen(MapEditorScreen(MapSaver.loadScenario(chosenScenario)).apply { scenarioName = chosenScenario })
|
||||||
|
dispose()
|
||||||
|
}
|
||||||
|
|
||||||
|
val scenariosTable = Table().apply { defaults().pad(10f) }
|
||||||
|
for (scenario in MapSaver.getScenarios()) {
|
||||||
|
val loadScenarioButton = TextButton(scenario, skin)
|
||||||
|
loadScenarioButton.onClick {
|
||||||
|
rightSideButton.enable()
|
||||||
|
chosenScenario = scenario
|
||||||
|
deleteScenarioButton.enable()
|
||||||
|
deleteScenarioButton.color = Color.RED
|
||||||
|
}
|
||||||
|
scenariosTable.add(loadScenarioButton).row()
|
||||||
|
}
|
||||||
|
topTable.add(AutoScrollPane(scenariosTable)).height(stage.height * 2 / 3)
|
||||||
|
.maxWidth(stage.width/2)
|
||||||
|
|
||||||
|
val rightSideTable = Table().apply { defaults().pad(10f) }
|
||||||
|
|
||||||
|
// val downloadMapButton = "Download map".toTextButton()
|
||||||
|
// downloadMapButton.onClick {
|
||||||
|
// MapDownloadPopup(this).open()
|
||||||
|
// }
|
||||||
|
// rightSideTable.add(downloadMapButton).row()
|
||||||
|
//
|
||||||
|
// rightSideTable.addSeparator()
|
||||||
|
|
||||||
|
|
||||||
|
// val loadFromClipboardButton = "Load copied data".toTextButton()
|
||||||
|
// val couldNotLoadMapLabel = "Could not load map!".toLabel(Color.RED).apply { isVisible=false }
|
||||||
|
// loadFromClipboardButton.onClick {
|
||||||
|
// try {
|
||||||
|
// val clipboardContentsString = Gdx.app.clipboard.contents.trim()
|
||||||
|
// val decoded = Gzip.unzip(clipboardContentsString)
|
||||||
|
// val loadedMap = MapSaver.mapFromJson(decoded)
|
||||||
|
// UncivGame.Current.setScreen(MapEditorScreen(loadedMap))
|
||||||
|
// }
|
||||||
|
// catch (ex:Exception){
|
||||||
|
// couldNotLoadMapLabel.isVisible=true
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// rightSideTable.add(loadFromClipboardButton).row()
|
||||||
|
// rightSideTable.add(couldNotLoadMapLabel).row()
|
||||||
|
|
||||||
|
deleteScenarioButton.onClick {
|
||||||
|
YesNoPopup("Are you sure you want to delete this scenario?", {
|
||||||
|
MapSaver.deleteScenario(chosenScenario)
|
||||||
|
UncivGame.Current.setScreen(LoadScenarioScreen(previousMap))
|
||||||
|
}, this).open()
|
||||||
|
}
|
||||||
|
deleteScenarioButton.disable()
|
||||||
|
deleteScenarioButton.color = Color.RED
|
||||||
|
rightSideTable.add(deleteScenarioButton).row()
|
||||||
|
|
||||||
|
topTable.add(rightSideTable)
|
||||||
|
if(previousMap==null) closeButton.isVisible=false
|
||||||
|
else closeButton.onClick { UncivGame.Current.setScreen(MapEditorScreen(previousMap)) }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -19,44 +19,65 @@ import com.unciv.ui.utils.*
|
|||||||
import com.unciv.ui.worldscreen.mainmenu.DropBox
|
import com.unciv.ui.worldscreen.mainmenu.DropBox
|
||||||
import kotlin.concurrent.thread
|
import kotlin.concurrent.thread
|
||||||
|
|
||||||
class MapEditorMenuPopup(mapEditorScreen: MapEditorScreen): Popup(mapEditorScreen){
|
class MapEditorMenuPopup(var mapEditorScreen: MapEditorScreen): Popup(mapEditorScreen){
|
||||||
|
private val mapNameEditor: TextField = TextField(mapEditorScreen.mapName, skin)
|
||||||
|
|
||||||
init{
|
init{
|
||||||
val mapNameEditor = TextField(mapEditorScreen.mapName, skin)
|
|
||||||
add(mapNameEditor).fillX().row()
|
add(mapNameEditor).fillX().row()
|
||||||
mapNameEditor.selectAll()
|
mapNameEditor.selectAll()
|
||||||
mapNameEditor.maxLength = 240 // A few under max for most filesystems
|
mapNameEditor.maxLength = 240 // A few under max for most filesystems
|
||||||
mapEditorScreen.stage.keyboardFocus = mapNameEditor
|
mapEditorScreen.stage.keyboardFocus = mapNameEditor
|
||||||
|
|
||||||
|
addNewMapButton()
|
||||||
|
addClearCurrentMapButton()
|
||||||
|
addSaveMapButton()
|
||||||
|
addCopyMapAsTextButton()
|
||||||
|
addLoadMapButton()
|
||||||
|
addUploadMapButton()
|
||||||
|
|
||||||
|
if (UncivGame.Current.scenarioDebugSwitch) {
|
||||||
|
addScenarioButton()
|
||||||
|
addLoadScenarioButton()
|
||||||
|
}
|
||||||
|
|
||||||
|
addExitMapEditorButton()
|
||||||
|
addCloseOptionsButton()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Popup.addNewMapButton() {
|
||||||
val newMapButton = "New map".toTextButton()
|
val newMapButton = "New map".toTextButton()
|
||||||
newMapButton.onClick {
|
newMapButton.onClick {
|
||||||
UncivGame.Current.setScreen(NewMapScreen())
|
UncivGame.Current.setScreen(NewMapScreen())
|
||||||
}
|
}
|
||||||
add(newMapButton).row()
|
add(newMapButton).row()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Popup.addClearCurrentMapButton() {
|
||||||
val clearCurrentMapButton = "Clear current map".toTextButton()
|
val clearCurrentMapButton = "Clear current map".toTextButton()
|
||||||
clearCurrentMapButton.onClick {
|
clearCurrentMapButton.onClick {
|
||||||
for(tileGroup in mapEditorScreen.mapHolder.tileGroups.values)
|
for (tileGroup in mapEditorScreen.mapHolder.tileGroups.values) {
|
||||||
{
|
|
||||||
val tile = tileGroup.tileInfo
|
val tile = tileGroup.tileInfo
|
||||||
tile.baseTerrain=Constants.ocean
|
tile.baseTerrain = Constants.ocean
|
||||||
tile.terrainFeature=null
|
tile.terrainFeature = null
|
||||||
tile.naturalWonder=null
|
tile.naturalWonder = null
|
||||||
tile.resource=null
|
tile.resource = null
|
||||||
tile.improvement=null
|
tile.improvement = null
|
||||||
tile.improvementInProgress=null
|
tile.improvementInProgress = null
|
||||||
tile.roadStatus=RoadStatus.None
|
tile.roadStatus = RoadStatus.None
|
||||||
tile.setTransients()
|
tile.setTransients()
|
||||||
|
|
||||||
tileGroup.update()
|
tileGroup.update()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
add(clearCurrentMapButton).row()
|
add(clearCurrentMapButton).row()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Popup.addSaveMapButton() {
|
||||||
val saveMapButton = "Save map".toTextButton()
|
val saveMapButton = "Save map".toTextButton()
|
||||||
saveMapButton.onClick {
|
saveMapButton.onClick {
|
||||||
mapEditorScreen.tileMap.mapParameters.name=mapEditorScreen.mapName
|
mapEditorScreen.tileMap.mapParameters.name = mapEditorScreen.mapName
|
||||||
mapEditorScreen.tileMap.mapParameters.type=MapType.custom
|
mapEditorScreen.tileMap.mapParameters.type = MapType.custom
|
||||||
thread ( name = "SaveMap" ) {
|
thread(name = "SaveMap") {
|
||||||
try {
|
try {
|
||||||
MapSaver.saveMap(mapEditorScreen.mapName, mapEditorScreen.tileMap)
|
MapSaver.saveMap(mapEditorScreen.mapName, mapEditorScreen.tileMap)
|
||||||
close()
|
close()
|
||||||
@ -81,24 +102,30 @@ class MapEditorMenuPopup(mapEditorScreen: MapEditorScreen): Popup(mapEditorScree
|
|||||||
saveMapButton.isEnabled = mapNameEditor.text.isNotEmpty()
|
saveMapButton.isEnabled = mapNameEditor.text.isNotEmpty()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Popup.addCopyMapAsTextButton() {
|
||||||
val copyMapAsTextButton = "Copy to clipboard".toTextButton()
|
val copyMapAsTextButton = "Copy to clipboard".toTextButton()
|
||||||
copyMapAsTextButton.onClick {
|
copyMapAsTextButton.onClick {
|
||||||
val json = Json().toJson(mapEditorScreen.tileMap)
|
val json = Json().toJson(mapEditorScreen.tileMap)
|
||||||
val base64Gzip = Gzip.zip(json)
|
val base64Gzip = Gzip.zip(json)
|
||||||
Gdx.app.clipboard.contents = base64Gzip
|
Gdx.app.clipboard.contents = base64Gzip
|
||||||
}
|
}
|
||||||
add(copyMapAsTextButton).row()
|
add(copyMapAsTextButton).row()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Popup.addLoadMapButton() {
|
||||||
val loadMapButton = "Load map".toTextButton()
|
val loadMapButton = "Load map".toTextButton()
|
||||||
loadMapButton.onClick {
|
loadMapButton.onClick {
|
||||||
UncivGame.Current.setScreen(LoadMapScreen(mapEditorScreen.tileMap))
|
UncivGame.Current.setScreen(LoadMapScreen(mapEditorScreen.tileMap))
|
||||||
}
|
}
|
||||||
add(loadMapButton).row()
|
add(loadMapButton).row()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Popup.addUploadMapButton() {
|
||||||
val uploadMapButton = "Upload map".toTextButton()
|
val uploadMapButton = "Upload map".toTextButton()
|
||||||
uploadMapButton.onClick {
|
uploadMapButton.onClick {
|
||||||
thread(name="MapUpload") {
|
thread(name = "MapUpload") {
|
||||||
try {
|
try {
|
||||||
val gzippedMap = Gzip.zip(Json().toJson(mapEditorScreen.tileMap))
|
val gzippedMap = Gzip.zip(Json().toJson(mapEditorScreen.tileMap))
|
||||||
DropBox.uploadFile("/Maps/" + mapEditorScreen.mapName, gzippedMap)
|
DropBox.uploadFile("/Maps/" + mapEditorScreen.mapName, gzippedMap)
|
||||||
@ -122,44 +149,69 @@ class MapEditorMenuPopup(mapEditorScreen: MapEditorScreen): Popup(mapEditorScree
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
add(uploadMapButton).row()
|
add(uploadMapButton).row()
|
||||||
|
}
|
||||||
|
|
||||||
if (UncivGame.Current.scenarioDebugSwitch) {
|
private fun Popup.addScenarioButton() {
|
||||||
val createScenarioButton = "Create scenario".toTextButton()
|
var scenarioButton = "".toTextButton()
|
||||||
add(createScenarioButton).row()
|
if (mapEditorScreen.scenario != null) {
|
||||||
createScenarioButton.onClick {
|
scenarioButton.setText("Edit scenario")
|
||||||
remove()
|
} else {
|
||||||
mapEditorScreen.gameSetupInfo.gameParameters.players = getPlayersFromMap(mapEditorScreen.tileMap) // update players list from tileMap starting locations
|
scenarioButton.setText("Create scenario")
|
||||||
|
|
||||||
val gameParametersPopup = Popup(screen)
|
|
||||||
val playerPickerTable = PlayerPickerTable(mapEditorScreen, mapEditorScreen.gameSetupInfo.gameParameters)
|
|
||||||
val gameOptionsTable = GameOptionsTable(mapEditorScreen) {desiredCiv: String -> playerPickerTable.update(desiredCiv)}
|
|
||||||
val scenarioNameEditor = TextField(mapEditorScreen.mapName, skin)
|
|
||||||
|
|
||||||
gameParametersPopup.add(playerPickerTable)
|
|
||||||
gameParametersPopup.addSeparatorVertical()
|
|
||||||
gameParametersPopup.add(gameOptionsTable).row()
|
|
||||||
gameParametersPopup.add(scenarioNameEditor)
|
|
||||||
gameParametersPopup.addButton("Save scenario"){
|
|
||||||
mapEditorScreen.tileMap.mapParameters.type=MapType.scenario
|
|
||||||
MapSaver.saveScenario(scenarioNameEditor.text, Scenario(mapEditorScreen.tileMap, mapEditorScreen.gameSetupInfo.gameParameters))
|
|
||||||
ResponsePopup("Scenario saved", mapEditorScreen)
|
|
||||||
gameParametersPopup.close()
|
|
||||||
}.row()
|
|
||||||
gameParametersPopup.addCloseButton().row()
|
|
||||||
gameParametersPopup.open()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
add(scenarioButton).row()
|
||||||
|
scenarioButton.onClick {
|
||||||
|
remove()
|
||||||
|
// update players list from tileMap starting locations
|
||||||
|
if (mapEditorScreen.scenario == null) {
|
||||||
|
mapEditorScreen.gameSetupInfo.gameParameters.players = getPlayersFromMap(mapEditorScreen.tileMap)
|
||||||
|
}
|
||||||
|
|
||||||
|
val gameParametersPopup = Popup(screen)
|
||||||
|
val playerPickerTable = PlayerPickerTable(mapEditorScreen, mapEditorScreen.gameSetupInfo.gameParameters)
|
||||||
|
val gameOptionsTable = GameOptionsTable(mapEditorScreen) { desiredCiv: String -> playerPickerTable.update(desiredCiv) }
|
||||||
|
val scenarioNameEditor = TextField(mapEditorScreen.scenarioName, skin)
|
||||||
|
|
||||||
|
gameParametersPopup.add(playerPickerTable)
|
||||||
|
gameParametersPopup.addSeparatorVertical()
|
||||||
|
gameParametersPopup.add(gameOptionsTable).row()
|
||||||
|
gameParametersPopup.add(scenarioNameEditor)
|
||||||
|
gameParametersPopup.addButton("Save scenario") {
|
||||||
|
mapEditorScreen.tileMap.mapParameters.type = MapType.scenario
|
||||||
|
mapEditorScreen.scenario = Scenario(mapEditorScreen.tileMap, mapEditorScreen.gameSetupInfo.gameParameters)
|
||||||
|
mapEditorScreen.scenarioName = scenarioNameEditor.text
|
||||||
|
MapSaver.saveScenario(scenarioNameEditor.text, mapEditorScreen.scenario!!)
|
||||||
|
ResponsePopup("Scenario saved", mapEditorScreen)
|
||||||
|
gameParametersPopup.close()
|
||||||
|
}.row()
|
||||||
|
gameParametersPopup.addCloseButton().row()
|
||||||
|
gameParametersPopup.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Popup.addLoadScenarioButton() {
|
||||||
|
val loadScenarioButton = "Load scenario".toTextButton()
|
||||||
|
loadScenarioButton.onClick {
|
||||||
|
UncivGame.Current.setScreen(LoadScenarioScreen(mapEditorScreen.tileMap))
|
||||||
|
}
|
||||||
|
add(loadScenarioButton).row()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Popup.addExitMapEditorButton() {
|
||||||
val exitMapEditorButton = "Exit map editor".toTextButton()
|
val exitMapEditorButton = "Exit map editor".toTextButton()
|
||||||
add(exitMapEditorButton ).row()
|
add(exitMapEditorButton).row()
|
||||||
exitMapEditorButton.onClick { mapEditorScreen.game.setScreen(MainMenuScreen()); mapEditorScreen.dispose() }
|
exitMapEditorButton.onClick { mapEditorScreen.game.setScreen(MainMenuScreen()); mapEditorScreen.dispose() }
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Popup.addCloseOptionsButton() {
|
||||||
val closeOptionsButton = Constants.close.toTextButton()
|
val closeOptionsButton = Constants.close.toTextButton()
|
||||||
closeOptionsButton.onClick { close() }
|
closeOptionsButton.onClick { close() }
|
||||||
add(closeOptionsButton).row()
|
add(closeOptionsButton).row()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun getPlayersFromMap(tileMap: TileMap): ArrayList<Player> {
|
private fun getPlayersFromMap(tileMap: TileMap): ArrayList<Player> {
|
||||||
val tilesWithStartingLocations = tileMap.values
|
val tilesWithStartingLocations = tileMap.values
|
||||||
.filter { it.improvement != null && it.improvement!!.startsWith("StartingLocation ") }
|
.filter { it.improvement != null && it.improvement!!.startsWith("StartingLocation ") }
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.unciv.ui.mapeditor
|
package com.unciv.ui.mapeditor
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Game
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.math.Vector2
|
import com.badlogic.gdx.math.Vector2
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputEvent
|
import com.badlogic.gdx.scenes.scene2d.InputEvent
|
||||||
@ -9,19 +10,23 @@ import com.badlogic.gdx.scenes.scene2d.ui.SelectBox
|
|||||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin
|
import com.badlogic.gdx.scenes.scene2d.ui.Skin
|
||||||
import com.badlogic.gdx.utils.Array
|
import com.badlogic.gdx.utils.Array
|
||||||
import com.unciv.logic.MapSaver
|
import com.unciv.logic.MapSaver
|
||||||
|
import com.unciv.logic.map.Scenario
|
||||||
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.translations.tr
|
import com.unciv.models.translations.tr
|
||||||
import com.unciv.ui.newgamescreen.GameParametersPreviousScreen
|
|
||||||
import com.unciv.ui.newgamescreen.GameSetupInfo
|
import com.unciv.ui.newgamescreen.GameSetupInfo
|
||||||
|
import com.unciv.ui.newgamescreen.PreviousScreenInterface
|
||||||
import com.unciv.ui.utils.*
|
import com.unciv.ui.utils.*
|
||||||
|
|
||||||
class MapEditorScreen(): GameParametersPreviousScreen() {
|
class MapEditorScreen(): PreviousScreenInterface, CameraStageBaseScreen() {
|
||||||
override val ruleset = RulesetCache.getBaseRuleset()
|
// need for compatibility with NewGameScreen: PickerScreen
|
||||||
var mapName = ""
|
override fun setRightSideButtonEnabled(boolean: Boolean) {}
|
||||||
|
|
||||||
|
var mapName = ""
|
||||||
var tileMap = TileMap()
|
var tileMap = TileMap()
|
||||||
|
var scenarioName = ""
|
||||||
|
var scenario: Scenario? = null
|
||||||
|
|
||||||
override var gameSetupInfo = GameSetupInfo()
|
override var gameSetupInfo = GameSetupInfo()
|
||||||
lateinit var mapHolder: EditorMapHolder
|
lateinit var mapHolder: EditorMapHolder
|
||||||
|
|
||||||
@ -51,8 +56,15 @@ class MapEditorScreen(): GameParametersPreviousScreen() {
|
|||||||
initialize()
|
initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constructor(scenario: Scenario) : this() {
|
||||||
|
tileMap = scenario.tileMap
|
||||||
|
this.scenario = scenario
|
||||||
|
gameSetupInfo.gameParameters = scenario.gameParameters
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
fun initialize() {
|
fun initialize() {
|
||||||
tileMap.setTransients(ruleset,false)
|
tileMap.setTransients(gameSetupInfo.ruleset,false)
|
||||||
|
|
||||||
mapHolder = EditorMapHolder(this, tileMap)
|
mapHolder = EditorMapHolder(this, tileMap)
|
||||||
mapHolder.addTiles(stage.width)
|
mapHolder.addTiles(stage.width)
|
||||||
|
@ -31,7 +31,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
|
|||||||
var brushSize = 1
|
var brushSize = 1
|
||||||
private var currentHex: Actor = Group()
|
private var currentHex: Actor = Group()
|
||||||
|
|
||||||
private val ruleset = mapEditorScreen.ruleset
|
private val ruleset = mapEditorScreen.gameSetupInfo.ruleset
|
||||||
|
|
||||||
private val scrollPanelHeight = mapEditorScreen.stage.height*0.7f - 100f // -100 reserved for currentHex table
|
private val scrollPanelHeight = mapEditorScreen.stage.height*0.7f - 100f // -100 reserved for currentHex table
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
|
|||||||
|
|
||||||
// for the tile image
|
// for the tile image
|
||||||
val tileInfo = TileInfo()
|
val tileInfo = TileInfo()
|
||||||
tileInfo.ruleset = mapEditorScreen.ruleset
|
tileInfo.ruleset = mapEditorScreen.gameSetupInfo.ruleset
|
||||||
val terrain = resource.terrainsCanBeFoundOn.first()
|
val terrain = resource.terrainsCanBeFoundOn.first()
|
||||||
val terrainObject = ruleset.terrains[terrain]!!
|
val terrainObject = ruleset.terrains[terrain]!!
|
||||||
if (terrainObject.type == TerrainType.TerrainFeature) {
|
if (terrainObject.type == TerrainType.TerrainFeature) {
|
||||||
@ -351,7 +351,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun makeTileGroup(tileInfo: TileInfo): TileGroup {
|
private fun makeTileGroup(tileInfo: TileInfo): TileGroup {
|
||||||
tileInfo.ruleset = mapEditorScreen.ruleset
|
tileInfo.ruleset = mapEditorScreen.gameSetupInfo.ruleset
|
||||||
tileInfo.setTerrainTransients()
|
tileInfo.setTerrainTransients()
|
||||||
val group = TileGroup(tileInfo, TileSetStrings())
|
val group = TileGroup(tileInfo, TileSetStrings())
|
||||||
group.showEntireMap = true
|
group.showEntireMap = true
|
||||||
|
@ -10,10 +10,10 @@ import com.unciv.models.ruleset.VictoryType
|
|||||||
import com.unciv.models.translations.tr
|
import com.unciv.models.translations.tr
|
||||||
import com.unciv.ui.utils.*
|
import com.unciv.ui.utils.*
|
||||||
|
|
||||||
class GameOptionsTable(previousScreen: GameParametersPreviousScreen, val updatePlayerPickerTable:(desiredCiv:String)->Unit)
|
class GameOptionsTable(previousScreen: PreviousScreenInterface, val updatePlayerPickerTable:(desiredCiv:String)->Unit)
|
||||||
: Table(CameraStageBaseScreen.skin) {
|
: Table(CameraStageBaseScreen.skin) {
|
||||||
var gameParameters = previousScreen.gameSetupInfo.gameParameters
|
var gameParameters = previousScreen.gameSetupInfo.gameParameters
|
||||||
val ruleset = previousScreen.ruleset
|
val ruleset = previousScreen.gameSetupInfo.ruleset
|
||||||
var locked = false
|
var locked = false
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
package com.unciv.ui.newgamescreen
|
|
||||||
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.Stage
|
|
||||||
import com.unciv.models.ruleset.Ruleset
|
|
||||||
import com.unciv.ui.pickerscreens.PickerScreen
|
|
||||||
import com.unciv.ui.utils.CameraStageBaseScreen
|
|
||||||
|
|
||||||
abstract class GameParametersPreviousScreen: PickerScreen() {
|
|
||||||
abstract var gameSetupInfo: GameSetupInfo
|
|
||||||
abstract val ruleset: Ruleset
|
|
||||||
}
|
|
@ -3,6 +3,7 @@ package com.unciv.ui.newgamescreen
|
|||||||
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox
|
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||||
import com.badlogic.gdx.utils.Array
|
import com.badlogic.gdx.utils.Array
|
||||||
|
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
|
||||||
import com.unciv.ui.utils.CameraStageBaseScreen
|
import com.unciv.ui.utils.CameraStageBaseScreen
|
||||||
@ -28,7 +29,7 @@ class MapOptionsTable(val newGameScreen: NewGameScreen): Table() {
|
|||||||
add("{Map Type}:".toLabel())
|
add("{Map Type}:".toLabel())
|
||||||
val mapTypes = arrayListOf("Generated")
|
val mapTypes = arrayListOf("Generated")
|
||||||
if (MapSaver.getMaps().isNotEmpty()) mapTypes.add(MapType.custom)
|
if (MapSaver.getMaps().isNotEmpty()) mapTypes.add(MapType.custom)
|
||||||
if (MapSaver.getScenarios().isNotEmpty()) mapTypes.add(MapType.scenario)
|
if (MapSaver.getScenarios().isNotEmpty() && UncivGame.Current.scenarioDebugSwitch) mapTypes.add(MapType.scenario)
|
||||||
val mapTypeSelectBox = TranslatedSelectBox(mapTypes, "Generated", CameraStageBaseScreen.skin)
|
val mapTypeSelectBox = TranslatedSelectBox(mapTypes, "Generated", CameraStageBaseScreen.skin)
|
||||||
|
|
||||||
val mapFileSelectBox = getMapFileSelectBox()
|
val mapFileSelectBox = getMapFileSelectBox()
|
||||||
|
@ -2,7 +2,6 @@ package com.unciv.ui.newgamescreen
|
|||||||
|
|
||||||
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.CheckBox
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox
|
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin
|
import com.badlogic.gdx.scenes.scene2d.ui.Skin
|
||||||
import com.badlogic.gdx.utils.Array
|
import com.badlogic.gdx.utils.Array
|
||||||
@ -10,10 +9,10 @@ import com.unciv.UncivGame
|
|||||||
import com.unciv.logic.*
|
import com.unciv.logic.*
|
||||||
import com.unciv.logic.civilization.PlayerType
|
import com.unciv.logic.civilization.PlayerType
|
||||||
import com.unciv.logic.map.MapParameters
|
import com.unciv.logic.map.MapParameters
|
||||||
import com.unciv.logic.map.MapType
|
|
||||||
import com.unciv.models.metadata.GameParameters
|
import com.unciv.models.metadata.GameParameters
|
||||||
import com.unciv.models.ruleset.RulesetCache
|
import com.unciv.models.ruleset.RulesetCache
|
||||||
import com.unciv.models.translations.tr
|
import com.unciv.models.translations.tr
|
||||||
|
import com.unciv.ui.pickerscreens.PickerScreen
|
||||||
import com.unciv.ui.utils.*
|
import com.unciv.ui.utils.*
|
||||||
import com.unciv.ui.worldscreen.mainmenu.OnlineMultiplayer
|
import com.unciv.ui.worldscreen.mainmenu.OnlineMultiplayer
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@ -21,14 +20,15 @@ import kotlin.concurrent.thread
|
|||||||
|
|
||||||
|
|
||||||
class GameSetupInfo(var gameId:String, var gameParameters: GameParameters, var mapParameters: MapParameters) {
|
class GameSetupInfo(var gameId:String, var gameParameters: GameParameters, var mapParameters: MapParameters) {
|
||||||
|
var ruleset = RulesetCache.getComplexRuleset(gameParameters.mods)
|
||||||
|
|
||||||
constructor() : this("", GameParameters(), MapParameters())
|
constructor() : this("", GameParameters(), MapParameters())
|
||||||
constructor(gameInfo: GameInfo) : this("", gameInfo.gameParameters.clone(), gameInfo.tileMap.mapParameters)
|
constructor(gameInfo: GameInfo) : this("", gameInfo.gameParameters.clone(), gameInfo.tileMap.mapParameters)
|
||||||
|
constructor(gameParameters: GameParameters, mapParameters: MapParameters) : this("", gameParameters, mapParameters)
|
||||||
}
|
}
|
||||||
|
|
||||||
class NewGameScreen(previousScreen:CameraStageBaseScreen, _gameSetupInfo: GameSetupInfo?=null): GameParametersPreviousScreen() {
|
class NewGameScreen(previousScreen:CameraStageBaseScreen, _gameSetupInfo: GameSetupInfo?=null): PreviousScreenInterface, PickerScreen() {
|
||||||
|
|
||||||
override var gameSetupInfo: GameSetupInfo = _gameSetupInfo ?: GameSetupInfo()
|
override var gameSetupInfo: GameSetupInfo = _gameSetupInfo ?: GameSetupInfo()
|
||||||
override val ruleset = RulesetCache.getComplexRuleset(gameSetupInfo.gameParameters.mods)
|
|
||||||
var playerPickerTable = PlayerPickerTable(this, gameSetupInfo.gameParameters)
|
var playerPickerTable = PlayerPickerTable(this, gameSetupInfo.gameParameters)
|
||||||
var newGameOptionsTable = GameOptionsTable(this) { desiredCiv: String -> playerPickerTable.update(desiredCiv) }
|
var newGameOptionsTable = GameOptionsTable(this) { desiredCiv: String -> playerPickerTable.update(desiredCiv) }
|
||||||
var mapOptionsTable = MapOptionsTable(this)
|
var mapOptionsTable = MapOptionsTable(this)
|
||||||
@ -37,8 +37,6 @@ class NewGameScreen(previousScreen:CameraStageBaseScreen, _gameSetupInfo: GameSe
|
|||||||
setDefaultCloseAction(previousScreen)
|
setDefaultCloseAction(previousScreen)
|
||||||
scrollPane.setScrollingDisabled(true, true)
|
scrollPane.setScrollingDisabled(true, true)
|
||||||
|
|
||||||
// val playerPickerTable = PlayerPickerTable(this, gameSetupInfo.gameParameters)
|
|
||||||
// val newGameOptionsTable = GameOptionsTable(this) { desiredCiv: String -> playerPickerTable.update(desiredCiv) }
|
|
||||||
topTable.add(ScrollPane(mapOptionsTable).apply { setOverscroll(false, false) })
|
topTable.add(ScrollPane(mapOptionsTable).apply { setOverscroll(false, false) })
|
||||||
.maxHeight(topTable.parent.height).width(stage.width / 3).padTop(20f).top()
|
.maxHeight(topTable.parent.height).width(stage.width / 3).padTop(20f).top()
|
||||||
topTable.addSeparatorVertical()
|
topTable.addSeparatorVertical()
|
||||||
|
@ -14,12 +14,11 @@ import com.unciv.logic.IdChecker
|
|||||||
import com.unciv.logic.civilization.PlayerType
|
import com.unciv.logic.civilization.PlayerType
|
||||||
import com.unciv.models.metadata.GameParameters
|
import com.unciv.models.metadata.GameParameters
|
||||||
import com.unciv.models.metadata.Player
|
import com.unciv.models.metadata.Player
|
||||||
import com.unciv.models.ruleset.Ruleset
|
|
||||||
import com.unciv.models.translations.tr
|
import com.unciv.models.translations.tr
|
||||||
import com.unciv.ui.utils.*
|
import com.unciv.ui.utils.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class PlayerPickerTable(val previousScreen: GameParametersPreviousScreen, var gameParameters: GameParameters): Table() {
|
class PlayerPickerTable(val previousScreen: PreviousScreenInterface, var gameParameters: GameParameters): Table() {
|
||||||
val playerListTable = Table()
|
val playerListTable = Table()
|
||||||
val nationsPopupWidth = previousScreen.stage.width / 2f
|
val nationsPopupWidth = previousScreen.stage.width / 2f
|
||||||
val civBlocksWidth = previousScreen.stage.width / 3
|
val civBlocksWidth = previousScreen.stage.width / 3
|
||||||
@ -35,18 +34,18 @@ class PlayerPickerTable(val previousScreen: GameParametersPreviousScreen, var ga
|
|||||||
|
|
||||||
fun update(desiredCiv: String = "") {
|
fun update(desiredCiv: String = "") {
|
||||||
playerListTable.clear()
|
playerListTable.clear()
|
||||||
val gameBasics = previousScreen.ruleset // the mod picking changes this ruleset
|
val ruleset = previousScreen.gameSetupInfo.ruleset // the mod picking changes this ruleset
|
||||||
|
|
||||||
reassignRemovedModReferences()
|
reassignRemovedModReferences()
|
||||||
val newRulesetPlayableCivs = previousScreen.ruleset.nations.count { it.key != Constants.barbarians }
|
val newRulesetPlayableCivs = previousScreen.gameSetupInfo.ruleset.nations.count { it.key != Constants.barbarians }
|
||||||
if (gameParameters.players.size > newRulesetPlayableCivs)
|
if (gameParameters.players.size > newRulesetPlayableCivs)
|
||||||
gameParameters.players = ArrayList(gameParameters.players.subList(0, newRulesetPlayableCivs))
|
gameParameters.players = ArrayList(gameParameters.players.subList(0, newRulesetPlayableCivs))
|
||||||
if (desiredCiv.isNotEmpty()) assignDesiredCiv(desiredCiv)
|
if (desiredCiv.isNotEmpty()) assignDesiredCiv(desiredCiv)
|
||||||
|
|
||||||
for (player in gameParameters.players) {
|
for (player in gameParameters.players) {
|
||||||
playerListTable.add(getPlayerTable(player, gameBasics)).width(civBlocksWidth).padBottom(20f).row()
|
playerListTable.add(getPlayerTable(player)).width(civBlocksWidth).padBottom(20f).row()
|
||||||
}
|
}
|
||||||
if (gameParameters.players.count() < gameBasics.nations.values.count { it.isMajorCiv() }
|
if (gameParameters.players.count() < ruleset.nations.values.count { it.isMajorCiv() }
|
||||||
&& !locked) {
|
&& !locked) {
|
||||||
playerListTable.add("+".toLabel(Color.BLACK, 30).apply { this.setAlignment(Align.center) }
|
playerListTable.add("+".toLabel(Color.BLACK, 30).apply { this.setAlignment(Align.center) }
|
||||||
.surroundWithCircle(50f).onClick { gameParameters.players.add(Player()); update() }).pad(10f)
|
.surroundWithCircle(50f).onClick { gameParameters.players.add(Player()); update() }).pad(10f)
|
||||||
@ -56,7 +55,7 @@ class PlayerPickerTable(val previousScreen: GameParametersPreviousScreen, var ga
|
|||||||
|
|
||||||
private fun reassignRemovedModReferences() {
|
private fun reassignRemovedModReferences() {
|
||||||
for (player in gameParameters.players) {
|
for (player in gameParameters.players) {
|
||||||
if (!previousScreen.ruleset.nations.containsKey(player.chosenCiv))
|
if (!previousScreen.gameSetupInfo.ruleset.nations.containsKey(player.chosenCiv))
|
||||||
player.chosenCiv = "Random"
|
player.chosenCiv = "Random"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -68,7 +67,7 @@ class PlayerPickerTable(val previousScreen: GameParametersPreviousScreen, var ga
|
|||||||
gameParameters.players.firstOrNull { it.chosenCiv == "Random" && it.playerType == PlayerType.Human }?.chosenCiv = desiredCiv
|
gameParameters.players.firstOrNull { it.chosenCiv == "Random" && it.playerType == PlayerType.Human }?.chosenCiv = desiredCiv
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getPlayerTable(player: Player, ruleset: Ruleset): Table {
|
fun getPlayerTable(player: Player): Table {
|
||||||
val playerTable = Table()
|
val playerTable = Table()
|
||||||
playerTable.pad(5f)
|
playerTable.pad(5f)
|
||||||
playerTable.background = ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK, 0.8f))
|
playerTable.background = ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK, 0.8f))
|
||||||
@ -134,7 +133,7 @@ class PlayerPickerTable(val previousScreen: GameParametersPreviousScreen, var ga
|
|||||||
.apply { this.setAlignment(Align.center) }
|
.apply { this.setAlignment(Align.center) }
|
||||||
.surroundWithCircle(36f).apply { circle.color = Color.BLACK }
|
.surroundWithCircle(36f).apply { circle.color = Color.BLACK }
|
||||||
.surroundWithCircle(40f, false).apply { circle.color = Color.WHITE }
|
.surroundWithCircle(40f, false).apply { circle.color = Color.WHITE }
|
||||||
else ImageGetter.getNationIndicator(previousScreen.ruleset.nations[player.chosenCiv]!!, 40f)
|
else ImageGetter.getNationIndicator(previousScreen.gameSetupInfo.ruleset.nations[player.chosenCiv]!!, 40f)
|
||||||
nationTable.add(nationImage).pad(5f)
|
nationTable.add(nationImage).pad(5f)
|
||||||
nationTable.add(player.chosenCiv.toLabel()).pad(5f)
|
nationTable.add(player.chosenCiv.toLabel()).pad(5f)
|
||||||
nationTable.touchable = Touchable.enabled
|
nationTable.touchable = Touchable.enabled
|
||||||
@ -145,7 +144,7 @@ class PlayerPickerTable(val previousScreen: GameParametersPreviousScreen, var ga
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun popupNationPicker(player: Player) {
|
private fun popupNationPicker(player: Player) {
|
||||||
val nationsPopup = Popup(previousScreen)
|
val nationsPopup = Popup(previousScreen as CameraStageBaseScreen)
|
||||||
val nationListTable = Table()
|
val nationListTable = Table()
|
||||||
|
|
||||||
val randomPlayerTable = Table()
|
val randomPlayerTable = Table()
|
||||||
@ -165,12 +164,12 @@ class PlayerPickerTable(val previousScreen: GameParametersPreviousScreen, var ga
|
|||||||
nationListTable.add(randomPlayerTable).pad(10f).width(nationsPopupWidth).row()
|
nationListTable.add(randomPlayerTable).pad(10f).width(nationsPopupWidth).row()
|
||||||
|
|
||||||
|
|
||||||
for (nation in previousScreen.ruleset.nations.values
|
for (nation in previousScreen.gameSetupInfo.ruleset.nations.values
|
||||||
.filter { !it.isCityState() && it.name != Constants.barbarians }) {
|
.filter { !it.isCityState() && it.name != Constants.barbarians }) {
|
||||||
if (player.chosenCiv != nation.name && gameParameters.players.any { it.chosenCiv == nation.name })
|
if (player.chosenCiv != nation.name && gameParameters.players.any { it.chosenCiv == nation.name })
|
||||||
continue
|
continue
|
||||||
|
|
||||||
nationListTable.add(NationTable(nation, nationsPopupWidth, previousScreen.ruleset).onClick {
|
nationListTable.add(NationTable(nation, nationsPopupWidth, previousScreen.gameSetupInfo.ruleset).onClick {
|
||||||
player.chosenCiv = nation.name
|
player.chosenCiv = nation.name
|
||||||
nationsPopup.close()
|
nationsPopup.close()
|
||||||
update()
|
update()
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.unciv.ui.newgamescreen
|
||||||
|
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.Stage
|
||||||
|
import com.unciv.models.ruleset.Ruleset
|
||||||
|
import com.unciv.ui.pickerscreens.PickerScreen
|
||||||
|
import com.unciv.ui.utils.CameraStageBaseScreen
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface to use as a previous screen for GameOptionsTable and PlayerPickerTable
|
||||||
|
* It should be a child of the PickerScreen class during new game creation
|
||||||
|
* or CameraBackStageScreen class for map editing
|
||||||
|
*/
|
||||||
|
|
||||||
|
interface PreviousScreenInterface {
|
||||||
|
var gameSetupInfo: GameSetupInfo
|
||||||
|
var stage: Stage
|
||||||
|
|
||||||
|
// added for compatibility with NewGameScreen: PickerScreen
|
||||||
|
fun setRightSideButtonEnabled(boolean: Boolean)
|
||||||
|
}
|
||||||
|
|
||||||
|
//abstract class GameParametersPreviousScreen: PickerScreen() {
|
||||||
|
// abstract var gameSetupInfo: GameSetupInfo
|
||||||
|
// abstract val ruleset: Ruleset
|
||||||
|
//}
|
Loading…
x
Reference in New Issue
Block a user