aboutsummaryrefslogtreecommitdiff
path: root/game/src/OptionMenu/SettingNodes/SettingHSlider.gd
blob: cf2adf47b7af7324cb3fadf22ff0e31240275884 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
extends HSlider
class_name SettingHSlider

@export
var section_name : String = "Setting"

@export
var setting_name : String = "SettingHSlider"

@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
   value = file.get_value(section_name, setting_name, 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