From eb79e77a26a1f6d25a504bd80acb58c8a2fa4334 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 16 Apr 2023 14:43:25 +0300 Subject: [PATCH] Removed icons from city names, removed icons from notifications for performance reasons --- .../unciv/ui/components/extensions/Scene2dExtensions.kt | 4 ++-- core/src/com/unciv/ui/components/tilegroups/CityButton.kt | 3 +-- .../ui/screens/cityscreen/CityScreenCityPickerTable.kt | 8 ++++---- .../unciv/ui/screens/overviewscreen/CityOverviewTable.kt | 2 +- .../unciv/ui/screens/worldscreen/NotificationsScroll.kt | 3 ++- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/src/com/unciv/ui/components/extensions/Scene2dExtensions.kt b/core/src/com/unciv/ui/components/extensions/Scene2dExtensions.kt index 0b0d7502c8..8713b12fb3 100644 --- a/core/src/com/unciv/ui/components/extensions/Scene2dExtensions.kt +++ b/core/src/com/unciv/ui/components/extensions/Scene2dExtensions.kt @@ -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) } diff --git a/core/src/com/unciv/ui/components/tilegroups/CityButton.kt b/core/src/com/unciv/ui/components/tilegroups/CityButton.kt index b945fc6137..109f28666a 100644 --- a/core/src/com/unciv/ui/components/tilegroups/CityButton.kt +++ b/core/src/com/unciv/ui/components/tilegroups/CityButton.kt @@ -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) { diff --git a/core/src/com/unciv/ui/screens/cityscreen/CityScreenCityPickerTable.kt b/core/src/com/unciv/ui/screens/cityscreen/CityScreenCityPickerTable.kt index eb90832003..6efba04961 100644 --- a/core/src/com/unciv/ui/screens/cityscreen/CityScreenCityPickerTable.kt +++ b/core/src/com/unciv/ui/screens/cityscreen/CityScreenCityPickerTable.kt @@ -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, diff --git a/core/src/com/unciv/ui/screens/overviewscreen/CityOverviewTable.kt b/core/src/com/unciv/ui/screens/overviewscreen/CityOverviewTable.kt index cbfbaa75dc..d1da68ff6e 100644 --- a/core/src/com/unciv/ui/screens/overviewscreen/CityOverviewTable.kt +++ b/core/src/com/unciv/ui/screens/overviewscreen/CityOverviewTable.kt @@ -196,7 +196,7 @@ class CityOverviewTab( val constructionCells: MutableList> = mutableListOf() for (city in cityList) { - val button = city.name.toTextButton() + val button = city.name.toTextButton(hideIcons = true) button.onClick { overviewScreen.game.pushScreen(CityScreen(city)) } diff --git a/core/src/com/unciv/ui/screens/worldscreen/NotificationsScroll.kt b/core/src/com/unciv/ui/screens/worldscreen/NotificationsScroll.kt index 9a12e3c7bb..b57523d004 100644 --- a/core/src/com/unciv/ui/screens/worldscreen/NotificationsScroll.kt +++ b/core/src/com/unciv/ui/screens/worldscreen/NotificationsScroll.kt @@ -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