diff --git a/core/src/com/unciv/ui/components/extensions/Scene2dExtensions.kt b/core/src/com/unciv/ui/components/extensions/Scene2dExtensions.kt index b462163c3d..5add0d2e59 100644 --- a/core/src/com/unciv/ui/components/extensions/Scene2dExtensions.kt +++ b/core/src/com/unciv/ui/components/extensions/Scene2dExtensions.kt @@ -206,7 +206,7 @@ private fun getSeparatorImage(color: Color) = Image(ImageGetter.getWhiteDotDrawa * Create a horizontal separator as an empty Container with a colored background. * @param colSpan Optionally override [colspan][Cell.colspan] which defaults to the current column count. */ -fun Table.addSeparator(color: Color = Color.WHITE, colSpan: Int = 0, height: Float = 2f): Cell { +fun Table.addSeparator(color: Color = BaseScreen.skin.getColor("color"), colSpan: Int = 0, height: Float = 1f): Cell { if (!cells.isEmpty && !cells.last().isEndRow) row() val separator = getSeparatorImage(color) val cell = add(separator) @@ -323,7 +323,7 @@ fun String.toCheckBox(startsOutChecked: Boolean = false, changeAction: ((Boolean } // Add a little distance between the icon and the text. 0 looks glued together, // 5 is about half an uppercase letter, and 1 about the width of the vertical line in "P". - imageCell.padRight(1f) + imageCell.padRight(Constants.defaultFontSize / 2.0f) } /** Sets the [font color][Label.LabelStyle.fontColor] on a [Label] and returns it to allow chaining */ diff --git a/core/src/com/unciv/ui/popups/options/AdvancedTab.kt b/core/src/com/unciv/ui/popups/options/AdvancedTab.kt index ed8ff68e9d..f42f21286f 100644 --- a/core/src/com/unciv/ui/popups/options/AdvancedTab.kt +++ b/core/src/com/unciv/ui/popups/options/AdvancedTab.kt @@ -53,7 +53,7 @@ class AdvancedTab( defaults().pad(5f) addAutosaveTurnsSelectBox() - addSeparator(Color.GRAY) + addSeparator() if (Display.hasCutout()) addCutoutCheckbox() @@ -63,14 +63,14 @@ class AdvancedTab( addFontFamilySelect(onFontChange) addFontSizeMultiplier(onFontChange) - addSeparator(Color.GRAY) + addSeparator() addMaxZoomSlider() addEasterEggsCheckBox() addEnlargeNotificationsCheckBox() - addSeparator(Color.GRAY) + addSeparator() addSetUserId() diff --git a/core/src/com/unciv/ui/popups/options/MultiplayerTab.kt b/core/src/com/unciv/ui/popups/options/MultiplayerTab.kt index 6b41aa7044..f087645805 100644 --- a/core/src/com/unciv/ui/popups/options/MultiplayerTab.kt +++ b/core/src/com/unciv/ui/popups/options/MultiplayerTab.kt @@ -32,19 +32,18 @@ import java.time.temporal.ChronoUnit fun multiplayerTab( optionsPopup: OptionsPopup -): Table { - val tab = Table(BaseScreen.skin) - tab.pad(10f) - tab.defaults().pad(5f) +) = Table(BaseScreen.skin).apply { + pad(10f) + defaults().pad(5f) val settings = optionsPopup.settings optionsPopup.addCheckbox( - tab, "Enable multiplayer status button in singleplayer games", + this, "Enable multiplayer status button in singleplayer games", settings.multiplayer::statusButtonInSinglePlayer, updateWorld = true ) - addSeparator(tab) + addSeparator() val curRefreshSelect = RefreshSelect( "Update status of currently played game every:", @@ -53,7 +52,7 @@ fun multiplayerTab( GameSetting.MULTIPLAYER_CURRENT_GAME_REFRESH_DELAY, settings ) - addSelectAsSeparateTable(tab, curRefreshSelect) + addSelectAsSeparateTable(this, curRefreshSelect) val allRefreshSelect = RefreshSelect( "In-game, update status of all games every:", @@ -62,39 +61,37 @@ fun multiplayerTab( GameSetting.MULTIPLAYER_ALL_GAME_REFRESH_DELAY, settings ) - addSelectAsSeparateTable(tab, allRefreshSelect) + addSelectAsSeparateTable(this, allRefreshSelect) - addSeparator(tab) + addSeparator() // at the moment the notification service only exists on Android val turnCheckerSelect: RefreshSelect? if (Gdx.app.type == Application.ApplicationType.Android) { - turnCheckerSelect = addTurnCheckerOptions(tab, optionsPopup) - addSeparator(tab) + turnCheckerSelect = addTurnCheckerOptions(this, optionsPopup) + addSeparator() } else { turnCheckerSelect = null } val sounds = IMediaFinder.LabeledSounds().getLabeledSounds() - addSelectAsSeparateTable(tab, SettingsSelect("Sound notification for when it's your turn in your currently open game:", + addSelectAsSeparateTable(this, SettingsSelect("Sound notification for when it's your turn in your currently open game:", sounds, GameSetting.MULTIPLAYER_CURRENT_GAME_TURN_NOTIFICATION_SOUND, settings )) - addSelectAsSeparateTable(tab, SettingsSelect("Sound notification for when it's your turn in any other game:", + addSelectAsSeparateTable(this, SettingsSelect("Sound notification for when it's your turn in any other game:", sounds, GameSetting.MULTIPLAYER_OTHER_GAME_TURN_NOTIFICATION_SOUND, settings )) - addSeparator(tab) + addSeparator() - addMultiplayerServerOptions(tab, optionsPopup, + addMultiplayerServerOptions(this, optionsPopup, listOfNotNull(curRefreshSelect, allRefreshSelect, turnCheckerSelect) ) - - return tab } private fun addMultiplayerServerOptions( @@ -155,7 +152,7 @@ private fun addMultiplayerServerOptions( popup.reuseWith("Failed!", true) } } - }).row() + }).colspan(2).row() if (UncivGame.Current.onlineMultiplayer.multiplayerServer.featureSet.authVersion > 0) { val passwordTextField = UncivTextField( @@ -362,6 +359,3 @@ private fun addSelectAsSeparateTable(tab: Table, settingsSelect: SettingsSelect< tab.add(table).growX().fillX().row() } -private fun addSeparator(tab: Table) { - tab.addSeparator(BaseScreen.skinStrings.skinConfig.baseColor.brighten(0.1f)) -}