aboutsummaryrefslogtreecommitdiff
path: root/game/src/OptionMenu/SettingNodes/SettingHSlider.gd
diff options
context:
space:
mode:
Diffstat (limited to 'game/src/OptionMenu/SettingNodes/SettingHSlider.gd')
-rw-r--r--game/src/OptionMenu/SettingNodes/SettingHSlider.gd41
1 files changed, 0 insertions, 41 deletions
diff --git a/game/src/OptionMenu/SettingNodes/SettingHSlider.gd b/game/src/OptionMenu/SettingNodes/SettingHSlider.gd
deleted file mode 100644
index 6fa30ed..0000000
--- a/game/src/OptionMenu/SettingNodes/SettingHSlider.gd
+++ /dev/null
@@ -1,41 +0,0 @@
-extends HSlider
-class_name SettingHSlider
-
-@export
-var section_name : String = "setting"
-
-@export
-var setting_name : String = "setting_hslider"
-
-@export
-var default_value : float = 0
-
-func _ready():
- Events.Options.load_settings.connect(load_setting)
- Events.Options.save_settings.connect(save_setting)
- Events.Options.reset_settings.connect(reset_setting)
-
-func load_setting(file : ConfigFile):
- if file == null: return
- var load_value = file.get_value(section_name, setting_name, default_value)
- match typeof(load_value):
- TYPE_FLOAT, TYPE_INT:
- if value == load_value: value_changed.emit(value)
- value = load_value
- return
- TYPE_STRING, TYPE_STRING_NAME:
- var load_string := load_value as String
- if load_string.is_valid_float():
- load_value = load_string.to_float()
- if value == load_value: value_changed.emit(value)
- value = load_value
- return
- push_error("Setting value '%s' invalid for setting [%s] \"%s\"" % [load_value, section_name, setting_name])
- value = default_value
-
-func save_setting(file : ConfigFile):
- if file == null: return
- file.set_value(section_name, setting_name, value)
-
-func reset_setting():
- value = default_value