From 296a499ae6a5f7a1f210ac441ff654c53bac88c8 Mon Sep 17 00:00:00 2001 From: yairm210 Date: Sun, 14 Apr 2024 23:37:30 +0300 Subject: [PATCH] There is no SettingsEvent, no one's listening for settings changes --- .../src/com/unciv/models/metadata/SettingsEvents.kt | 9 --------- .../com/unciv/ui/popups/options/SettingsSelect.kt | 13 +------------ 2 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 core/src/com/unciv/models/metadata/SettingsEvents.kt diff --git a/core/src/com/unciv/models/metadata/SettingsEvents.kt b/core/src/com/unciv/models/metadata/SettingsEvents.kt deleted file mode 100644 index da73154095..0000000000 --- a/core/src/com/unciv/models/metadata/SettingsEvents.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.unciv.models.metadata - -import com.unciv.logic.event.Event -import com.unciv.models.metadata.GameSettings.GameSetting - -/** **Warning:** this event is in the process of completion and **not** used for all settings yet! **Only the settings in [GameSetting] get events sent!** */ -interface SettingsPropertyChanged : Event { - val gameSetting: GameSetting -} diff --git a/core/src/com/unciv/ui/popups/options/SettingsSelect.kt b/core/src/com/unciv/ui/popups/options/SettingsSelect.kt index d934c82d3c..210f807b5c 100644 --- a/core/src/com/unciv/ui/popups/options/SettingsSelect.kt +++ b/core/src/com/unciv/ui/popups/options/SettingsSelect.kt @@ -5,11 +5,9 @@ import com.badlogic.gdx.scenes.scene2d.ui.SelectBox import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener import com.badlogic.gdx.utils.Array -import com.unciv.logic.event.EventBus import com.unciv.models.UncivSound import com.unciv.models.metadata.GameSettings import com.unciv.models.metadata.GameSettings.GameSetting -import com.unciv.models.metadata.SettingsPropertyChanged import com.unciv.models.translations.tr import com.unciv.ui.audio.SoundPlayer import com.unciv.ui.components.input.onChange @@ -60,7 +58,7 @@ open class SettingsSelect( selectBox.onChange { val newValue = selectBox.selected.value settingsProperty.set(newValue) - sendChangeEvent(newValue) + if (newValue is UncivSound) SoundPlayer.play(newValue) } return selectBox @@ -81,13 +79,4 @@ open class SettingsSelect( refreshSelectBox.items = options refreshSelectBox.selected = prev } - - private fun sendChangeEvent(item: T) { - when (item) { - is UncivSound -> SoundPlayer.play(item) - else -> EventBus.send(object : SettingsPropertyChanged { - override val gameSetting = setting - }) - } - } }