Removed icons from city names, removed icons from notifications for performance reasons

This commit is contained in:
Yair Morgenstern 2023-04-16 14:43:25 +03:00
parent a81dd03fcf
commit eb79e77a26
5 changed files with 10 additions and 10 deletions

View File

@ -472,8 +472,8 @@ fun Image.setSize(size: Float) {
}
/** Translate a [String] and make a [TextButton] widget from it */
fun String.toTextButton(style: TextButtonStyle? = null): TextButton {
val text = this.tr()
fun String.toTextButton(style: TextButtonStyle? = null, hideIcons: Boolean = false): TextButton {
val text = this.tr(hideIcons)
return if (style == null) TextButton(text, BaseScreen.skin) else TextButton(text, style)
}

View File

@ -16,7 +16,6 @@ import com.unciv.logic.city.INonPerpetualConstruction
import com.unciv.logic.city.PerpetualConstruction
import com.unciv.logic.civilization.diplomacy.RelationshipLevel
import com.unciv.models.TutorialTrigger
import com.unciv.models.translations.tr
import com.unciv.ui.components.BorderedTable
import com.unciv.ui.components.Fonts
import com.unciv.ui.components.extensions.center
@ -312,7 +311,7 @@ private class CityTable(city: City, forPopup: Boolean = false) : BorderedTable(
table.add(capitalIcon).size(20f).padRight(5f)
}
val cityName = city.name.tr().toLabel(fontColor = textColor, alignment = Align.center)
val cityName = city.name.toLabel(fontColor = textColor, alignment = Align.center, hideIcons = true)
table.add(cityName).growY().center()
if (!forPopup) {

View File

@ -4,11 +4,11 @@ import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.Touchable
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.utils.Align
import com.unciv.ui.images.ImageGetter
import com.unciv.ui.screens.pickerscreens.CityRenamePopup
import com.unciv.ui.screens.basescreen.BaseScreen
import com.unciv.ui.components.extensions.onClick
import com.unciv.ui.components.extensions.toLabel
import com.unciv.ui.images.ImageGetter
import com.unciv.ui.screens.basescreen.BaseScreen
import com.unciv.ui.screens.pickerscreens.CityRenamePopup
/** Widget for the City Screen -
* the panel at bottom center showing the city name and offering arrows to cycle through the cities. */
@ -53,7 +53,7 @@ class CityScreenCityPickerTable(private val cityScreen: CityScreen) : Table() {
}
val currentCityLabel = city.run { "{$name} (${population.population})" }
.toLabel(fontSize = 30, fontColor = civInfo.nation.getInnerColor())
.toLabel(fontSize = 30, fontColor = civInfo.nation.getInnerColor(), hideIcons = true)
if (cityScreen.canChangeState) currentCityLabel.onClick {
CityRenamePopup(
screen = cityScreen,

View File

@ -196,7 +196,7 @@ class CityOverviewTab(
val constructionCells: MutableList<Cell<Label>> = mutableListOf()
for (city in cityList) {
val button = city.name.toTextButton()
val button = city.name.toTextButton(hideIcons = true)
button.onClick {
overviewScreen.game.pushScreen(CityScreen(city))
}

View File

@ -17,6 +17,7 @@ import com.unciv.ui.components.ColorMarkupLabel
import com.unciv.ui.components.extensions.onClick
import com.unciv.ui.components.extensions.packIfNeeded
import com.unciv.ui.components.extensions.surroundWithCircle
import com.unciv.ui.components.extensions.toLabel
import com.unciv.ui.images.IconCircleGroup
import com.unciv.ui.images.ImageGetter
import com.unciv.ui.screens.basescreen.BaseScreen
@ -215,7 +216,7 @@ class NotificationsScroll(
.minHeight(2f).width(minCategoryLineWidth)
add(Table().apply {
background = backgroundDrawable
val label = ColorMarkupLabel(category.name, Color.BLACK, fontSize = fontSize)
val label = category.name.toLabel(Color.BLACK, fontSize = fontSize, hideIcons = true)
add(label)
captionWidth = prefWidth // of this wrapper including background rims
captionWidth