mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-25 21:03:15 -04:00
Fix options setting for the notifications scroll visibility being wrong for new installs (#11177)
This commit is contained in:
parent
382d966696
commit
52eae2a3f9
@ -11,6 +11,7 @@ import com.unciv.ui.components.fonts.FontFamilyData
|
|||||||
import com.unciv.ui.components.fonts.Fonts
|
import com.unciv.ui.components.fonts.Fonts
|
||||||
import com.unciv.ui.components.input.KeyboardBindings
|
import com.unciv.ui.components.input.KeyboardBindings
|
||||||
import com.unciv.ui.screens.overviewscreen.EmpireOverviewCategories
|
import com.unciv.ui.screens.overviewscreen.EmpireOverviewCategories
|
||||||
|
import com.unciv.ui.screens.worldscreen.NotificationsScroll
|
||||||
import com.unciv.utils.Display
|
import com.unciv.utils.Display
|
||||||
import com.unciv.utils.ScreenOrientation
|
import com.unciv.utils.ScreenOrientation
|
||||||
import java.text.Collator
|
import java.text.Collator
|
||||||
@ -116,8 +117,9 @@ class GameSettings {
|
|||||||
|
|
||||||
var keyBindings = KeyboardBindings()
|
var keyBindings = KeyboardBindings()
|
||||||
|
|
||||||
/** NotificationScroll on Word Screen visibility control - mapped to NotificationsScroll.UserSetting enum */
|
/** NotificationScroll on Word Screen visibility control - mapped to [NotificationsScroll.UserSetting] enum */
|
||||||
var notificationScroll: String = ""
|
// Defaulting this to "" - and implement the fallback only in NotificationsScroll leads to Options popup and actual effect being in disagreement!
|
||||||
|
var notificationScroll: String = NotificationsScroll.UserSetting.default().name
|
||||||
|
|
||||||
/** If on, selected notifications are drawn enlarged with wider padding */
|
/** If on, selected notifications are drawn enlarged with wider padding */
|
||||||
var enlargeSelectedNotification = true
|
var enlargeSelectedNotification = true
|
||||||
|
@ -13,15 +13,15 @@ import com.badlogic.gdx.utils.Align
|
|||||||
import com.unciv.GUI
|
import com.unciv.GUI
|
||||||
import com.unciv.logic.civilization.Notification
|
import com.unciv.logic.civilization.Notification
|
||||||
import com.unciv.logic.civilization.NotificationCategory
|
import com.unciv.logic.civilization.NotificationCategory
|
||||||
import com.unciv.ui.components.widgets.AutoScrollPane as ScrollPane
|
|
||||||
import com.unciv.ui.components.widgets.ColorMarkupLabel
|
|
||||||
import com.unciv.ui.components.widgets.WrappableLabel
|
|
||||||
import com.unciv.ui.components.input.onClick
|
|
||||||
import com.unciv.ui.components.extensions.packIfNeeded
|
import com.unciv.ui.components.extensions.packIfNeeded
|
||||||
import com.unciv.ui.components.extensions.surroundWithCircle
|
import com.unciv.ui.components.extensions.surroundWithCircle
|
||||||
|
import com.unciv.ui.components.input.onClick
|
||||||
|
import com.unciv.ui.components.widgets.ColorMarkupLabel
|
||||||
|
import com.unciv.ui.components.widgets.WrappableLabel
|
||||||
import com.unciv.ui.images.IconCircleGroup
|
import com.unciv.ui.images.IconCircleGroup
|
||||||
import com.unciv.ui.images.ImageGetter
|
import com.unciv.ui.images.ImageGetter
|
||||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||||
|
import com.unciv.ui.components.widgets.AutoScrollPane as ScrollPane
|
||||||
|
|
||||||
/*TODO
|
/*TODO
|
||||||
* Un-hiding the notifications when new ones arrive is a little pointless due to Categories:
|
* Un-hiding the notifications when new ones arrive is a little pointless due to Categories:
|
||||||
@ -34,7 +34,10 @@ import com.unciv.ui.screens.basescreen.BaseScreen
|
|||||||
class NotificationsScroll(
|
class NotificationsScroll(
|
||||||
private val worldScreen: WorldScreen
|
private val worldScreen: WorldScreen
|
||||||
) : ScrollPane(null) {
|
) : ScrollPane(null) {
|
||||||
enum class UserSetting(val static: Boolean = false) { Disabled(true), Hidden, Visible, Permanent(true) }
|
enum class UserSetting(val static: Boolean = false) {
|
||||||
|
Disabled(true), Hidden, Visible, Permanent(true);
|
||||||
|
companion object { fun default() = Visible }
|
||||||
|
}
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
/** Scale the entire ScrollPane by this factor */
|
/** Scale the entire ScrollPane by this factor */
|
||||||
@ -455,7 +458,7 @@ class NotificationsScroll(
|
|||||||
private fun getUserSettingCheckDisabled(): Boolean {
|
private fun getUserSettingCheckDisabled(): Boolean {
|
||||||
val settingString = GUI.getSettings().notificationScroll
|
val settingString = GUI.getSettings().notificationScroll
|
||||||
val setting = UserSetting.values().firstOrNull { it.name == settingString }
|
val setting = UserSetting.values().firstOrNull { it.name == settingString }
|
||||||
?: UserSetting.Visible
|
?: UserSetting.default()
|
||||||
userSettingChanged = false
|
userSettingChanged = false
|
||||||
if (setting == userSetting)
|
if (setting == userSetting)
|
||||||
return setting == UserSetting.Disabled
|
return setting == UserSetting.Disabled
|
||||||
|
Loading…
x
Reference in New Issue
Block a user