mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-22 13:49:54 +07:00
Civilopedia - Tweaks (#4990)
- Icon for BeliefType.Founder - Religion icons inverted in Civilopedia - Terrain icons in links and entry header centered
This commit is contained in:
@ -2,6 +2,7 @@ package com.unciv.ui.civilopedia
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Container
|
||||
import com.unciv.Constants
|
||||
import com.unciv.logic.map.TileInfo
|
||||
import com.unciv.models.ruleset.Ruleset
|
||||
@ -42,7 +43,7 @@ object CivilopediaImageGetters {
|
||||
group.showEntireMap = true
|
||||
group.forMapEditorIcon = true
|
||||
group.update()
|
||||
return group
|
||||
return Container(group)
|
||||
}
|
||||
|
||||
val construction = { name: String, size: Float ->
|
||||
@ -77,10 +78,19 @@ object CivilopediaImageGetters {
|
||||
}
|
||||
val belief = { name: String, size: Float ->
|
||||
// Kludge until we decide how exactly to show Religions
|
||||
if (ImageGetter.imageExists("ReligionIcons/$name")) {
|
||||
ImageGetter.getCircledReligionIcon(name, size)
|
||||
fun getInvertedCircledReligionIcon(iconName: String, size: Float) =
|
||||
ImageGetter.getCircledReligionIcon(iconName, size).apply {
|
||||
circle.color = Color.WHITE
|
||||
actor.color = Color.BLACK
|
||||
}
|
||||
if (ImageGetter.religionIconExists(name)) {
|
||||
getInvertedCircledReligionIcon(name, size)
|
||||
} else {
|
||||
val typeName = ImageGetter.ruleset.beliefs[name]?.type?.name
|
||||
if (typeName != null && ImageGetter.religionIconExists(typeName))
|
||||
getInvertedCircledReligionIcon(typeName, size)
|
||||
else null
|
||||
}
|
||||
else null
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -303,13 +303,7 @@ class FormattedLine (
|
||||
val parts = iconToDisplay.split('/', limit = 2)
|
||||
if (parts.size != 2) return 0
|
||||
val category = CivilopediaCategories.fromLink(parts[0]) ?: return 0
|
||||
if (category.getImage == null) return 0
|
||||
|
||||
// That Enum custom property is a nullable reference to a lambda which
|
||||
// in turn is allowed to return null. Sorry, but without `!!` the code
|
||||
// won't compile and with we would get the incorrect warning.
|
||||
@Suppress("UNNECESSARY_NOT_NULL_ASSERTION")
|
||||
val image = category.getImage!!(parts[1], iconSize) ?: return 0
|
||||
val image = category.getImage?.invoke(parts[1], iconSize) ?: return 0
|
||||
|
||||
table.add(image).size(iconSize).padRight(iconPad)
|
||||
return 1
|
||||
|
Reference in New Issue
Block a user