Extracted name, type, radius and noRuins of map from GameParameters to MapParameters, so that Maps can be created and defined outside of games
This commit is contained in:
parent
a90059988b
commit
9493ce1a2e
10 changed files with 56 additions and 39 deletions
|
@ -8,6 +8,7 @@ import com.badlogic.gdx.audio.Music
|
||||||
import com.unciv.logic.GameInfo
|
import com.unciv.logic.GameInfo
|
||||||
import com.unciv.logic.GameSaver
|
import com.unciv.logic.GameSaver
|
||||||
import com.unciv.logic.GameStarter
|
import com.unciv.logic.GameStarter
|
||||||
|
import com.unciv.logic.map.MapParameters
|
||||||
import com.unciv.models.gamebasics.Ruleset
|
import com.unciv.models.gamebasics.Ruleset
|
||||||
import com.unciv.models.metadata.GameParameters
|
import com.unciv.models.metadata.GameParameters
|
||||||
import com.unciv.models.metadata.GameSettings
|
import com.unciv.models.metadata.GameSettings
|
||||||
|
@ -91,7 +92,7 @@ class UncivGame(val version: String) : Game() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun startNewGame() {
|
fun startNewGame() {
|
||||||
val newGame = GameStarter().startNewGame(GameParameters().apply { difficulty="Chieftain" })
|
val newGame = GameStarter().startNewGame(GameParameters().apply { difficulty="Chieftain" }, MapParameters())
|
||||||
loadGame(newGame)
|
loadGame(newGame)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,15 +13,16 @@ import kotlin.math.max
|
||||||
|
|
||||||
class GameStarter{
|
class GameStarter{
|
||||||
|
|
||||||
fun startNewGame(newGameParameters: GameParameters): GameInfo {
|
fun startNewGame(newGameParameters: GameParameters, mapParameters: MapParameters): GameInfo {
|
||||||
val gameInfo = GameInfo()
|
val gameInfo = GameInfo()
|
||||||
|
|
||||||
gameInfo.gameParameters = newGameParameters
|
gameInfo.gameParameters = newGameParameters
|
||||||
val gameBasics = UncivGame.Current.ruleset
|
val gameBasics = UncivGame.Current.ruleset
|
||||||
|
|
||||||
if(newGameParameters.mapType==MapType.file)
|
if(mapParameters.name!="")
|
||||||
gameInfo.tileMap = MapSaver().loadMap(newGameParameters.mapFileName!!)
|
gameInfo.tileMap = MapSaver().loadMap(mapParameters.name)
|
||||||
else gameInfo.tileMap = MapGenerator().generateMap(newGameParameters, gameBasics)
|
else gameInfo.tileMap = MapGenerator().generateMap(mapParameters, gameBasics)
|
||||||
|
gameInfo.tileMap.mapParameters = mapParameters
|
||||||
|
|
||||||
gameInfo.tileMap.setTransients(gameBasics)
|
gameInfo.tileMap.setTransients(gameBasics)
|
||||||
|
|
||||||
|
@ -29,7 +30,7 @@ class GameStarter{
|
||||||
gameInfo.difficulty = newGameParameters.difficulty
|
gameInfo.difficulty = newGameParameters.difficulty
|
||||||
|
|
||||||
|
|
||||||
addCivilizations(newGameParameters, gameInfo,gameBasics) // this is before the setTransients so gameInfo doesn't yet have the gameBasics
|
addCivilizations(newGameParameters, gameInfo, gameBasics) // this is before the setTransients so gameInfo doesn't yet have the gameBasics
|
||||||
|
|
||||||
gameInfo.setTransients() // needs to be before placeBarbarianUnit because it depends on the tilemap having its gameinfo set
|
gameInfo.setTransients() // needs to be before placeBarbarianUnit because it depends on the tilemap having its gameinfo set
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,9 @@ class WorkerAutomation(val unit: MapUnit) {
|
||||||
if (tileInfo.isWorked()) priority += 3
|
if (tileInfo.isWorked()) priority += 3
|
||||||
}
|
}
|
||||||
// give a minor priority to tiles that we could expand onto
|
// give a minor priority to tiles that we could expand onto
|
||||||
else if (tileInfo.getOwner()==null && tileInfo.neighbors.any { it.getOwner() ==civInfo }) priority += 1
|
else if (tileInfo.getOwner()==null && tileInfo.neighbors.any { it.getOwner() ==civInfo })
|
||||||
|
priority += 1
|
||||||
|
|
||||||
if (priority!=0 && tileInfo.hasViewableResource(civInfo)) priority += 1
|
if (priority!=0 && tileInfo.hasViewableResource(civInfo)) priority += 1
|
||||||
return priority
|
return priority
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ class TechManager {
|
||||||
// https://forums.civfanatics.com/threads/the-mechanics-of-overflow-inflation.517970/
|
// https://forums.civfanatics.com/threads/the-mechanics-of-overflow-inflation.517970/
|
||||||
techCost /= 1 + techsResearchedKnownCivs / undefeatedCivs.toFloat() * 0.3f
|
techCost /= 1 + techsResearchedKnownCivs / undefeatedCivs.toFloat() * 0.3f
|
||||||
// http://www.civclub.net/bbs/forum.php?mod=viewthread&tid=123976
|
// http://www.civclub.net/bbs/forum.php?mod=viewthread&tid=123976
|
||||||
val worldSizeModifier = when(civInfo.gameInfo.gameParameters.mapRadius) {
|
val worldSizeModifier = when(civInfo.gameInfo.tileMap.mapParameters.radius) {
|
||||||
20 -> floatArrayOf(1.1f, 0.05f) // Medium Size
|
20 -> floatArrayOf(1.1f, 0.05f) // Medium Size
|
||||||
30 -> floatArrayOf(1.2f, 0.03f) // Large Size
|
30 -> floatArrayOf(1.2f, 0.03f) // Large Size
|
||||||
40 -> floatArrayOf(1.3f, 0.02f) // Huge Size
|
40 -> floatArrayOf(1.3f, 0.02f) // Huge Size
|
||||||
|
|
|
@ -7,7 +7,6 @@ import com.unciv.models.Counter
|
||||||
import com.unciv.models.gamebasics.Ruleset
|
import com.unciv.models.gamebasics.Ruleset
|
||||||
import com.unciv.models.gamebasics.tile.ResourceType
|
import com.unciv.models.gamebasics.tile.ResourceType
|
||||||
import com.unciv.models.gamebasics.tile.TerrainType
|
import com.unciv.models.gamebasics.tile.TerrainType
|
||||||
import com.unciv.models.metadata.GameParameters
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.collections.HashMap
|
import kotlin.collections.HashMap
|
||||||
import kotlin.math.*
|
import kotlin.math.*
|
||||||
|
@ -22,17 +21,18 @@ class MapType {
|
||||||
val perlin="Perlin"
|
val perlin="Perlin"
|
||||||
val continents = "Continents"
|
val continents = "Continents"
|
||||||
val pangaea = "Pangaea"
|
val pangaea = "Pangaea"
|
||||||
val file = "File"
|
val custom="Custom"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MapGenerator {
|
class MapGenerator {
|
||||||
|
|
||||||
fun generateMap(gameParameters: GameParameters, ruleset: Ruleset): TileMap {
|
fun generateMap(mapParameters: MapParameters, ruleset: Ruleset): TileMap {
|
||||||
val mapRadius = gameParameters.mapRadius
|
val mapRadius = mapParameters.radius
|
||||||
val mapType = gameParameters.mapType
|
val mapType = mapParameters.type
|
||||||
|
|
||||||
val map = TileMap(mapRadius, ruleset)
|
val map = TileMap(mapRadius, ruleset)
|
||||||
|
map.mapParameters = mapParameters
|
||||||
|
|
||||||
// Step one - separate land and water, in form of Grasslands and Oceans
|
// Step one - separate land and water, in form of Grasslands and Oceans
|
||||||
if (mapType == MapType.perlin)
|
if (mapType == MapType.perlin)
|
||||||
|
@ -45,7 +45,7 @@ class MapGenerator {
|
||||||
|
|
||||||
setWaterTiles(map)
|
setWaterTiles(map)
|
||||||
|
|
||||||
for (tile in map.values) randomizeTile(tile, gameParameters, ruleset)
|
for (tile in map.values) randomizeTile(tile, mapParameters, ruleset)
|
||||||
|
|
||||||
randomizeResources(map, mapRadius, ruleset)
|
randomizeResources(map, mapRadius, ruleset)
|
||||||
|
|
||||||
|
@ -94,13 +94,14 @@ class MapGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun randomizeTile(tileInfo: TileInfo, gameParameters: GameParameters, ruleset: Ruleset) {
|
fun randomizeTile(tileInfo: TileInfo, mapParameters: MapParameters, ruleset: Ruleset) {
|
||||||
if (tileInfo.getBaseTerrain().type == TerrainType.Land && Math.random() < 0.05f) {
|
if (tileInfo.getBaseTerrain().type == TerrainType.Land && Math.random() < 0.05f) {
|
||||||
tileInfo.baseTerrain = Constants.mountain
|
tileInfo.baseTerrain = Constants.mountain
|
||||||
tileInfo.setTransients()
|
tileInfo.setTransients()
|
||||||
}
|
}
|
||||||
addRandomTerrainFeature(tileInfo, ruleset)
|
addRandomTerrainFeature(tileInfo, ruleset)
|
||||||
maybeAddAncientRuins(tileInfo, gameParameters)
|
if(!mapParameters.noRuins)
|
||||||
|
maybeAddAncientRuins(tileInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getLatitude(vector: Vector2): Float {
|
fun getLatitude(vector: Vector2): Float {
|
||||||
|
@ -194,9 +195,9 @@ class MapGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun maybeAddAncientRuins(tile: TileInfo, gameParameters: GameParameters) {
|
fun maybeAddAncientRuins(tile: TileInfo) {
|
||||||
val baseTerrain = tile.getBaseTerrain()
|
val baseTerrain = tile.getBaseTerrain()
|
||||||
if (!gameParameters.noRuins && baseTerrain.type != TerrainType.Water && !baseTerrain.impassable && Random().nextDouble() < 1f / 100)
|
if (baseTerrain.type != TerrainType.Water && !baseTerrain.impassable && Random().nextDouble() < 1f / 100)
|
||||||
tile.improvement = Constants.ancientRuins
|
tile.improvement = Constants.ancientRuins
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
8
core/src/com/unciv/logic/map/MapParameters.kt
Normal file
8
core/src/com/unciv/logic/map/MapParameters.kt
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
package com.unciv.logic.map
|
||||||
|
|
||||||
|
class MapParameters {
|
||||||
|
var name = ""
|
||||||
|
var type = MapType.pangaea
|
||||||
|
var radius = 20
|
||||||
|
var noRuins = false
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ class TileMap {
|
||||||
@Deprecated("as of 2.7.10")
|
@Deprecated("as of 2.7.10")
|
||||||
private var tiles = HashMap<String, TileInfo>()
|
private var tiles = HashMap<String, TileInfo>()
|
||||||
|
|
||||||
|
var mapParameters= MapParameters()
|
||||||
private var tileList = ArrayList<TileInfo>()
|
private var tileList = ArrayList<TileInfo>()
|
||||||
|
|
||||||
constructor() // for json parsing, we need to have a default constructor
|
constructor() // for json parsing, we need to have a default constructor
|
||||||
|
@ -170,3 +171,4 @@ class TileMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,21 @@
|
||||||
package com.unciv.models.metadata
|
package com.unciv.models.metadata
|
||||||
|
|
||||||
import com.unciv.logic.civilization.PlayerType
|
import com.unciv.logic.civilization.PlayerType
|
||||||
import com.unciv.logic.map.MapType
|
|
||||||
import com.unciv.models.gamebasics.VictoryType
|
import com.unciv.models.gamebasics.VictoryType
|
||||||
import com.unciv.models.gamebasics.tech.TechEra
|
import com.unciv.models.gamebasics.tech.TechEra
|
||||||
|
|
||||||
class GameParameters { // Default values are the default new game
|
class GameParameters { // Default values are the default new game
|
||||||
var difficulty = "Prince"
|
var difficulty = "Prince"
|
||||||
var gameSpeed = GameSpeed.Standard
|
var gameSpeed = GameSpeed.Standard
|
||||||
var mapRadius = 20
|
|
||||||
var players = ArrayList<Player>().apply {
|
var players = ArrayList<Player>().apply {
|
||||||
add(Player().apply { playerType = PlayerType.Human })
|
add(Player().apply { playerType = PlayerType.Human })
|
||||||
for (i in 1..3) add(Player())
|
for (i in 1..3) add(Player())
|
||||||
}
|
}
|
||||||
var numberOfCityStates = 0
|
var numberOfCityStates = 0
|
||||||
var mapType = MapType.pangaea
|
|
||||||
var noBarbarians = false
|
var noBarbarians = false
|
||||||
var oneCityChallenge = false
|
var oneCityChallenge = false
|
||||||
var noRuins = false;
|
|
||||||
var mapFileName: String? = null
|
|
||||||
var victoryTypes: ArrayList<VictoryType> = VictoryType.values().toCollection(ArrayList()) // By default, all victory types
|
var victoryTypes: ArrayList<VictoryType> = VictoryType.values().toCollection(ArrayList()) // By default, all victory types
|
||||||
var startingEra = TechEra.Ancient
|
var startingEra = TechEra.Ancient
|
||||||
|
|
||||||
|
|
|
@ -24,13 +24,14 @@ import kotlin.concurrent.thread
|
||||||
class NewGameScreen: PickerScreen(){
|
class NewGameScreen: PickerScreen(){
|
||||||
|
|
||||||
val newGameParameters= UncivGame.Current.gameInfo.gameParameters
|
val newGameParameters= UncivGame.Current.gameInfo.gameParameters
|
||||||
|
val mapParameters = UncivGame.Current.gameInfo.tileMap.mapParameters
|
||||||
val ruleSet = Ruleset(true)
|
val ruleSet = Ruleset(true)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
setDefaultCloseAction()
|
setDefaultCloseAction()
|
||||||
|
|
||||||
val playerPickerTable = PlayerPickerTable(this, newGameParameters)
|
val playerPickerTable = PlayerPickerTable(this, newGameParameters)
|
||||||
topTable.add(NewGameScreenOptionsTable(newGameParameters,ruleSet) { playerPickerTable.update() })
|
topTable.add(NewGameScreenOptionsTable(newGameParameters,mapParameters, ruleSet) { playerPickerTable.update() })
|
||||||
topTable.add(playerPickerTable).pad(10f)
|
topTable.add(playerPickerTable).pad(10f)
|
||||||
topTable.pack()
|
topTable.pack()
|
||||||
topTable.setFillParent(true)
|
topTable.setFillParent(true)
|
||||||
|
@ -67,7 +68,7 @@ class NewGameScreen: PickerScreen(){
|
||||||
thread {
|
thread {
|
||||||
// Creating a new game can take a while and we don't want ANRs
|
// Creating a new game can take a while and we don't want ANRs
|
||||||
try {
|
try {
|
||||||
newGame = GameStarter().startNewGame(newGameParameters)
|
newGame = GameStarter().startNewGame(newGameParameters,mapParameters)
|
||||||
if (newGameParameters.isOnlineMultiplayer) {
|
if (newGameParameters.isOnlineMultiplayer) {
|
||||||
newGame!!.isUpToDate=true // So we don't try to download it from dropbox the second after we upload it - the file is not yet ready for loading!
|
newGame!!.isUpToDate=true // So we don't try to download it from dropbox the second after we upload it - the file is not yet ready for loading!
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener
|
||||||
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.MapParameters
|
||||||
import com.unciv.logic.map.MapType
|
import com.unciv.logic.map.MapType
|
||||||
import com.unciv.models.gamebasics.Ruleset
|
import com.unciv.models.gamebasics.Ruleset
|
||||||
import com.unciv.models.gamebasics.VictoryType
|
import com.unciv.models.gamebasics.VictoryType
|
||||||
|
@ -18,7 +19,9 @@ import com.unciv.models.metadata.GameSpeed
|
||||||
import com.unciv.ui.utils.CameraStageBaseScreen
|
import com.unciv.ui.utils.CameraStageBaseScreen
|
||||||
import com.unciv.ui.utils.toLabel
|
import com.unciv.ui.utils.toLabel
|
||||||
|
|
||||||
class NewGameScreenOptionsTable(val newGameParameters: GameParameters, val ruleset: Ruleset, val onMultiplayerToggled:()->Unit)
|
class NewGameScreenOptionsTable(val newGameParameters: GameParameters,
|
||||||
|
val mapParameters: MapParameters,
|
||||||
|
val ruleset: Ruleset, val onMultiplayerToggled:()->Unit)
|
||||||
: Table(CameraStageBaseScreen.skin){
|
: Table(CameraStageBaseScreen.skin){
|
||||||
init{
|
init{
|
||||||
addMapTypeSizeAndFile()
|
addMapTypeSizeAndFile()
|
||||||
|
@ -61,10 +64,10 @@ class NewGameScreenOptionsTable(val newGameParameters: GameParameters, val rules
|
||||||
|
|
||||||
private fun addNoRuinsCheckbox() {
|
private fun addNoRuinsCheckbox() {
|
||||||
val noRuinsCheckbox = CheckBox("No ancient ruins".tr(), CameraStageBaseScreen.skin)
|
val noRuinsCheckbox = CheckBox("No ancient ruins".tr(), CameraStageBaseScreen.skin)
|
||||||
noRuinsCheckbox.isChecked = newGameParameters.noRuins
|
noRuinsCheckbox.isChecked = mapParameters.noRuins
|
||||||
noRuinsCheckbox.addListener(object : ChangeListener() {
|
noRuinsCheckbox.addListener(object : ChangeListener() {
|
||||||
override fun changed(event: ChangeEvent?, actor: Actor?) {
|
override fun changed(event: ChangeEvent?, actor: Actor?) {
|
||||||
newGameParameters.noRuins = noRuinsCheckbox.isChecked
|
mapParameters.noRuins = noRuinsCheckbox.isChecked
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
add(noRuinsCheckbox).colspan(2).row()
|
add(noRuinsCheckbox).colspan(2).row()
|
||||||
|
@ -86,32 +89,32 @@ class NewGameScreenOptionsTable(val newGameParameters: GameParameters, val rules
|
||||||
private fun addMapTypeSizeAndFile() {
|
private fun addMapTypeSizeAndFile() {
|
||||||
add("{Map type}:".tr())
|
add("{Map type}:".tr())
|
||||||
val mapTypes = arrayListOf(MapType.default,MapType.continents,MapType.perlin,MapType.pangaea)
|
val mapTypes = arrayListOf(MapType.default,MapType.continents,MapType.perlin,MapType.pangaea)
|
||||||
if(MapSaver().getMaps().isNotEmpty()) mapTypes.add(MapType.file)
|
if(MapSaver().getMaps().isNotEmpty()) mapTypes.add(MapType.custom)
|
||||||
|
|
||||||
val mapFileLabel = "{Map file}:".toLabel()
|
val mapFileLabel = "{Map file}:".toLabel()
|
||||||
val mapFileSelectBox = getMapFileSelectBox()
|
val mapFileSelectBox = getMapFileSelectBox()
|
||||||
mapFileLabel.isVisible = false
|
mapFileLabel.isVisible = false
|
||||||
mapFileSelectBox.isVisible = false
|
mapFileSelectBox.isVisible = false
|
||||||
|
|
||||||
val mapTypeSelectBox = TranslatedSelectBox(mapTypes, newGameParameters.mapType, CameraStageBaseScreen.skin)
|
val mapTypeSelectBox = TranslatedSelectBox(mapTypes, mapParameters.type, CameraStageBaseScreen.skin)
|
||||||
|
|
||||||
val worldSizeSelectBox = getWorldSizeSelectBox()
|
val worldSizeSelectBox = getWorldSizeSelectBox()
|
||||||
val worldSizeLabel = "{World size}:".toLabel()
|
val worldSizeLabel = "{World size}:".toLabel()
|
||||||
|
|
||||||
fun updateOnMapTypeChange(){
|
fun updateOnMapTypeChange(){
|
||||||
newGameParameters.mapType = mapTypeSelectBox.selected.value
|
mapParameters.type = mapTypeSelectBox.selected.value
|
||||||
if (newGameParameters.mapType == MapType.file) {
|
if (mapParameters.type == MapType.custom) {
|
||||||
worldSizeSelectBox.isVisible = false
|
worldSizeSelectBox.isVisible = false
|
||||||
worldSizeLabel.isVisible = false
|
worldSizeLabel.isVisible = false
|
||||||
mapFileSelectBox.isVisible = true
|
mapFileSelectBox.isVisible = true
|
||||||
mapFileLabel.isVisible = true
|
mapFileLabel.isVisible = true
|
||||||
newGameParameters.mapFileName = mapFileSelectBox.selected
|
mapParameters.name = mapFileSelectBox.selected
|
||||||
} else {
|
} else {
|
||||||
worldSizeSelectBox.isVisible = true
|
worldSizeSelectBox.isVisible = true
|
||||||
worldSizeLabel.isVisible = true
|
worldSizeLabel.isVisible = true
|
||||||
mapFileSelectBox.isVisible = false
|
mapFileSelectBox.isVisible = false
|
||||||
mapFileLabel.isVisible = false
|
mapFileLabel.isVisible = false
|
||||||
newGameParameters.mapFileName = null
|
mapParameters.name = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,10 +220,11 @@ class NewGameScreenOptionsTable(val newGameParameters: GameParameters, val rules
|
||||||
val mapNames = Array<String>()
|
val mapNames = Array<String>()
|
||||||
for (mapName in MapSaver().getMaps()) mapNames.add(mapName)
|
for (mapName in MapSaver().getMaps()) mapNames.add(mapName)
|
||||||
mapFileSelectBox.items = mapNames
|
mapFileSelectBox.items = mapNames
|
||||||
|
if (mapParameters.name in mapNames) mapFileSelectBox.selected = mapParameters.name
|
||||||
|
|
||||||
mapFileSelectBox.addListener(object : ChangeListener() {
|
mapFileSelectBox.addListener(object : ChangeListener() {
|
||||||
override fun changed(event: ChangeEvent?, actor: Actor?) {
|
override fun changed(event: ChangeEvent?, actor: Actor?) {
|
||||||
newGameParameters.mapFileName = mapFileSelectBox.selected!!
|
mapParameters.name = mapFileSelectBox.selected!!
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return mapFileSelectBox
|
return mapFileSelectBox
|
||||||
|
@ -234,12 +238,13 @@ class NewGameScreenOptionsTable(val newGameParameters: GameParameters, val rules
|
||||||
worldSizeToRadius["Large"] = 30
|
worldSizeToRadius["Large"] = 30
|
||||||
worldSizeToRadius["Huge"] = 40
|
worldSizeToRadius["Huge"] = 40
|
||||||
|
|
||||||
val currentWorldSizeName = worldSizeToRadius.entries.first { it.value == newGameParameters.mapRadius }.key
|
val currentWorldSizeName = worldSizeToRadius.entries
|
||||||
|
.first { it.value == mapParameters.radius }.key
|
||||||
val worldSizeSelectBox = TranslatedSelectBox(worldSizeToRadius.keys, currentWorldSizeName, CameraStageBaseScreen.skin)
|
val worldSizeSelectBox = TranslatedSelectBox(worldSizeToRadius.keys, currentWorldSizeName, CameraStageBaseScreen.skin)
|
||||||
|
|
||||||
worldSizeSelectBox.addListener(object : ChangeListener() {
|
worldSizeSelectBox.addListener(object : ChangeListener() {
|
||||||
override fun changed(event: ChangeEvent?, actor: Actor?) {
|
override fun changed(event: ChangeEvent?, actor: Actor?) {
|
||||||
newGameParameters.mapRadius = worldSizeToRadius[worldSizeSelectBox.selected.value]!!
|
mapParameters.radius = worldSizeToRadius[worldSizeSelectBox.selected.value]!!
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return worldSizeSelectBox
|
return worldSizeSelectBox
|
||||||
|
@ -251,7 +256,6 @@ class NewGameScreenOptionsTable(val newGameParameters: GameParameters, val rules
|
||||||
add("{Victory conditions}:".tr()).colspan(2).row()
|
add("{Victory conditions}:".tr()).colspan(2).row()
|
||||||
|
|
||||||
// Create a checkbox for each VictoryType existing
|
// Create a checkbox for each VictoryType existing
|
||||||
var i = 0
|
|
||||||
val modCheckboxTable = Table().apply { defaults().pad(10f) }
|
val modCheckboxTable = Table().apply { defaults().pad(10f) }
|
||||||
|
|
||||||
val mods = Gdx.files.local("mods")
|
val mods = Gdx.files.local("mods")
|
||||||
|
|
Loading…
Reference in a new issue