mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-28 21:58:54 +07:00
Highlight non-available wonders in tech picker (#9173)
* Show wonders in tech tree with a blue color and also show which wonders have already been built for technologies not yet researched with a red circle around them. * Only show red circle.
This commit is contained in:
@ -171,6 +171,12 @@ class PortraitBuilding(name: String, size: Float) : Portrait(Type.Building, name
|
||||
}
|
||||
}
|
||||
|
||||
class PortraitUnavailableWonderForTechTree(name: String, size: Float) : Portrait(Type.Building, name, size) {
|
||||
override fun getDefaultOuterBackgroundTint(): Color {
|
||||
return Color.RED
|
||||
}
|
||||
}
|
||||
|
||||
class PortraitUnique(name: String, size: Float) : Portrait(Type.Unique, name, size) {
|
||||
override fun getDefaultImageTint(): Color {
|
||||
return Color.BLACK
|
||||
|
@ -15,6 +15,7 @@ import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.components.Fonts
|
||||
import com.unciv.ui.components.extensions.center
|
||||
import com.unciv.ui.images.ImageGetter
|
||||
import com.unciv.ui.images.PortraitUnavailableWonderForTechTree
|
||||
import com.unciv.ui.screens.civilopediascreen.FormattedLine
|
||||
import com.unciv.ui.screens.civilopediascreen.ICivilopediaText
|
||||
import com.unciv.ui.screens.pickerscreens.TechButton
|
||||
@ -91,7 +92,24 @@ object TechnologyDescriptions {
|
||||
}
|
||||
|
||||
for (building in getEnabledBuildings(techName, ruleset, viewingCiv)) {
|
||||
yield(ImageGetter.getConstructionPortrait(building.name, techIconSize))
|
||||
// We don't need to show the unavailable marker for techs that are already researched
|
||||
// since this is mostly a feature to choose which technologies to research.
|
||||
if (building.isWonder && !viewingCiv.tech.isResearched(techName)) {
|
||||
val isAlreadyBuilt = viewingCiv.gameInfo.getCities()
|
||||
// This is theoretically not necessary since we already checked the viewingCiv
|
||||
// doesn't have the tech, so it can't have this built anyways. It should be a
|
||||
// little more performant though to add this filter.
|
||||
.filter{ it.civ != viewingCiv }
|
||||
.any { it.cityConstructions.builtBuildings.contains(building.name) }
|
||||
val wonderConstructionPortrait =
|
||||
if (isAlreadyBuilt)
|
||||
PortraitUnavailableWonderForTechTree(building.name, techIconSize)
|
||||
else
|
||||
ImageGetter.getConstructionPortrait(building.name, techIconSize)
|
||||
yield(wonderConstructionPortrait)
|
||||
} else {
|
||||
yield(ImageGetter.getConstructionPortrait(building.name, techIconSize))
|
||||
}
|
||||
}
|
||||
|
||||
yieldAll(
|
||||
|
Reference in New Issue
Block a user