mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 22:06:05 -04:00
Clarify relation Oil well / Refrigeration a little (#5570)
This commit is contained in:
parent
ca1d070c81
commit
21d2f7b714
@ -92,6 +92,10 @@ class Technology: RulesetObject() {
|
|||||||
if (tileImprovements.isNotEmpty())
|
if (tileImprovements.isNotEmpty())
|
||||||
lineList += "{Tile improvements enabled}: " + tileImprovements.joinToString { it.name.tr() }
|
lineList += "{Tile improvements enabled}: " + tileImprovements.joinToString { it.name.tr() }
|
||||||
|
|
||||||
|
val seeAlsoObjects = getSeeAlsoObjects(ruleset)
|
||||||
|
if (seeAlsoObjects.any())
|
||||||
|
lineList += "{See also}: " + seeAlsoObjects.joinToString { it.name }
|
||||||
|
|
||||||
return lineList.joinToString("\n") { it.tr() }
|
return lineList.joinToString("\n") { it.tr() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,6 +149,17 @@ class Technology: RulesetObject() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Get improvements related to this tech by a unique */
|
||||||
|
private fun getSeeAlsoObjects(ruleset: Ruleset) =
|
||||||
|
// This is a band-aid to clarify the relation Offshore platform - Refrigeration. A generic variant
|
||||||
|
// covering all mentions in uniques in all ruleset objects would be possible here but - overkill for now.
|
||||||
|
ruleset.tileImprovements.values.asSequence()
|
||||||
|
.filter { improvement ->
|
||||||
|
improvement.getMatchingUniques(UniqueType.RequiresTechToBuildOnTile).any {
|
||||||
|
it.params[1] == name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun makeLink() = "Technology/$name"
|
override fun makeLink() = "Technology/$name"
|
||||||
|
|
||||||
@ -263,6 +278,15 @@ class Technology: RulesetObject() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val seeAlsoObjects = getSeeAlsoObjects(ruleset)
|
||||||
|
if (seeAlsoObjects.any()) {
|
||||||
|
lineList += FormattedLine()
|
||||||
|
lineList += FormattedLine("{See also}:")
|
||||||
|
seeAlsoObjects.forEach {
|
||||||
|
lineList += FormattedLine(it.name, link = it.makeLink())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return lineList
|
return lineList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,12 +12,18 @@ import com.unciv.logic.civilization.TechManager
|
|||||||
import com.unciv.models.UncivSound
|
import com.unciv.models.UncivSound
|
||||||
import com.unciv.models.ruleset.tech.Technology
|
import com.unciv.models.ruleset.tech.Technology
|
||||||
import com.unciv.models.translations.tr
|
import com.unciv.models.translations.tr
|
||||||
|
import com.unciv.ui.civilopedia.CivilopediaCategories
|
||||||
|
import com.unciv.ui.civilopedia.CivilopediaScreen
|
||||||
import com.unciv.ui.utils.*
|
import com.unciv.ui.utils.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
|
|
||||||
|
|
||||||
class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Technology? = null, private val freeTechPick: Boolean = false) : PickerScreen() {
|
class TechPickerScreen(
|
||||||
|
internal val civInfo: CivilizationInfo,
|
||||||
|
centerOnTech: Technology? = null,
|
||||||
|
private val freeTechPick: Boolean = false
|
||||||
|
) : PickerScreen() {
|
||||||
|
|
||||||
private var techNameToButton = HashMap<String, TechButton>()
|
private var techNameToButton = HashMap<String, TechButton>()
|
||||||
private var selectedTech: Technology? = null
|
private var selectedTech: Technology? = null
|
||||||
@ -50,6 +56,12 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec
|
|||||||
setDefaultCloseAction()
|
setDefaultCloseAction()
|
||||||
onBackButtonClicked { UncivGame.Current.setWorldScreen() }
|
onBackButtonClicked { UncivGame.Current.setWorldScreen() }
|
||||||
scrollPane.setOverscroll(false, false)
|
scrollPane.setOverscroll(false, false)
|
||||||
|
|
||||||
|
descriptionLabel.onClick {
|
||||||
|
if (selectedTech != null)
|
||||||
|
game.setScreen(CivilopediaScreen(civInfo.gameInfo.ruleSet, CivilopediaCategories.Technology, selectedTech!!.name))
|
||||||
|
}
|
||||||
|
|
||||||
tempTechsToResearch = ArrayList(civTech.techsToResearch)
|
tempTechsToResearch = ArrayList(civTech.techsToResearch)
|
||||||
|
|
||||||
createTechTable()
|
createTechTable()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user