mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-26 21:35:14 -04:00
More ruleSet-shouldnt-come-from-static fixes
This commit is contained in:
parent
51a0d7727a
commit
b9487c1800
@ -4,11 +4,12 @@ import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.*
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.models.gamebasics.RuleSet
|
||||
import com.unciv.models.gamebasics.tr
|
||||
import com.unciv.ui.utils.*
|
||||
import java.util.*
|
||||
|
||||
class CivilopediaScreen : CameraStageBaseScreen() {
|
||||
class CivilopediaScreen(ruleSet: RuleSet) : CameraStageBaseScreen() {
|
||||
class CivilopediaEntry {
|
||||
var name: String
|
||||
var description: String
|
||||
@ -70,24 +71,23 @@ class CivilopediaScreen : CameraStageBaseScreen() {
|
||||
val basicHelpFileName = if(Gdx.files.internal("jsons/BasicHelp/BasicHelp_$language.json").exists())"BasicHelp/BasicHelp_$language"
|
||||
else "BasicHelp/BasicHelp"
|
||||
|
||||
val gameBasics = game.ruleSet
|
||||
categoryToEntries["Basics"] = gameBasics.getFromJson(Array<CivilopediaEntry>::class.java, basicHelpFileName).toList()
|
||||
categoryToEntries["Buildings"] = gameBasics.Buildings.values
|
||||
.map { CivilopediaEntry(it.name,it.getDescription(false, null,gameBasics),
|
||||
categoryToEntries["Basics"] = ruleSet.getFromJson(Array<CivilopediaEntry>::class.java, basicHelpFileName).toList()
|
||||
categoryToEntries["Buildings"] = ruleSet.Buildings.values
|
||||
.map { CivilopediaEntry(it.name,it.getDescription(false, null,ruleSet),
|
||||
ImageGetter.getConstructionImage(it.name)) }
|
||||
categoryToEntries["Resources"] = gameBasics.TileResources.values
|
||||
categoryToEntries["Resources"] = ruleSet.TileResources.values
|
||||
.map { CivilopediaEntry(it.name,it.getDescription(),
|
||||
ImageGetter.getResourceImage(it.name,50f)) }
|
||||
categoryToEntries["Terrains"] = gameBasics.Terrains.values
|
||||
.map { CivilopediaEntry(it.name,it.getDescription(gameBasics)) }
|
||||
categoryToEntries["Tile Improvements"] = gameBasics.TileImprovements.values
|
||||
.map { CivilopediaEntry(it.name,it.getDescription(gameBasics),
|
||||
categoryToEntries["Terrains"] = ruleSet.Terrains.values
|
||||
.map { CivilopediaEntry(it.name,it.getDescription(ruleSet)) }
|
||||
categoryToEntries["Tile Improvements"] = ruleSet.TileImprovements.values
|
||||
.map { CivilopediaEntry(it.name,it.getDescription(ruleSet),
|
||||
ImageGetter.getImprovementIcon(it.name,50f)) }
|
||||
categoryToEntries["Units"] = gameBasics.Units.values
|
||||
categoryToEntries["Units"] = ruleSet.Units.values
|
||||
.map { CivilopediaEntry(it.name,it.getDescription(false),
|
||||
ImageGetter.getConstructionImage(it.name)) }
|
||||
categoryToEntries["Technologies"] = gameBasics.Technologies.values
|
||||
.map { CivilopediaEntry(it.name,it.getDescription(gameBasics),
|
||||
categoryToEntries["Technologies"] = ruleSet.Technologies.values
|
||||
.map { CivilopediaEntry(it.name,it.getDescription(ruleSet),
|
||||
ImageGetter.getTechIconGroup(it.name,50f)) }
|
||||
|
||||
categoryToEntries["Tutorials"] = Tutorials().getTutorialsOfLanguage("English").keys
|
||||
|
@ -3,17 +3,18 @@ package com.unciv.ui
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.scenes.scene2d.Touchable
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.models.gamebasics.RuleSet
|
||||
import com.unciv.models.gamebasics.tr
|
||||
import com.unciv.ui.pickerscreens.PickerScreen
|
||||
import com.unciv.ui.utils.ImageGetter
|
||||
import com.unciv.ui.utils.enable
|
||||
import com.unciv.ui.utils.onClick
|
||||
import com.unciv.ui.utils.toLabel
|
||||
|
||||
|
||||
class LanguageTable(val language:String,skin: Skin):Table(skin){
|
||||
class LanguageTable(val language:String, ruleSet: RuleSet):Table(){
|
||||
private val blue = ImageGetter.getBlue()
|
||||
private val darkBlue = blue.cpy().lerp(Color.BLACK,0.5f)!!
|
||||
val percentComplete: Int
|
||||
@ -23,14 +24,14 @@ class LanguageTable(val language:String,skin: Skin):Table(skin){
|
||||
defaults().pad(10f)
|
||||
if(ImageGetter.imageExists("FlagIcons/$language"))
|
||||
add(ImageGetter.getImage("FlagIcons/$language")).size(40f)
|
||||
val translations = UncivGame.Current.ruleSet.Translations
|
||||
val translations = ruleSet.Translations
|
||||
val availableTranslations = translations.filter { it.value.containsKey(language) }
|
||||
|
||||
if(language=="English") percentComplete = 100
|
||||
else percentComplete = (availableTranslations.size*100 / translations.size) - 5
|
||||
|
||||
val spaceSplitLang = language.replace("_"," ")
|
||||
add("$spaceSplitLang ($percentComplete%)")
|
||||
add("$spaceSplitLang ($percentComplete%)".toLabel())
|
||||
update("")
|
||||
touchable = Touchable.enabled // so click listener is activated when any part is clicked, not only children
|
||||
pack()
|
||||
@ -60,7 +61,8 @@ class LanguagePickerScreen: PickerScreen(){
|
||||
"If you want to help translating the game into your language, \n"+
|
||||
" instructions are in the Github readme! (Menu > Community > Github)",skin)).pad(10f).row()
|
||||
|
||||
languageTables.addAll(UncivGame.Current.ruleSet.Translations.getLanguages().map { LanguageTable(it,skin) }
|
||||
val ruleSet = UncivGame.Current.ruleSet
|
||||
languageTables.addAll(ruleSet.Translations.getLanguages().map { LanguageTable(it,ruleSet) }
|
||||
.sortedByDescending { it.percentComplete } )
|
||||
|
||||
languageTables.forEach {
|
||||
|
@ -3,6 +3,7 @@ package com.unciv.ui.mapeditor
|
||||
import com.badlogic.gdx.scenes.scene2d.actions.Actions
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.logic.MapSaver
|
||||
import com.unciv.logic.map.TileMap
|
||||
import com.unciv.models.gamebasics.tr
|
||||
@ -17,8 +18,9 @@ class MapEditorScreen(): CameraStageBaseScreen(){
|
||||
var tileMap = TileMap()
|
||||
var mapName = "My first map"
|
||||
lateinit var mapHolder: TileGroupMap<TileGroup>
|
||||
private val tileEditorOptions = TileEditorOptionsTable(this)
|
||||
private val showHideEditorOptionsButton = TextButton(">",skin)
|
||||
val ruleSet = UncivGame.Current.ruleSet
|
||||
private val tileEditorOptions = TileEditorOptionsTable(this)
|
||||
|
||||
constructor(mapNameToLoad:String?):this(){
|
||||
var mapToLoad = mapNameToLoad
|
||||
@ -40,7 +42,7 @@ class MapEditorScreen(): CameraStageBaseScreen(){
|
||||
}
|
||||
|
||||
fun initialize() {
|
||||
tileMap.setTransients(game.ruleSet)
|
||||
tileMap.setTransients(ruleSet)
|
||||
val mapHolder = getMapHolder(tileMap)
|
||||
|
||||
stage.addActor(mapHolder)
|
||||
|
@ -39,7 +39,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
|
||||
|
||||
private var currentHex: Actor = Group()
|
||||
|
||||
val gameBasics = UncivGame.Current.ruleSet
|
||||
val ruleSet = mapEditorScreen.ruleSet
|
||||
|
||||
init{
|
||||
height=mapEditorScreen.stage.height
|
||||
@ -74,7 +74,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
|
||||
}
|
||||
}).row()
|
||||
|
||||
for(improvement in gameBasics.TileImprovements.values){
|
||||
for(improvement in ruleSet.TileImprovements.values){
|
||||
if(improvement.name.startsWith("Remove")) continue
|
||||
val improvementImage = getHex(Color.WHITE,ImageGetter.getImprovementIcon(improvement.name,40f))
|
||||
improvementImage.onClick {
|
||||
@ -88,7 +88,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
|
||||
editorPickTable.add(ScrollPane(improvementsTable)).height(mapEditorScreen.stage.height*0.7f)
|
||||
|
||||
val nationsTable = Table()
|
||||
for(nation in gameBasics.Nations.values){
|
||||
for(nation in ruleSet.Nations.values){
|
||||
val nationImage = getHex(Color.WHITE,ImageGetter.getNationIndicator(nation,40f))
|
||||
nationImage.onClick {
|
||||
clearSelection()
|
||||
@ -151,16 +151,16 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
|
||||
}
|
||||
})
|
||||
|
||||
for (resource in gameBasics.TileResources.values) {
|
||||
for (resource in ruleSet.TileResources.values) {
|
||||
val resourceHex = getHex(Color.WHITE, ImageGetter.getResourceImage(resource.name, 40f))
|
||||
resourceHex.onClick {
|
||||
clearSelection()
|
||||
selectedResource = resource
|
||||
val tileInfo = TileInfo()
|
||||
tileInfo.ruleSet = UncivGame.Current.ruleSet
|
||||
tileInfo.ruleSet = mapEditorScreen.ruleSet
|
||||
|
||||
val terrain = resource.terrainsCanBeFoundOn.first()
|
||||
val terrainObject = gameBasics.Terrains[terrain]!!
|
||||
val terrainObject = ruleSet.Terrains[terrain]!!
|
||||
if (terrainObject.type == TerrainType.TerrainFeature) {
|
||||
tileInfo.baseTerrain = when {
|
||||
terrainObject.occursOn == null -> terrainObject.occursOn!!.first()
|
||||
@ -179,9 +179,9 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
|
||||
}
|
||||
|
||||
private fun addTerrainOptions(terrainFeaturesTable: Table, baseTerrainTable: Table) {
|
||||
for (terrain in gameBasics.Terrains.values) {
|
||||
for (terrain in ruleSet.Terrains.values) {
|
||||
val tileInfo = TileInfo()
|
||||
tileInfo.ruleSet = UncivGame.Current.ruleSet
|
||||
tileInfo.ruleSet = mapEditorScreen.ruleSet
|
||||
if (terrain.type == TerrainType.TerrainFeature) {
|
||||
tileInfo.baseTerrain = when {
|
||||
terrain.occursOn != null -> terrain.occursOn.first()
|
||||
|
@ -23,12 +23,13 @@ import kotlin.concurrent.thread
|
||||
class NewGameScreen: PickerScreen(){
|
||||
|
||||
val newGameParameters= UncivGame.Current.gameInfo.gameParameters
|
||||
val ruleSet = UncivGame.Current.ruleSet
|
||||
|
||||
init {
|
||||
setDefaultCloseAction()
|
||||
|
||||
val playerPickerTable = PlayerPickerTable(this, newGameParameters)
|
||||
topTable.add(NewGameScreenOptionsTable(newGameParameters) { playerPickerTable.update() })
|
||||
topTable.add(NewGameScreenOptionsTable(newGameParameters,ruleSet) { playerPickerTable.update() })
|
||||
topTable.add(playerPickerTable).pad(10f)
|
||||
topTable.pack()
|
||||
topTable.setFillParent(true)
|
||||
|
@ -6,9 +6,9 @@ import com.badlogic.gdx.scenes.scene2d.ui.SelectBox
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener
|
||||
import com.badlogic.gdx.utils.Array
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.logic.MapSaver
|
||||
import com.unciv.logic.map.MapType
|
||||
import com.unciv.models.gamebasics.RuleSet
|
||||
import com.unciv.models.gamebasics.VictoryType
|
||||
import com.unciv.models.gamebasics.tech.TechEra
|
||||
import com.unciv.models.gamebasics.tr
|
||||
@ -17,7 +17,7 @@ import com.unciv.models.metadata.GameSpeed
|
||||
import com.unciv.ui.utils.CameraStageBaseScreen
|
||||
import com.unciv.ui.utils.toLabel
|
||||
|
||||
class NewGameScreenOptionsTable(val newGameParameters: GameParameters, val onMultiplayerToggled:()->Unit)
|
||||
class NewGameScreenOptionsTable(val newGameParameters: GameParameters, val ruleSet: RuleSet, val onMultiplayerToggled:()->Unit)
|
||||
: Table(CameraStageBaseScreen.skin){
|
||||
init{
|
||||
addMapTypeSizeAndFile()
|
||||
@ -128,7 +128,7 @@ class NewGameScreenOptionsTable(val newGameParameters: GameParameters, val onMul
|
||||
val cityStatesSelectBox = SelectBox<Int>(CameraStageBaseScreen.skin)
|
||||
val cityStatesArray = Array<Int>()
|
||||
|
||||
(0..UncivGame.Current.ruleSet.Nations.filter { it.value.isCityState() }.size).forEach { cityStatesArray.add(it) }
|
||||
(0..ruleSet.Nations.filter { it.value.isCityState() }.size).forEach { cityStatesArray.add(it) }
|
||||
cityStatesSelectBox.items = cityStatesArray
|
||||
cityStatesSelectBox.selected = newGameParameters.numberOfCityStates
|
||||
add(cityStatesSelectBox).pad(10f).row()
|
||||
@ -141,7 +141,7 @@ class NewGameScreenOptionsTable(val newGameParameters: GameParameters, val onMul
|
||||
|
||||
private fun addDifficultySelectBox() {
|
||||
add("{Difficulty}:".tr())
|
||||
val difficultySelectBox = TranslatedSelectBox(UncivGame.Current.ruleSet.Difficulties.keys, newGameParameters.difficulty, CameraStageBaseScreen.skin)
|
||||
val difficultySelectBox = TranslatedSelectBox(ruleSet.Difficulties.keys, newGameParameters.difficulty, CameraStageBaseScreen.skin)
|
||||
difficultySelectBox.addListener(object : ChangeListener() {
|
||||
override fun changed(event: ChangeEvent?, actor: Actor?) {
|
||||
newGameParameters.difficulty = difficultySelectBox.selected.value
|
||||
|
@ -30,7 +30,7 @@ class PlayerPickerTable(val newGameScreen: NewGameScreen, val newGameParameters:
|
||||
|
||||
fun update() {
|
||||
playerListTable.clear()
|
||||
val gameBasics = UncivGame.Current.ruleSet // when we add mods, this will need to change
|
||||
val gameBasics = newGameScreen.ruleSet // when we add mods, this will need to change
|
||||
for (player in newGameParameters.players)
|
||||
playerListTable.add(getPlayerTable(player,gameBasics)).pad(10f).row()
|
||||
if(newGameParameters.players.count() < gameBasics.Nations.values.count { it.isMajorCiv() }) {
|
||||
@ -44,7 +44,7 @@ class PlayerPickerTable(val newGameScreen: NewGameScreen, val newGameParameters:
|
||||
playerTable.pad(20f)
|
||||
playerTable.background = ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK, 0.8f))
|
||||
|
||||
val nationTable = getNationTable(player,ruleSet)
|
||||
val nationTable = getNationTable(player)
|
||||
playerTable.add(nationTable)
|
||||
|
||||
val playerTypeTextbutton = TextButton(player.playerType.name, CameraStageBaseScreen.skin)
|
||||
@ -102,22 +102,22 @@ class PlayerPickerTable(val newGameScreen: NewGameScreen, val newGameParameters:
|
||||
return playerTable
|
||||
}
|
||||
|
||||
private fun getNationTable(player: Player, ruleSet: RuleSet): Table {
|
||||
private fun getNationTable(player: Player): Table {
|
||||
val nationTable = Table()
|
||||
val nationImage = if (player.chosenCiv == "Random") "?".toLabel(Color.BLACK,30)
|
||||
.apply { this.setAlignment(Align.center) }
|
||||
.surroundWithCircle(50f)
|
||||
else ImageGetter.getNationIndicator(ruleSet.Nations[player.chosenCiv]!!, 50f)
|
||||
else ImageGetter.getNationIndicator(newGameScreen.ruleSet.Nations[player.chosenCiv]!!, 50f)
|
||||
nationTable.add(nationImage)
|
||||
nationTable.add(player.chosenCiv.toLabel()).pad(20f)
|
||||
nationTable.touchable = Touchable.enabled
|
||||
nationTable.onClick {
|
||||
popupNationPicker(player,ruleSet)
|
||||
popupNationPicker(player)
|
||||
}
|
||||
return nationTable
|
||||
}
|
||||
|
||||
private fun popupNationPicker(player: Player, ruleSet: RuleSet) {
|
||||
private fun popupNationPicker(player: Player) {
|
||||
val nationsPopup = PopupTable(newGameScreen)
|
||||
val nationListTable = Table()
|
||||
|
||||
@ -137,11 +137,11 @@ class PlayerPickerTable(val newGameScreen: NewGameScreen, val newGameParameters:
|
||||
nationListTable.add(randomPlayerTable).pad(10f).width(halfWidth).row()
|
||||
|
||||
|
||||
for (nation in ruleSet.Nations.values.filter { !it.isCityState() && it.name != "Barbarians" }) {
|
||||
for (nation in newGameScreen.ruleSet.Nations.values.filter { !it.isCityState() && it.name != "Barbarians" }) {
|
||||
if (player.chosenCiv != nation.name && newGameParameters.players.any { it.chosenCiv == nation.name })
|
||||
continue
|
||||
|
||||
nationListTable.add(NationTable(nation, halfWidth,ruleSet).onClick {
|
||||
nationListTable.add(NationTable(nation, halfWidth,newGameScreen.ruleSet).onClick {
|
||||
player.chosenCiv = nation.name
|
||||
nationsPopup.close()
|
||||
update()
|
||||
|
@ -2,6 +2,7 @@ package com.unciv.ui.pickerscreens
|
||||
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Button
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.logic.civilization.CivilizationInfo
|
||||
import com.unciv.logic.civilization.GreatPersonManager
|
||||
import com.unciv.models.gamebasics.tr
|
||||
import com.unciv.models.gamebasics.unit.BaseUnit
|
||||
@ -9,13 +10,13 @@ import com.unciv.ui.utils.ImageGetter
|
||||
import com.unciv.ui.utils.onClick
|
||||
import com.unciv.ui.utils.toLabel
|
||||
|
||||
class GreatPersonPickerScreen : PickerScreen() {
|
||||
class GreatPersonPickerScreen(val civInfo:CivilizationInfo) : PickerScreen() {
|
||||
private var theChosenOne: BaseUnit? = null
|
||||
|
||||
init {
|
||||
closeButton.isVisible=false
|
||||
rightSideButton.setText("Choose a free great person".tr())
|
||||
for (unit in game.ruleSet.Units.values
|
||||
for (unit in civInfo.gameInfo.ruleSet.Units.values
|
||||
.filter { it.name in GreatPersonManager().statToGreatPersonMapping.values || it.name == "Great General"})
|
||||
{
|
||||
val button = Button(skin)
|
||||
@ -34,9 +35,8 @@ class GreatPersonPickerScreen : PickerScreen() {
|
||||
}
|
||||
|
||||
rightSideButton.onClick("choir") {
|
||||
val currentPlayerCiv = UncivGame.Current.gameInfo.getCurrentPlayerCivilization()
|
||||
currentPlayerCiv.placeUnitNearTile(currentPlayerCiv.cities[0].location, theChosenOne!!.name)
|
||||
currentPlayerCiv.greatPeople.freeGreatPeople--
|
||||
civInfo.placeUnitNearTile(civInfo.cities[0].location, theChosenOne!!.name)
|
||||
civInfo.greatPeople.freeGreatPeople--
|
||||
UncivGame.Current.setWorldScreen()
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ class ImprovementPickerScreen(tileInfo: TileInfo, onAccept: ()->Unit) : PickerSc
|
||||
val regularImprovements = VerticalGroup()
|
||||
regularImprovements.space(10f)
|
||||
|
||||
for (improvement in game.ruleSet.TileImprovements.values) {
|
||||
for (improvement in tileInfo.tileMap.gameInfo.ruleSet.TileImprovements.values) {
|
||||
if (!tileInfo.canBuildImprovement(improvement, currentPlayerCiv)) continue
|
||||
if(improvement.name == tileInfo.improvement) continue
|
||||
if(improvement.name==tileInfo.improvementInProgress) continue
|
||||
@ -62,7 +62,8 @@ class ImprovementPickerScreen(tileInfo: TileInfo, onAccept: ()->Unit) : PickerSc
|
||||
group.onClick {
|
||||
selectedImprovement = improvement
|
||||
pick(improvement.name.tr())
|
||||
descriptionLabel.setText(improvement.getDescription(game.ruleSet))
|
||||
val ruleSet = tileInfo.tileMap.gameInfo.ruleSet
|
||||
descriptionLabel.setText(improvement.getDescription(ruleSet))
|
||||
}
|
||||
|
||||
val pickNow = "Pick now!".toLabel()
|
||||
|
@ -33,7 +33,7 @@ object ImageGetter {
|
||||
setTextureRegionDrawables()
|
||||
}
|
||||
|
||||
fun getGameBasics() = UncivGame.Current.ruleSet
|
||||
fun getRuleSet() = UncivGame.Current.ruleSet
|
||||
|
||||
fun setTextureRegionDrawables(){
|
||||
textureRegionDrawables.clear()
|
||||
@ -112,13 +112,13 @@ object ImageGetter {
|
||||
return getImage("OtherIcons/Stop")
|
||||
if(improvementName.startsWith("StartingLocation ")){
|
||||
val nationName = improvementName.removePrefix("StartingLocation ")
|
||||
val nation = getGameBasics().Nations[nationName]!!
|
||||
val nation = getRuleSet().Nations[nationName]!!
|
||||
return getNationIndicator(nation,size)
|
||||
}
|
||||
|
||||
val iconGroup = getImage("ImprovementIcons/$improvementName").surroundWithCircle(size)
|
||||
|
||||
val improvement = getGameBasics().TileImprovements[improvementName]!!
|
||||
val improvement = getRuleSet().TileImprovements[improvementName]!!
|
||||
when {
|
||||
improvement.food>0 -> iconGroup.circle.color= foodCircleColor
|
||||
improvement.production>0 -> iconGroup.circle.color= productionCircleColor
|
||||
@ -131,8 +131,8 @@ object ImageGetter {
|
||||
}
|
||||
|
||||
fun getConstructionImage(construction: String): Image {
|
||||
if(getGameBasics().Buildings.containsKey(construction)) return getImage("BuildingIcons/$construction")
|
||||
if(getGameBasics().Units.containsKey(construction)) return getUnitIcon(construction)
|
||||
if(getRuleSet().Buildings.containsKey(construction)) return getImage("BuildingIcons/$construction")
|
||||
if(getRuleSet().Units.containsKey(construction)) return getUnitIcon(construction)
|
||||
if(construction=="Nothing") return getImage("OtherIcons/Stop")
|
||||
return getStatIcon(construction)
|
||||
}
|
||||
@ -180,7 +180,7 @@ object ImageGetter {
|
||||
|
||||
fun getResourceImage(resourceName: String, size:Float): Actor {
|
||||
val iconGroup = getImage("ResourceIcons/$resourceName").surroundWithCircle(size)
|
||||
val resource = getGameBasics().TileResources[resourceName]!!
|
||||
val resource = getRuleSet().TileResources[resourceName]!!
|
||||
when {
|
||||
resource.food>0 -> iconGroup.circle.color= foodCircleColor
|
||||
resource.production>0 -> iconGroup.circle.color= productionCircleColor
|
||||
@ -204,7 +204,7 @@ object ImageGetter {
|
||||
|
||||
fun getTechIconGroup(techName: String, circleSize: Float): Group {
|
||||
var techIconColor = Color.WHITE
|
||||
when (getGameBasics().Technologies[techName]!!.era().name) {
|
||||
when (getRuleSet().Technologies[techName]!!.era().name) {
|
||||
"Ancient" -> techIconColor = colorFromRGB(255, 87, 35)
|
||||
"Classical" -> techIconColor = colorFromRGB(233, 31, 99)
|
||||
"Medieval" -> techIconColor = colorFromRGB(157, 39, 176)
|
||||
|
@ -188,7 +188,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
when {
|
||||
!gameInfo.oneMoreTurnMode && gameInfo.civilizations.any { it.victoryManager.hasWon() } -> game.setScreen(VictoryScreen())
|
||||
viewingCiv.policies.freePolicies > 0 && viewingCiv.policies.canAdoptPolicy() -> game.setScreen(PolicyPickerScreen(this))
|
||||
viewingCiv.greatPeople.freeGreatPeople > 0 -> game.setScreen(GreatPersonPickerScreen())
|
||||
viewingCiv.greatPeople.freeGreatPeople > 0 -> game.setScreen(GreatPersonPickerScreen(viewingCiv))
|
||||
viewingCiv.popupAlerts.any() -> AlertPopup(this, viewingCiv.popupAlerts.first())
|
||||
viewingCiv.tradeRequests.isNotEmpty() -> TradePopup(this)
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class WorldScreenMenuTable(val worldScreen: WorldScreen) : PopupTable(worldScree
|
||||
addSeparator()
|
||||
|
||||
addSquareButton("Civilopedia".tr()){
|
||||
UncivGame.Current.setScreen(CivilopediaScreen())
|
||||
UncivGame.Current.setScreen(CivilopediaScreen(worldScreen.gameInfo.ruleSet))
|
||||
remove()
|
||||
}.size(width,height)
|
||||
addSeparator()
|
||||
|
@ -16,9 +16,9 @@ import kotlin.concurrent.thread
|
||||
class Language(val language:String, ruleSet: RuleSet){
|
||||
val percentComplete:Int
|
||||
init{
|
||||
val availableTranslations = UncivGame.Current.ruleSet.Translations.count { it.value.containsKey(language) }
|
||||
val availableTranslations = ruleSet.Translations.count { it.value.containsKey(language) }
|
||||
if(language=="English") percentComplete = 100
|
||||
else percentComplete = (availableTranslations*100 / UncivGame.Current.ruleSet.Translations.size)
|
||||
else percentComplete = (availableTranslations*100 / ruleSet.Translations.size)
|
||||
}
|
||||
override fun toString(): String {
|
||||
val spaceSplitLang = language.replace("_"," ")
|
||||
@ -288,7 +288,7 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr
|
||||
val missingTextSelectBox = SelectBox<String>(skin)
|
||||
val missingTextArray = Array<String>()
|
||||
val currentLanguage = UncivGame.Current.settings.language
|
||||
UncivGame.Current.ruleSet.Translations.filter { !it.value.containsKey(currentLanguage) }
|
||||
ruleSet.Translations.filter { !it.value.containsKey(currentLanguage) }
|
||||
.forEach { missingTextArray.add(it.key) }
|
||||
missingTextSelectBox.items = missingTextArray
|
||||
missingTextSelectBox.selected = "Untranslated texts"
|
||||
|
Loading…
x
Reference in New Issue
Block a user