mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-12 10:59:55 +07:00
Resolved #2642 - added difficulty settings to Civilopedia
No translations yet
This commit is contained in:
parent
d81507ef2d
commit
4b405ecc61
@ -1,7 +1,9 @@
|
||||
package com.unciv.models.ruleset
|
||||
|
||||
import com.unciv.models.stats.INamed
|
||||
import com.unciv.models.translations.tr
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
class Difficulty: INamed {
|
||||
override lateinit var name: String
|
||||
@ -13,6 +15,7 @@ class Difficulty: INamed {
|
||||
var policyCostModifier:Float = 1f
|
||||
var unhappinessModifier:Float = 1f
|
||||
var barbarianBonus:Float = 0f
|
||||
|
||||
var aiCityGrowthModifier:Float = 1f
|
||||
var aiUnitCostModifier:Float = 1f
|
||||
var aiBuildingCostModifier:Float = 1f
|
||||
@ -25,4 +28,36 @@ class Difficulty: INamed {
|
||||
var aisExchangeTechs = false
|
||||
var turnBarbariansCanEnterPlayerTiles = 0
|
||||
var clearBarbarianCampReward = 25
|
||||
|
||||
|
||||
fun getDescription(): String {
|
||||
val lines = ArrayList<String>()
|
||||
lines += "Player settings"
|
||||
lines += " - {Base Happiness}: $baseHappiness"
|
||||
lines += " - {Happiness per luxury}: $extraHappinessPerLuxury"
|
||||
lines += " - {Research cost modifier}: $researchCostModifier"
|
||||
lines += " - {Unit cost modifier}: $researchCostModifier"
|
||||
lines += " - {Building cost modifier}: $buildingCostModifier"
|
||||
lines += " - {Policy cost modifier}: $policyCostModifier"
|
||||
lines += " - {Unhappiness modifier}: $unhappinessModifier"
|
||||
lines += " - {Bonus vs. Barbarians}: $barbarianBonus"
|
||||
lines += ""
|
||||
lines += "AI settings"
|
||||
lines += " - {AI city growth modifier}: $aiCityGrowthModifier"
|
||||
lines += " - {AI unit cost modifier}: $aiUnitCostModifier"
|
||||
lines += " - {AI building cost modifier}: $aiBuildingCostModifier"
|
||||
lines += " - {AI wonder cost modifier}: $aiWonderCostModifier"
|
||||
lines += " - {AI building maintenance modifier}: $aiBuildingMaintenanceModifier"
|
||||
lines += " - {AI unit maintenance modifier}: $aiUnitMaintenanceModifier"
|
||||
// lines += " - {AI free techs}: $aiFreeTechs"
|
||||
// lines += " - {AI free units}: $aiFreeUnits"
|
||||
lines += " - {AI unhappiness modifier}: $aiUnhappinessModifier"
|
||||
lines += " - {AIs exchange techs}: $aisExchangeTechs"
|
||||
lines += ""
|
||||
lines += "{Turns until barbarians enter player tiles}: $turnBarbariansCanEnterPlayerTiles"
|
||||
lines += "{Gold reward for clearing barbarian camps}: $clearBarbarianCampReward"
|
||||
|
||||
return lines.joinToString("\n") { it.tr() }
|
||||
}
|
||||
|
||||
}
|
@ -46,8 +46,6 @@ class CivilopediaScreen(ruleset: Ruleset) : CameraStageBaseScreen() {
|
||||
init {
|
||||
onBackButtonClicked { UncivGame.Current.setWorldScreen() }
|
||||
|
||||
val tileSetStrings = TileSetStrings()
|
||||
|
||||
categoryToEntries["Buildings"] = ruleset.buildings.values
|
||||
.map { CivilopediaEntry(it.name,it.getDescription(false, null,ruleset),
|
||||
ImageGetter.getConstructionImage(it.name)) }
|
||||
@ -56,7 +54,7 @@ class CivilopediaScreen(ruleset: Ruleset) : CameraStageBaseScreen() {
|
||||
ImageGetter.getResourceImage(it.name,50f)) }
|
||||
categoryToEntries["Terrains"] = ruleset.terrains.values
|
||||
.map { CivilopediaEntry(it.name,it.getDescription(ruleset),
|
||||
terrainImage(it, ruleset, tileSetStrings) ) }
|
||||
terrainImage(it, ruleset) ) }
|
||||
categoryToEntries["Tile Improvements"] = ruleset.tileImprovements.values
|
||||
.map { CivilopediaEntry(it.name,it.getDescription(ruleset,false),
|
||||
ImageGetter.getImprovementIcon(it.name,50f)) }
|
||||
@ -77,6 +75,9 @@ class CivilopediaScreen(ruleset: Ruleset) : CameraStageBaseScreen() {
|
||||
categoryToEntries["Tutorials"] = tutorialController.getCivilopediaTutorials()
|
||||
.map { CivilopediaEntry(it.key.replace("_"," "), it.value.joinToString("\n\n") { line -> line.tr() }) }
|
||||
|
||||
categoryToEntries["Difficulty levels"] = ruleset.difficulties.values
|
||||
.map { CivilopediaEntry(it.name, it.getDescription()) }
|
||||
|
||||
val buttonTable = Table()
|
||||
buttonTable.pad(15f)
|
||||
buttonTable.defaults().pad(10f)
|
||||
@ -92,6 +93,7 @@ class CivilopediaScreen(ruleset: Ruleset) : CameraStageBaseScreen() {
|
||||
buttonTable.pack()
|
||||
buttonTable.width = stage.width
|
||||
val buttonTableScroll = ScrollPane(buttonTable)
|
||||
buttonTableScroll.setScrollingDisabled(false, true)
|
||||
|
||||
val goToGameButton = Constants.close.toTextButton()
|
||||
goToGameButton.onClick {
|
||||
@ -103,7 +105,6 @@ class CivilopediaScreen(ruleset: Ruleset) : CameraStageBaseScreen() {
|
||||
topTable.add(goToGameButton).pad(10f)
|
||||
topTable.add(buttonTableScroll)
|
||||
topTable.pack()
|
||||
//buttonTable.height = topTable.height
|
||||
|
||||
val entryTable = Table()
|
||||
val splitPane = SplitPane(topTable, entryTable, true, skin)
|
||||
@ -130,7 +131,7 @@ class CivilopediaScreen(ruleset: Ruleset) : CameraStageBaseScreen() {
|
||||
select("Tutorials")
|
||||
}
|
||||
|
||||
private fun terrainImage (terrain: Terrain, ruleset: Ruleset, tileSetStrings: TileSetStrings ): Actor? {
|
||||
private fun terrainImage (terrain: Terrain, ruleset: Ruleset): Actor? {
|
||||
val tileInfo = TileInfo()
|
||||
tileInfo.ruleset = ruleset
|
||||
when(terrain.type) {
|
||||
@ -151,11 +152,6 @@ class CivilopediaScreen(ruleset: Ruleset) : CameraStageBaseScreen() {
|
||||
group.forMapEditorIcon = true
|
||||
group.update()
|
||||
return group
|
||||
// val wrapper = Table()
|
||||
// wrapper.add(group).pad(24f)
|
||||
// wrapper.pad(2f,24f,2f,24f)
|
||||
// wrapper.debug = true
|
||||
// return wrapper
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user