mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 06:51:30 -04:00
Added "No barbarians" starting option - part of #559
This commit is contained in:
parent
ccb9950187
commit
0539890a4d
@ -20,6 +20,7 @@ class GameParameters{
|
|||||||
var humanNations=ArrayList<String>().apply { add("Babylon") }
|
var humanNations=ArrayList<String>().apply { add("Babylon") }
|
||||||
var numberOfEnemies=3
|
var numberOfEnemies=3
|
||||||
var mapType= MapType.Perlin
|
var mapType= MapType.Perlin
|
||||||
|
var noBarbarians=false
|
||||||
var mapFileName :String?=null
|
var mapFileName :String?=null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class GameInfo {
|
|||||||
currentPlayerIndex = (currentPlayerIndex+1) % civilizations.size
|
currentPlayerIndex = (currentPlayerIndex+1) % civilizations.size
|
||||||
if(currentPlayerIndex==0){
|
if(currentPlayerIndex==0){
|
||||||
turns++
|
turns++
|
||||||
if (turns % 10 == 0) { // every 10 turns add a barbarian in a random place
|
if (turns % 10 == 0 && !gameParameters.noBarbarians) { // every 10 turns add a barbarian in a random place
|
||||||
placeBarbarianUnit(null)
|
placeBarbarianUnit(null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,7 @@ package com.unciv.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.Gdx
|
import com.badlogic.gdx.Gdx
|
||||||
import com.badlogic.gdx.scenes.scene2d.Actor
|
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
|
import com.badlogic.gdx.scenes.scene2d.ui.*
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin
|
|
||||||
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.GameStarter
|
import com.unciv.GameStarter
|
||||||
@ -80,6 +77,16 @@ class NewGameScreen: PickerScreen(){
|
|||||||
|
|
||||||
addDifficultySelectBox(newGameOptionsTable)
|
addDifficultySelectBox(newGameOptionsTable)
|
||||||
|
|
||||||
|
val noBarbariansCheckbox = CheckBox("No barbarians",skin)
|
||||||
|
noBarbariansCheckbox.isChecked=newGameParameters.noBarbarians
|
||||||
|
noBarbariansCheckbox.addListener(object : ChangeListener() {
|
||||||
|
override fun changed(event: ChangeEvent?, actor: Actor?) {
|
||||||
|
newGameParameters.noBarbarians = noBarbariansCheckbox.isChecked
|
||||||
|
}
|
||||||
|
})
|
||||||
|
newGameOptionsTable.add(noBarbariansCheckbox).colspan(2).row()
|
||||||
|
|
||||||
|
|
||||||
rightSideButton.enable()
|
rightSideButton.enable()
|
||||||
rightSideButton.setText("Start game!".tr())
|
rightSideButton.setText("Start game!".tr())
|
||||||
rightSideButton.onClick {
|
rightSideButton.onClick {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user