More rankings & demographics screen icons (#7063)

* Add icons to demographics/rankings screen

* Unused import

* Some simplification

* Reviews

* Undelete atlas
This commit is contained in:
OptimizedForDensity 2022-06-06 02:33:34 -04:00 committed by GitHub
parent e91c0ff212
commit 1312140793
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2181 additions and 1678 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,19 @@
package com.unciv.ui.victoryscreen
enum class RankingType {
Score,
Population,
Crop_Yield,
Production,
Gold,
Territory,
Force,
Happiness,
Technologies,
Culture
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.ui.Image
import com.unciv.ui.images.ImageGetter
enum class RankingType(val getImage: ()->Image?) {
// production, gold, happiness, and culture already have icons added when the line is `tr()`anslated
Score({ ImageGetter.getImage("OtherIcons/Cultured").apply { color = Color.FIREBRICK } }),
Population({ ImageGetter.getStatIcon("Population") }),
Crop_Yield({ ImageGetter.getStatIcon("Food") }),
Production({ null }),
Gold({ null }),
Territory({ ImageGetter.getImage("OtherIcons/Hexagon") }),
Force({ ImageGetter.getImage("OtherIcons/Shield") }),
Happiness({ null }),
Technologies({ ImageGetter.getStatIcon("Science") }),
Culture({ null })
}

View File

@ -223,8 +223,12 @@ class VictoryScreen(val worldScreen: WorldScreen) : PickerScreen() {
for (category in RankingType.values()) {
val headers = Table().apply { defaults().pad(5f) }
headers.add(category.name.replace('_', ' ').toLabel()).row()
headers.addSeparator().fillX()
val textAndIcon = Table().apply { defaults() }
val columnImage = category.getImage()
if (columnImage != null) textAndIcon.add(columnImage).center().size(Constants.defaultFontSize.toFloat() * 0.75f).padRight(2f).padTop(-2f)
textAndIcon.add(category.name.replace('_', ' ').toLabel()).row()
headers.add(textAndIcon)
headers.addSeparator()
demographicsTable.add(headers)
}
}
@ -234,7 +238,11 @@ class VictoryScreen(val worldScreen: WorldScreen) : PickerScreen() {
for (category in RankingType.values()) {
val column = Table().apply { defaults().pad(5f) }
column.add(category.name.replace('_' , ' ').toLabel()).row()
val textAndIcon = Table().apply { defaults() }
val columnImage = category.getImage()
if (columnImage != null) textAndIcon.add(columnImage).size(Constants.defaultFontSize.toFloat() * 0.75f).padRight(2f).padTop(-2f)
textAndIcon.add(category.name.replace('_' , ' ').toLabel()).row()
column.add(textAndIcon)
column.addSeparator()
for (civ in majorCivs.sortedByDescending { it.getStatForRanking(category) }) {