mirror of
https://github.com/yairm210/Unciv.git
synced 2024-12-22 23:24: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.
|
* 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.
|
* @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()
|
if (!cells.isEmpty && !cells.last().isEndRow) row()
|
||||||
val separator = getSeparatorImage(color)
|
val separator = getSeparatorImage(color)
|
||||||
val cell = add(separator)
|
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,
|
// 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".
|
// 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 */
|
/** 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)
|
defaults().pad(5f)
|
||||||
|
|
||||||
addAutosaveTurnsSelectBox()
|
addAutosaveTurnsSelectBox()
|
||||||
addSeparator(Color.GRAY)
|
addSeparator()
|
||||||
|
|
||||||
if (Display.hasCutout())
|
if (Display.hasCutout())
|
||||||
addCutoutCheckbox()
|
addCutoutCheckbox()
|
||||||
@ -63,14 +63,14 @@ class AdvancedTab(
|
|||||||
|
|
||||||
addFontFamilySelect(onFontChange)
|
addFontFamilySelect(onFontChange)
|
||||||
addFontSizeMultiplier(onFontChange)
|
addFontSizeMultiplier(onFontChange)
|
||||||
addSeparator(Color.GRAY)
|
addSeparator()
|
||||||
|
|
||||||
addMaxZoomSlider()
|
addMaxZoomSlider()
|
||||||
|
|
||||||
addEasterEggsCheckBox()
|
addEasterEggsCheckBox()
|
||||||
|
|
||||||
addEnlargeNotificationsCheckBox()
|
addEnlargeNotificationsCheckBox()
|
||||||
addSeparator(Color.GRAY)
|
addSeparator()
|
||||||
|
|
||||||
addSetUserId()
|
addSetUserId()
|
||||||
|
|
||||||
|
@ -32,19 +32,18 @@ import java.time.temporal.ChronoUnit
|
|||||||
|
|
||||||
fun multiplayerTab(
|
fun multiplayerTab(
|
||||||
optionsPopup: OptionsPopup
|
optionsPopup: OptionsPopup
|
||||||
): Table {
|
) = Table(BaseScreen.skin).apply {
|
||||||
val tab = Table(BaseScreen.skin)
|
pad(10f)
|
||||||
tab.pad(10f)
|
defaults().pad(5f)
|
||||||
tab.defaults().pad(5f)
|
|
||||||
|
|
||||||
val settings = optionsPopup.settings
|
val settings = optionsPopup.settings
|
||||||
|
|
||||||
optionsPopup.addCheckbox(
|
optionsPopup.addCheckbox(
|
||||||
tab, "Enable multiplayer status button in singleplayer games",
|
this, "Enable multiplayer status button in singleplayer games",
|
||||||
settings.multiplayer::statusButtonInSinglePlayer, updateWorld = true
|
settings.multiplayer::statusButtonInSinglePlayer, updateWorld = true
|
||||||
)
|
)
|
||||||
|
|
||||||
addSeparator(tab)
|
addSeparator()
|
||||||
|
|
||||||
val curRefreshSelect = RefreshSelect(
|
val curRefreshSelect = RefreshSelect(
|
||||||
"Update status of currently played game every:",
|
"Update status of currently played game every:",
|
||||||
@ -53,7 +52,7 @@ fun multiplayerTab(
|
|||||||
GameSetting.MULTIPLAYER_CURRENT_GAME_REFRESH_DELAY,
|
GameSetting.MULTIPLAYER_CURRENT_GAME_REFRESH_DELAY,
|
||||||
settings
|
settings
|
||||||
)
|
)
|
||||||
addSelectAsSeparateTable(tab, curRefreshSelect)
|
addSelectAsSeparateTable(this, curRefreshSelect)
|
||||||
|
|
||||||
val allRefreshSelect = RefreshSelect(
|
val allRefreshSelect = RefreshSelect(
|
||||||
"In-game, update status of all games every:",
|
"In-game, update status of all games every:",
|
||||||
@ -62,39 +61,37 @@ fun multiplayerTab(
|
|||||||
GameSetting.MULTIPLAYER_ALL_GAME_REFRESH_DELAY,
|
GameSetting.MULTIPLAYER_ALL_GAME_REFRESH_DELAY,
|
||||||
settings
|
settings
|
||||||
)
|
)
|
||||||
addSelectAsSeparateTable(tab, allRefreshSelect)
|
addSelectAsSeparateTable(this, allRefreshSelect)
|
||||||
|
|
||||||
addSeparator(tab)
|
addSeparator()
|
||||||
|
|
||||||
// at the moment the notification service only exists on Android
|
// at the moment the notification service only exists on Android
|
||||||
val turnCheckerSelect: RefreshSelect?
|
val turnCheckerSelect: RefreshSelect?
|
||||||
if (Gdx.app.type == Application.ApplicationType.Android) {
|
if (Gdx.app.type == Application.ApplicationType.Android) {
|
||||||
turnCheckerSelect = addTurnCheckerOptions(tab, optionsPopup)
|
turnCheckerSelect = addTurnCheckerOptions(this, optionsPopup)
|
||||||
addSeparator(tab)
|
addSeparator()
|
||||||
} else {
|
} else {
|
||||||
turnCheckerSelect = null
|
turnCheckerSelect = null
|
||||||
}
|
}
|
||||||
|
|
||||||
val sounds = IMediaFinder.LabeledSounds().getLabeledSounds()
|
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,
|
sounds,
|
||||||
GameSetting.MULTIPLAYER_CURRENT_GAME_TURN_NOTIFICATION_SOUND,
|
GameSetting.MULTIPLAYER_CURRENT_GAME_TURN_NOTIFICATION_SOUND,
|
||||||
settings
|
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,
|
sounds,
|
||||||
GameSetting.MULTIPLAYER_OTHER_GAME_TURN_NOTIFICATION_SOUND,
|
GameSetting.MULTIPLAYER_OTHER_GAME_TURN_NOTIFICATION_SOUND,
|
||||||
settings
|
settings
|
||||||
))
|
))
|
||||||
|
|
||||||
addSeparator(tab)
|
addSeparator()
|
||||||
|
|
||||||
addMultiplayerServerOptions(tab, optionsPopup,
|
addMultiplayerServerOptions(this, optionsPopup,
|
||||||
listOfNotNull(curRefreshSelect, allRefreshSelect, turnCheckerSelect)
|
listOfNotNull(curRefreshSelect, allRefreshSelect, turnCheckerSelect)
|
||||||
)
|
)
|
||||||
|
|
||||||
return tab
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addMultiplayerServerOptions(
|
private fun addMultiplayerServerOptions(
|
||||||
@ -155,7 +152,7 @@ private fun addMultiplayerServerOptions(
|
|||||||
popup.reuseWith("Failed!", true)
|
popup.reuseWith("Failed!", true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).row()
|
}).colspan(2).row()
|
||||||
|
|
||||||
if (UncivGame.Current.onlineMultiplayer.multiplayerServer.featureSet.authVersion > 0) {
|
if (UncivGame.Current.onlineMultiplayer.multiplayerServer.featureSet.authVersion > 0) {
|
||||||
val passwordTextField = UncivTextField(
|
val passwordTextField = UncivTextField(
|
||||||
@ -362,6 +359,3 @@ private fun addSelectAsSeparateTable(tab: Table, settingsSelect: SettingsSelect<
|
|||||||
tab.add(table).growX().fillX().row()
|
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