mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-13 17:28:57 +07:00
Religion overview improved (#6303)
* Improve handling of Religion PickerScreen with long lists * Fix mouseover graying Labels bug * Update Pantheon chooser visuals * Some Color.lerp simplification * Religion pickers - Merge common stuff of Pantheon and Religion Pickers * Religion pickers - Linting * Religion pickers - Move ReligionOverviewTable extra lines capability to Belief, Fix FormattedLine link+center * Religion pickers - Belief Civilopedia linked description * Religion overview tweaked * Religion overview tweaked - patch1
This commit is contained in:
@ -1189,14 +1189,15 @@ Holy city of: [religionName] = Heilige Stadt von: [religionName]
|
|||||||
Pressure = Druck
|
Pressure = Druck
|
||||||
|
|
||||||
# Religion overview screen
|
# Religion overview screen
|
||||||
Religion Name: = Name der Religion
|
Religion Name: = Name der Religion:
|
||||||
|
Pantheon Name: = Name des Pantheon:
|
||||||
Founding Civ: = Gegründet von:
|
Founding Civ: = Gegründet von:
|
||||||
Holy City: = Heilige Stadt:
|
Holy City: = Heilige Stadt:
|
||||||
Cities following this religion: = Städte die dieser Religion folgen
|
Cities following this religion: = Städte die dieser Religion folgen
|
||||||
Click an icon to see the stats of this religion = Klicke auf ein Icon, um die Statistiken dieser Religion anzuzeigen
|
Click an icon to see the stats of this religion = Klicke auf ein Icon, um die Statistiken dieser Religion anzuzeigen
|
||||||
Religion: Off = Religion: Ausgeschaltet
|
Religion: Off = Religion: Aus
|
||||||
Minimal Faith required for\nthe next [Great Prophet]: = Mindest-Glaubenspunkte für\nden nächsten [Great Prophet]:
|
Minimal Faith required for\nthe next [Great Prophet]: = Mindest-Glaubenspunkte für\nden nächsten [Great Prophet]:
|
||||||
Religions to be founded: = Zu gründende Religionen:
|
Religions to be founded: = Noch zu gründende Religionen:
|
||||||
Religious status: = Religions-Status:
|
Religious status: = Religions-Status:
|
||||||
|
|
||||||
None = Keine
|
None = Keine
|
||||||
@ -4351,7 +4352,7 @@ Follower = Anhänger
|
|||||||
Asceticism = Askese
|
Asceticism = Askese
|
||||||
|
|
||||||
Cathedrals = Kathedralen
|
Cathedrals = Kathedralen
|
||||||
May buy [buildingFilter] buildings with [stat] [cityFilter] = Kann [buildingFilter] Gebäude mit [stat] [cityFilter] kaufen
|
May buy [buildingFilter] buildings with [stat] [cityFilter] = Kann mit [stat] [buildingFilter] kaufen [cityFilter]
|
||||||
|
|
||||||
Choral Music = Chormusik
|
Choral Music = Chormusik
|
||||||
|
|
||||||
|
@ -1198,6 +1198,7 @@ Pressure =
|
|||||||
|
|
||||||
# Religion overview screen
|
# Religion overview screen
|
||||||
Religion Name: =
|
Religion Name: =
|
||||||
|
Pantheon Name: =
|
||||||
Founding Civ: =
|
Founding Civ: =
|
||||||
Holy City: =
|
Holy City: =
|
||||||
Cities following this religion: =
|
Cities following this religion: =
|
||||||
|
@ -31,7 +31,7 @@ class Belief : RulesetObject() {
|
|||||||
textList += FormattedLine()
|
textList += FormattedLine()
|
||||||
}
|
}
|
||||||
if (type != BeliefType.None)
|
if (type != BeliefType.None)
|
||||||
textList += FormattedLine("{Type}: $type", color = type.color, centered = withHeader)
|
textList += FormattedLine("{Type}: {$type}", color = type.color, centered = withHeader)
|
||||||
uniqueObjects.forEach {
|
uniqueObjects.forEach {
|
||||||
if (!it.hasFlag(UniqueFlag.HiddenToUsers))
|
if (!it.hasFlag(UniqueFlag.HiddenToUsers))
|
||||||
textList += FormattedLine(it)
|
textList += FormattedLine(it)
|
||||||
|
@ -13,7 +13,10 @@ import com.unciv.ui.utils.KeyPressDispatcher.Companion.keyboardAvailable
|
|||||||
import com.unciv.ui.utils.UncivTooltip.Companion.addTooltip
|
import com.unciv.ui.utils.UncivTooltip.Companion.addTooltip
|
||||||
import com.unciv.ui.utils.AutoScrollPane as ScrollPane
|
import com.unciv.ui.utils.AutoScrollPane as ScrollPane
|
||||||
|
|
||||||
class EmpireOverviewScreen(private var viewingPlayer:CivilizationInfo, defaultPage: String = "") : BaseScreen(){
|
class EmpireOverviewScreen(
|
||||||
|
private var viewingPlayer: CivilizationInfo,
|
||||||
|
defaultPage: String = ""
|
||||||
|
) : BaseScreen() {
|
||||||
private val topTable = Table().apply { defaults().pad(10f) }
|
private val topTable = Table().apply { defaults().pad(10f) }
|
||||||
private val centerTable = Table().apply { defaults().pad(5f) }
|
private val centerTable = Table().apply { defaults().pad(5f) }
|
||||||
|
|
||||||
@ -38,7 +41,7 @@ class EmpireOverviewScreen(private var viewingPlayer:CivilizationInfo, defaultPa
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addCategory(name:String, table:Table, disabled:Boolean=false) {
|
private fun addCategory(name: String, table: Table, disabled: Boolean = false) {
|
||||||
// Buttons now hold their old label plus optionally an indicator for the shortcut key.
|
// Buttons now hold their old label plus optionally an indicator for the shortcut key.
|
||||||
// Implement this templated on UnitActionsTable.getUnitActionButton()
|
// Implement this templated on UnitActionsTable.getUnitActionButton()
|
||||||
val iconAndKey = ButtonDecorations.keyIconMap[name] ?: return // category without decoration entry disappears
|
val iconAndKey = ButtonDecorations.keyIconMap[name] ?: return // category without decoration entry disappears
|
||||||
@ -119,14 +122,14 @@ class EmpireOverviewScreen(private var viewingPlayer:CivilizationInfo, defaultPa
|
|||||||
val civGroup = Table()
|
val civGroup = Table()
|
||||||
|
|
||||||
var labelText = civ.civName.tr()+afterCivNameText
|
var labelText = civ.civName.tr()+afterCivNameText
|
||||||
var labelColor=Color.WHITE
|
var labelColor = Color.WHITE
|
||||||
val backgroundColor:Color
|
val backgroundColor: Color
|
||||||
|
|
||||||
if (civ.isDefeated()) {
|
if (civ.isDefeated()) {
|
||||||
civGroup.add(ImageGetter.getImage("OtherIcons/DisbandUnit")).size(30f)
|
civGroup.add(ImageGetter.getImage("OtherIcons/DisbandUnit")).size(30f)
|
||||||
backgroundColor = Color.LIGHT_GRAY
|
backgroundColor = Color.LIGHT_GRAY
|
||||||
labelColor = Color.BLACK
|
labelColor = Color.BLACK
|
||||||
} else if (currentPlayer==civ // game.viewEntireMapForDebug
|
} else if (currentPlayer == civ // || game.viewEntireMapForDebug
|
||||||
|| currentPlayer.knows(civ) || currentPlayer.isDefeated() || currentPlayer.victoryManager.hasWon()) {
|
|| currentPlayer.knows(civ) || currentPlayer.isDefeated() || currentPlayer.victoryManager.hasWon()) {
|
||||||
civGroup.add(ImageGetter.getNationIndicator(civ.nation, 30f))
|
civGroup.add(ImageGetter.getNationIndicator(civ.nation, 30f))
|
||||||
backgroundColor = civ.nation.getOuterColor()
|
backgroundColor = civ.nation.getOuterColor()
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.unciv.ui.overviewscreen
|
package com.unciv.ui.overviewscreen
|
||||||
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Button
|
import com.badlogic.gdx.scenes.scene2d.ui.Button
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||||
|
import com.badlogic.gdx.utils.Align
|
||||||
import com.unciv.Constants
|
import com.unciv.Constants
|
||||||
import com.unciv.UncivGame
|
import com.unciv.UncivGame
|
||||||
import com.unciv.logic.civilization.CivilizationInfo
|
import com.unciv.logic.civilization.CivilizationInfo
|
||||||
@ -23,109 +25,108 @@ class ReligionOverviewTable(
|
|||||||
val gameInfo = viewingPlayer.gameInfo
|
val gameInfo = viewingPlayer.gameInfo
|
||||||
|
|
||||||
private val civStatsTable = Table(BaseScreen.skin)
|
private val civStatsTable = Table(BaseScreen.skin)
|
||||||
|
private val religionButtons = Table(BaseScreen.skin)
|
||||||
private val religionsTable = Table(BaseScreen.skin)
|
private val religionButtonLabel = "Click an icon to see the stats of this religion".toLabel()
|
||||||
private val topButtons = Table(BaseScreen.skin)
|
|
||||||
private val topButtonLabel = "Click an icon to see the stats of this religion".toLabel()
|
|
||||||
private val statsTable = Table(BaseScreen.skin)
|
private val statsTable = Table(BaseScreen.skin)
|
||||||
private val beliefsTable = Table(BaseScreen.skin)
|
private val beliefsTable = Table(BaseScreen.skin)
|
||||||
|
|
||||||
private var selectedReligion: String? = null
|
private var selectedReligion: String? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
addCivSpecificStats(civStatsTable)
|
defaults().pad(5f)
|
||||||
addReligionButtons()
|
align(Align.top)
|
||||||
|
loadReligionButtons()
|
||||||
|
|
||||||
religionsTable.add(topButtons).pad(5f).row()
|
civStatsTable.defaults().left().pad(5f)
|
||||||
religionsTable.add(topButtonLabel).pad(5f)
|
civStatsTable.addCivSpecificStats()
|
||||||
religionsTable.addSeparator()
|
add(civStatsTable).row()
|
||||||
religionsTable.add(statsTable).pad(5f).row()
|
add(religionButtons).row()
|
||||||
religionsTable.add(beliefsTable).pad(5f)
|
add(religionButtonLabel)
|
||||||
|
addSeparator()
|
||||||
add(civStatsTable).top().left().padRight(25f)
|
statsTable.defaults().left().pad(5f)
|
||||||
add(religionsTable)
|
add(statsTable).row()
|
||||||
|
beliefsTable.defaults().padBottom(20f)
|
||||||
|
add(beliefsTable).pad(20f)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addCivSpecificStats(statsTable: Table) {
|
private fun Table.addCivSpecificStats() {
|
||||||
if (viewingPlayer.religionManager.canGenerateProphet()) {
|
if (viewingPlayer.religionManager.canGenerateProphet()) {
|
||||||
statsTable.add("Minimal Faith required for\nthe next [great prophet equivalent]:"
|
add("Minimal Faith required for\nthe next [great prophet equivalent]:"
|
||||||
.fillPlaceholders(viewingPlayer.religionManager.getGreatProphetEquivalent()!!)
|
.fillPlaceholders(viewingPlayer.religionManager.getGreatProphetEquivalent()!!)
|
||||||
.toLabel()
|
.toLabel()
|
||||||
).left()
|
)
|
||||||
statsTable.add(
|
add(
|
||||||
(viewingPlayer.religionManager.faithForNextGreatProphet() + 1)
|
(viewingPlayer.religionManager.faithForNextGreatProphet() + 1)
|
||||||
.toLabel()
|
.toLabel()
|
||||||
).right().pad(5f).row()
|
).right().row()
|
||||||
}
|
}
|
||||||
|
|
||||||
statsTable.add("Religions to be founded:".toLabel()).left()
|
add("Religions to be founded:".toLabel())
|
||||||
|
|
||||||
val foundedReligions = viewingPlayer.gameInfo.civilizations.count { it.religionManager.religionState >= ReligionState.Religion }
|
val foundedReligions = viewingPlayer.gameInfo.civilizations.count { it.religionManager.religionState >= ReligionState.Religion }
|
||||||
statsTable.add((viewingPlayer.religionManager.amountOfFoundableReligions() - foundedReligions).toLabel()).right().pad(5f).row()
|
add((viewingPlayer.religionManager.amountOfFoundableReligions() - foundedReligions).toLabel()).right().row()
|
||||||
|
|
||||||
statsTable.add("Religious status:".toLabel()).left()
|
add("Religious status:".toLabel()).left()
|
||||||
statsTable.add(viewingPlayer.religionManager.religionState.toString().toLabel()).right().pad(5f).row()
|
add(viewingPlayer.religionManager.religionState.toString().toLabel()).right().row()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addReligionButtons() {
|
private fun loadReligionButtons() {
|
||||||
topButtons.clear()
|
religionButtons.clear()
|
||||||
val existingReligions: List<Religion> = gameInfo.civilizations.mapNotNull { it.religionManager.religion }
|
val existingReligions: List<Religion> = gameInfo.civilizations.mapNotNull { it.religionManager.religion }
|
||||||
for (religion in existingReligions) {
|
for (religion in existingReligions) {
|
||||||
val button: Button
|
val image = if (religion.isPantheon()) {
|
||||||
if (religion.isPantheon()) {
|
if (viewingPlayer.knows(religion.foundingCivName) || viewingPlayer.civName == religion.foundingCivName)
|
||||||
val image = if (viewingPlayer.knows(religion.foundingCivName) || viewingPlayer.civName == religion.foundingCivName)
|
|
||||||
ImageGetter.getNationIndicator(religion.getFounder().nation, 60f)
|
ImageGetter.getNationIndicator(religion.getFounder().nation, 60f)
|
||||||
else
|
else
|
||||||
ImageGetter.getRandomNationIndicator(60f)
|
ImageGetter.getRandomNationIndicator(60f)
|
||||||
button = Button(image, BaseScreen.skin)
|
|
||||||
} else {
|
} else {
|
||||||
button = Button(
|
ImageGetter.getCircledReligionIcon(religion.getIconName(), 60f)
|
||||||
ImageGetter.getCircledReligionIcon(religion.getIconName(), 60f),
|
|
||||||
BaseScreen.skin
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
val button = Button(image, BaseScreen.skin)
|
||||||
|
|
||||||
button.onClick {
|
button.onClick {
|
||||||
selectedReligion = religion.name
|
selectedReligion = religion.name
|
||||||
addReligionButtons()
|
loadReligionButtons()
|
||||||
loadReligion(religion)
|
loadReligion(religion)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedReligion == religion.name)
|
if (selectedReligion == religion.name)
|
||||||
button.disable()
|
button.disable()
|
||||||
|
|
||||||
topButtons.add(button).pad(5f)
|
religionButtons.add(button).pad(5f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadReligion(religion: Religion) {
|
private fun loadReligion(religion: Religion) {
|
||||||
statsTable.clear()
|
statsTable.clear()
|
||||||
beliefsTable.clear()
|
beliefsTable.clear()
|
||||||
topButtonLabel.setText(religion.getReligionDisplayName().tr())
|
religionButtonLabel.setText(religion.getReligionDisplayName().tr())
|
||||||
|
|
||||||
for (belief in religion.getAllBeliefsOrdered()) {
|
for (belief in religion.getAllBeliefsOrdered()) {
|
||||||
beliefsTable.add(createBeliefDescription(belief)).pad(10f).row()
|
beliefsTable.add(createBeliefDescription(belief)).row()
|
||||||
}
|
}
|
||||||
|
|
||||||
statsTable.add("Religion Name:".toLabel()).left()
|
statsTable.add((if (religion.isPantheon()) "Pantheon Name:" else "Religion Name:").toLabel())
|
||||||
statsTable.add(religion.getReligionDisplayName().toLabel()).right().pad(5f).row()
|
statsTable.add(religion.getReligionDisplayName().toLabel()).right().row()
|
||||||
statsTable.add("Founding Civ:".toLabel()).left()
|
statsTable.add("Founding Civ:".toLabel())
|
||||||
val foundingCivName =
|
val foundingCivName =
|
||||||
if (viewingPlayer.knows(religion.foundingCivName) || viewingPlayer.civName == religion.foundingCivName)
|
if (viewingPlayer.knows(religion.foundingCivName) || viewingPlayer.civName == religion.foundingCivName)
|
||||||
religion.foundingCivName
|
religion.foundingCivName
|
||||||
else Constants.unknownNationName
|
else Constants.unknownNationName
|
||||||
statsTable.add(foundingCivName.toLabel()).right().pad(5f).row()
|
statsTable.add(foundingCivName.toLabel()).right().row()
|
||||||
if (religion.isMajorReligion()) {
|
if (religion.isMajorReligion()) {
|
||||||
val holyCity = gameInfo.getCities().firstOrNull { it.religion.religionThisIsTheHolyCityOf == religion.name }
|
val holyCity = gameInfo.getCities().firstOrNull { it.religion.religionThisIsTheHolyCityOf == religion.name }
|
||||||
if (holyCity != null) {
|
if (holyCity != null) {
|
||||||
statsTable.add("Holy City:".toLabel()).left()
|
statsTable.add("Holy City:".toLabel())
|
||||||
val cityName =
|
val cityName =
|
||||||
if (viewingPlayer.exploredTiles.contains(holyCity.getCenterTile().position))
|
if (viewingPlayer.exploredTiles.contains(holyCity.getCenterTile().position))
|
||||||
holyCity.name
|
holyCity.name
|
||||||
else Constants.unknownNationName
|
else Constants.unknownNationName
|
||||||
statsTable.add(cityName.toLabel()).right().pad(5f).row()
|
statsTable.add(cityName.toLabel()).right().row()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
statsTable.add("Cities following this religion:".toLabel()).left()
|
statsTable.add("Cities following this religion:".toLabel())
|
||||||
statsTable.add(religion.getFounder().religionManager.numberOfCitiesFollowingThisReligion().toString()).right().pad(5f).row()
|
statsTable.add(religion.getFounder().religionManager.numberOfCitiesFollowingThisReligion().toLabel()).right().row()
|
||||||
|
|
||||||
val minWidth = max(statsTable.minWidth, beliefsTable.minWidth) + 5
|
val minWidth = max(statsTable.minWidth, beliefsTable.minWidth) + 5
|
||||||
|
|
||||||
@ -133,6 +134,13 @@ class ReligionOverviewTable(
|
|||||||
for (cell in beliefsTable.cells) {
|
for (cell in beliefsTable.cells) {
|
||||||
cell.minWidth(minWidth)
|
cell.minWidth(minWidth)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we're wider than the container set our ScrollPane to center us
|
||||||
|
(parent as? ScrollPane)?.apply {
|
||||||
|
layout()
|
||||||
|
scrollX = maxX / 2
|
||||||
|
updateVisualScroll()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createBeliefDescription(belief: Belief) =
|
private fun createBeliefDescription(belief: Belief) =
|
||||||
|
Reference in New Issue
Block a user