Added Faith icon and display for games with Religion

This commit is contained in:
Yair Morgenstern 2021-04-01 20:44:27 +03:00
parent 50e3f62018
commit 9cb017c8a5
6 changed files with 623 additions and 616 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 867 KiB

After

Width:  |  Height:  |  Size: 883 KiB

View File

@ -207,9 +207,8 @@ class Ruleset {
}
}
fun getEras(): List<String> {
return technologies.values.map { it.column!!.era }.distinct()
}
fun getEras(): List<String> = technologies.values.map { it.column!!.era }.distinct()
fun hasReligion() = beliefs.any()
fun getEraNumber(era: String) = getEras().indexOf(era)
fun getSummary(): String {

View File

@ -25,10 +25,11 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() {
private var selectedCivIconHolder = Container<Actor>()
private val turnsLabel = "Turns: 0/400".toLabel()
private val goldLabel = "Gold:".toLabel(colorFromRGB(225, 217, 71))
private val scienceLabel = "Science:".toLabel(colorFromRGB(78, 140, 151))
private val happinessLabel = "Happiness:".toLabel()
private val cultureLabel = "Culture:".toLabel(colorFromRGB(210, 94, 210))
private val goldLabel = "0".toLabel(colorFromRGB(225, 217, 71))
private val scienceLabel = "0".toLabel(colorFromRGB(78, 140, 151))
private val happinessLabel = "0".toLabel()
private val cultureLabel = "0".toLabel(colorFromRGB(210, 94, 210))
private val faithLabel = "0".toLabel(colorFromRGB(210, 94, 210))
private val resourceLabels = HashMap<String, Label>()
private val resourceImages = HashMap<String, Actor>()
private val happinessImage = Group()
@ -101,14 +102,14 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() {
scienceImage.onClick(invokeTechScreen)
statsTable.add(happinessImage).padBottom(6f).size(20f)
statsTable.add(happinessLabel).padRight(20f)//.apply { setAlignment(Align.center) }).align(Align.top)
statsTable.add(happinessLabel).padRight(20f)
val invokeResourcesPage = {
worldScreen.game.setScreen(EmpireOverviewScreen(worldScreen.selectedCiv, "Resources"))
}
happinessImage.onClick(invokeResourcesPage)
happinessLabel.onClick(invokeResourcesPage)
statsTable.add(cultureLabel)//.apply { setAlignment(Align.center) }).align(Align.top)
statsTable.add(cultureLabel)
val cultureImage = ImageGetter.getStatIcon("Culture")
statsTable.add(cultureImage).padBottom(6f).size(20f)
val invokePoliciesPage = {
@ -117,6 +118,11 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() {
cultureLabel.onClick(invokePoliciesPage)
cultureImage.onClick(invokePoliciesPage)
if(worldScreen.gameInfo.ruleSet.hasReligion()) {
statsTable.add(faithLabel).padLeft(20f)
statsTable.add(ImageGetter.getStatIcon("Faith")).padBottom(6f).size(20f)
}
statsTable.pack()
statsTable.width = worldScreen.stage.width - 20
return statsTable
@ -204,6 +210,7 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() {
}
cultureLabel.setText(getCultureText(civInfo, nextTurnStats))
faithLabel.setText(civInfo.religionManager.storedFaith.toString() + "(+" + nextTurnStats.faith.roundToInt() + ")")
updateSelectedCivTabel()
}
@ -219,7 +226,7 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() {
}
private fun getCultureText(civInfo: CivilizationInfo, nextTurnStats: Stats): String {
var cultureString = "+" + Math.round(nextTurnStats.culture)
var cultureString = "+" + nextTurnStats.culture.roundToInt()
if (nextTurnStats.culture == 0f) return cultureString // when you start the game, you're not producing any culture
val turnsToNextPolicy = (civInfo.policies.getCultureNeededForNextPolicy() - civInfo.policies.storedCulture) / nextTurnStats.culture

View File

@ -525,6 +525,7 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
* [City](https://thenounproject.com/search/?q=city&i=1765370) By Muhajir ila Robbi in the Icon center
* [Lock](https://thenounproject.com/search/?q=lock&i=3217613) by Vadim Solomakhin for locked tiles
* [Hourglass](https://thenounproject.com/search/?q=hourglass&i=142268) by I Create Stuff for the 'Turn' icon
* [Dove](https://thenounproject.com/search/?q=dove&i=1344084) by Sandra for Faith
## Main menu