mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 03:18:18 +07:00
Added more yield icons to the city stats table (#5894)
* Added more yield icons to the city stats table * Replaced icons with Font.icon
This commit is contained in:
parent
cdbdda366b
commit
89d4c046d4
@ -63,7 +63,7 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
|
||||
} else "Stopped expansion".tr()
|
||||
if (cityInfo.expansion.chooseNewTileToOwn() != null)
|
||||
turnsToExpansionString +=
|
||||
" (${cityInfo.expansion.cultureStored}/${cityInfo.expansion.getCultureToNextTile()})"
|
||||
" (${cityInfo.expansion.cultureStored}${Fonts.culture}/${cityInfo.expansion.getCultureToNextTile()}${Fonts.culture})"
|
||||
|
||||
var turnsToPopString =
|
||||
when {
|
||||
@ -74,17 +74,26 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
|
||||
-> "Food converts to production"
|
||||
else -> "Stopped population growth"
|
||||
}.tr()
|
||||
turnsToPopString += " (${cityInfo.population.foodStored}/${cityInfo.population.getFoodToNextPopulation()})"
|
||||
turnsToPopString += " (${cityInfo.population.foodStored}${Fonts.food}/${cityInfo.population.getFoodToNextPopulation()}${Fonts.food})"
|
||||
|
||||
innerTable.add(unassignedPopString.toLabel()).row()
|
||||
innerTable.add(turnsToExpansionString.toLabel()).row()
|
||||
innerTable.add(turnsToPopString.toLabel()).row()
|
||||
if (cityInfo.isInResistance())
|
||||
innerTable.add("In resistance for another [${cityInfo.getFlag(CityFlags.Resistance)}] turns".toLabel()).row()
|
||||
if (cityInfo.isWeLoveTheKingDay())
|
||||
innerTable.add("We Love The King Day for another [${cityInfo.getFlag(CityFlags.WeLoveTheKing)}] turns".toLabel()).row()
|
||||
else if (cityInfo.demandedResource != "")
|
||||
innerTable.add("Demanding [${cityInfo.demandedResource}]".toLabel()).row()
|
||||
|
||||
val tableWithIcons = Table()
|
||||
tableWithIcons.defaults().pad(2f)
|
||||
if (cityInfo.isInResistance()) {
|
||||
tableWithIcons.add(ImageGetter.getImage("StatIcons/Resistance")).size(20f)
|
||||
tableWithIcons.add("In resistance for another [${cityInfo.getFlag(CityFlags.Resistance)}] turns".toLabel()).row()
|
||||
}
|
||||
if (cityInfo.isWeLoveTheKingDay()) {
|
||||
tableWithIcons.add(ImageGetter.getStatIcon("Food")).size(20f)
|
||||
tableWithIcons.add("We Love The King Day for another [${cityInfo.getFlag(CityFlags.WeLoveTheKing)}] turns".toLabel()).row()
|
||||
} else if (cityInfo.demandedResource != "") {
|
||||
tableWithIcons.add(ImageGetter.getResourceImage(cityInfo.demandedResource, 20f)).padRight(5f)
|
||||
tableWithIcons.add("Demanding [${cityInfo.demandedResource}]".toLabel()).left().row()
|
||||
}
|
||||
innerTable.add(tableWithIcons).row()
|
||||
}
|
||||
|
||||
private fun addReligionInfo() {
|
||||
|
@ -222,7 +222,7 @@ fun String.toLabel(fontColor: Color = Color.WHITE, fontSize: Int = 18): Label {
|
||||
// We don't want to use setFontSize and setFontColor because they set the font,
|
||||
// which means we need to rebuild the font cache which means more memory allocation.
|
||||
var labelStyle = BaseScreen.skin.get(Label.LabelStyle::class.java)
|
||||
if(fontColor != Color.WHITE || fontSize != 18) { // if we want the default we don't need to create another style
|
||||
if (fontColor != Color.WHITE || fontSize != 18) { // if we want the default we don't need to create another style
|
||||
labelStyle = Label.LabelStyle(labelStyle) // clone this to another
|
||||
labelStyle.fontColor = fontColor
|
||||
if (fontSize != 18) labelStyle.font = Fonts.font
|
||||
|
@ -123,7 +123,7 @@ class NativeBitmapFontData(
|
||||
|
||||
object Fonts {
|
||||
|
||||
/** All text is originally rendered in 50px (set in AndroidLauncher and DesktopLauncher), and thn scaled to fit the size of the text we need now.
|
||||
/** All text is originally rendered in 50px (set in AndroidLauncher and DesktopLauncher), and then scaled to fit the size of the text we need now.
|
||||
* This has several advantages: It means we only render each character once (good for both runtime and RAM),
|
||||
* AND it means that our 'custom' emojis only need to be once size (50px) and they'll be rescaled for what's needed. */
|
||||
const val ORIGINAL_FONT_SIZE = 50f
|
||||
|
Loading…
Reference in New Issue
Block a user