mirror of
https://github.com/yairm210/Unciv.git
synced 2024-12-22 17:54:25 +07:00
UI tweaks and fixes: dividers, checkbox-to-text spacing, multiplayer tab connection button (#12646)
* [1] * [2] * [3] * [1] * Revert "[2]" This reverts commit b9b88d8a1593c1d0e4387d94f2b3e0d976d8e14b. * [2] global
This commit is contained in:
parent
17f5f949eb
commit
9082e2ab3b
@ -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<Image> {
|
||||
fun Table.addSeparator(color: Color = BaseScreen.skin.getColor("color"), colSpan: Int = 0, height: Float = 1f): Cell<Image> {
|
||||
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 */
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user