diff --git a/core/src/com/unciv/ui/cityscreen/CityScreenCityPickerTable.kt b/core/src/com/unciv/ui/cityscreen/CityScreenCityPickerTable.kt index afd60f2cc7..9d23ee9916 100644 --- a/core/src/com/unciv/ui/cityscreen/CityScreenCityPickerTable.kt +++ b/core/src/com/unciv/ui/cityscreen/CityScreenCityPickerTable.kt @@ -6,11 +6,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton import com.badlogic.gdx.scenes.scene2d.ui.TextField import com.badlogic.gdx.utils.Align import com.unciv.models.translations.tr -import com.unciv.ui.utils.CameraStageBaseScreen -import com.unciv.ui.utils.ImageGetter -import com.unciv.ui.utils.onClick -import com.unciv.ui.utils.toLabel -import com.unciv.ui.utils.Popup +import com.unciv.ui.utils.* class CityScreenCityPickerTable(val cityScreen: CityScreen) : Table(){ @@ -20,7 +16,7 @@ class CityScreenCityPickerTable(val cityScreen: CityScreen) : Table(){ val civInfo = city.civInfo if (civInfo.cities.size > 1) { - val prevCityButton = TextButton("<", CameraStageBaseScreen.skin) + val prevCityButton = "<".toTextButton() prevCityButton.onClick { cityScreen.page(-1) } add(prevCityButton).pad(20f) } else add() @@ -67,13 +63,13 @@ class CityScreenCityPickerTable(val cityScreen: CityScreen) : Table(){ if (civInfo.cities.size > 1) { - val nextCityButton = TextButton(">", CameraStageBaseScreen.skin) + val nextCityButton = ">".toTextButton() nextCityButton.onClick { cityScreen.page(1) } add(nextCityButton).pad(20f) } else add() row() - val exitCityButton = TextButton("Exit city".tr(), CameraStageBaseScreen.skin) + val exitCityButton = "Exit city".toTextButton() exitCityButton.labelCell.pad(10f) exitCityButton.onClick { cityScreen.exit() } diff --git a/core/src/com/unciv/ui/cityscreen/CityScreenTileTable.kt b/core/src/com/unciv/ui/cityscreen/CityScreenTileTable.kt index 38a1c5feef..9c3790326e 100644 --- a/core/src/com/unciv/ui/cityscreen/CityScreenTileTable.kt +++ b/core/src/com/unciv/ui/cityscreen/CityScreenTileTable.kt @@ -41,7 +41,7 @@ class CityScreenTileTable(val cityScreen: CityScreen): Table(){ && selectedTile in city.tilesInRange){ val goldCostOfTile = city.expansion.getGoldCostOfTile(selectedTile) - val buyTileButton = TextButton("Buy for [$goldCostOfTile] gold".tr(), CameraStageBaseScreen.skin) + val buyTileButton = "Buy for [$goldCostOfTile] gold".toTextButton() buyTileButton.onClick(UncivSound.Coin) { city.expansion.buyTile(selectedTile) UncivGame.Current.setScreen(CityScreen(city)) @@ -53,7 +53,7 @@ class CityScreenTileTable(val cityScreen: CityScreen): Table(){ innerTable.add("You have [${city.civInfo.gold}] gold".toLabel(Color.YELLOW, 16)).padTop(2f) } if(city.canAcquireTile(selectedTile)) { - val acquireTileButton = TextButton("Acquire".tr(), CameraStageBaseScreen.skin) + val acquireTileButton = "Acquire".toTextButton() acquireTileButton.onClick { city.expansion.takeOwnership(selectedTile) UncivGame.Current.setScreen(CityScreen(city)) @@ -63,7 +63,7 @@ class CityScreenTileTable(val cityScreen: CityScreen): Table(){ if(city.workedTiles.contains(selectedTile.position)){ if(selectedTile.isLocked()) { - val unlockButton = TextButton("Unlock", CameraStageBaseScreen.skin) + val unlockButton = "Unlock".toTextButton() unlockButton.onClick { city.lockedTiles.remove(selectedTile.position) update(selectedTile) @@ -72,7 +72,7 @@ class CityScreenTileTable(val cityScreen: CityScreen): Table(){ innerTable.add(unlockButton).row() } else { - val lockButton = TextButton("Lock", CameraStageBaseScreen.skin) + val lockButton = "Lock".toTextButton() lockButton.onClick { city.lockedTiles.add(selectedTile.position) update(selectedTile) diff --git a/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt b/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt index fad5cadbcb..c898bde4d0 100644 --- a/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt +++ b/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt @@ -267,7 +267,7 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre val button: TextButton if (isSelectedQueueEntry()) { - button = TextButton("Remove from queue".tr(), CameraStageBaseScreen.skin) + button = "Remove from queue".toTextButton() if (!UncivGame.Current.worldScreen.isPlayersTurn || city.isPuppet) button.disable() else { button.onClick { @@ -278,7 +278,7 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre } } } else { - button = TextButton("Add to queue".tr(), CameraStageBaseScreen.skin) + button = "Add to queue".toTextButton() if (construction == null || cityConstructions.isQueueFull() || !cityConstructions.getConstruction(construction.name).isBuildable(cityConstructions) @@ -322,7 +322,7 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre val city = cityScreen.city val cityConstructions = city.cityConstructions - val button = TextButton("", CameraStageBaseScreen.skin) + val button = "".toTextButton() if (construction == null || !construction.canBePurchased() ) { diff --git a/core/src/com/unciv/ui/mapeditor/MapDownloadPopup.kt b/core/src/com/unciv/ui/mapeditor/MapDownloadPopup.kt index 94199067cc..977f8cc1ba 100644 --- a/core/src/com/unciv/ui/mapeditor/MapDownloadPopup.kt +++ b/core/src/com/unciv/ui/mapeditor/MapDownloadPopup.kt @@ -49,7 +49,7 @@ class MapDownloadPopup(loadMapScreen: LoadMapScreen): Popup(loadMapScreen) { Gdx.app.postRunnable { scrollableMapTable.apply { defaults().pad(10f) } for (downloadableMap in folderList.entries) { - val downloadMapButton = TextButton(downloadableMap.name, CameraStageBaseScreen.skin) + val downloadMapButton = downloadableMap.name.toTextButton() listOfMaps.add(downloadMapButton) downloadMapButton.onClick { thread(name = "MapDownload") { loadMap(downloadableMap) } diff --git a/core/src/com/unciv/ui/newgamescreen/PlayerPickerTable.kt b/core/src/com/unciv/ui/newgamescreen/PlayerPickerTable.kt index e95320fe3a..d23ad77b54 100644 --- a/core/src/com/unciv/ui/newgamescreen/PlayerPickerTable.kt +++ b/core/src/com/unciv/ui/newgamescreen/PlayerPickerTable.kt @@ -67,7 +67,7 @@ class PlayerPickerTable(val newGameScreen: NewGameScreen, val newGameParameters: val nationTable = getNationTable(player) playerTable.add(nationTable) - val playerTypeTextbutton = TextButton(player.playerType.name.tr(), CameraStageBaseScreen.skin) + val playerTypeTextbutton = player.playerType.name.toTextButton() playerTypeTextbutton.onClick { if (player.playerType == PlayerType.AI) player.playerType = PlayerType.Human @@ -98,14 +98,14 @@ class PlayerPickerTable(val newGameScreen: NewGameScreen, val newGameParameters: playerIdTextfield.addListener { onPlayerIdTextUpdated(); true } val currentUserId = UncivGame.Current.settings.userId - val setCurrentUserButton = TextButton("Set current user".tr(), CameraStageBaseScreen.skin) + val setCurrentUserButton = "Set current user".toTextButton() setCurrentUserButton.onClick { playerIdTextfield.text = currentUserId onPlayerIdTextUpdated() } playerTable.add(setCurrentUserButton).colspan(3).fillX().pad(5f).row() - val copyFromClipboardButton = TextButton("Player ID from clipboard".tr(),CameraStageBaseScreen.skin) + val copyFromClipboardButton = "Player ID from clipboard".toTextButton() copyFromClipboardButton.onClick { playerIdTextfield.text = Gdx.app.clipboard.contents onPlayerIdTextUpdated() diff --git a/core/src/com/unciv/ui/tutorials/TutorialRender.kt b/core/src/com/unciv/ui/tutorials/TutorialRender.kt index 0faa1d09f3..07aa7df9cd 100644 --- a/core/src/com/unciv/ui/tutorials/TutorialRender.kt +++ b/core/src/com/unciv/ui/tutorials/TutorialRender.kt @@ -6,10 +6,7 @@ import com.badlogic.gdx.utils.Array import com.unciv.Constants import com.unciv.models.Tutorial import com.unciv.models.translations.tr -import com.unciv.ui.utils.CameraStageBaseScreen -import com.unciv.ui.utils.ImageGetter -import com.unciv.ui.utils.Popup -import com.unciv.ui.utils.onClick +import com.unciv.ui.utils.* data class TutorialForRender(val tutorial: Tutorial, val texts: Array) @@ -33,7 +30,7 @@ class TutorialRender(private val screen: CameraStageBaseScreen) { tutorialPopup.addGoodSizedLabel(texts[0]).row() - val button = TextButton(Constants.close.tr(), CameraStageBaseScreen.skin) + val button = Constants.close.toTextButton() button.onClick { tutorialPopup.remove() texts.removeIndex(0) diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt b/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt index 9ea284cac5..e00db5ff9b 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt @@ -48,7 +48,7 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() { pack() addActor(getMenuButton()) // needs to be after pack - val overviewButton = TextButton("Overview".tr(),CameraStageBaseScreen.skin) + val overviewButton = "Overview".toTextButton() overviewButton.labelCell.pad(10f) overviewButton.pack() overviewButton.onClick { UncivGame.Current.setScreen(EmpireOverviewScreen(worldScreen.viewingCiv)) } diff --git a/core/src/com/unciv/ui/worldscreen/mainmenu/WorldScreenOptionsPopup.kt b/core/src/com/unciv/ui/worldscreen/mainmenu/WorldScreenOptionsPopup.kt index 8a8ea3d03b..e090032df0 100644 --- a/core/src/com/unciv/ui/worldscreen/mainmenu/WorldScreenOptionsPopup.kt +++ b/core/src/com/unciv/ui/worldscreen/mainmenu/WorldScreenOptionsPopup.kt @@ -154,7 +154,7 @@ class WorldScreenOptionsPopup(val worldScreen:WorldScreen) : Popup(worldScreen) addMusicVolumeSlider() if(Gdx.app.type==Application.ApplicationType.Desktop) { - val generateTranslationsButton = TextButton("Generate translation files".tr(), CameraStageBaseScreen.skin) + val generateTranslationsButton = "Generate translation files".toTextButton() generateTranslationsButton.onClick { val translations = Translations() translations.readAllLanguagesTranslation() @@ -202,7 +202,7 @@ class WorldScreenOptionsPopup(val worldScreen:WorldScreen) : Popup(worldScreen) } innerTable.add(musicVolumeSlider).pad(10f).row() } else { - val downloadMusicButton = TextButton("Download music".tr(), CameraStageBaseScreen.skin) + val downloadMusicButton = "Download music".toTextButton() innerTable.add(downloadMusicButton).colspan(2).row() val errorTable = Table() innerTable.add(errorTable).colspan(2).row()