52 lines
1.1 KiB
GDScript
52 lines
1.1 KiB
GDScript
class_name ConfigManager extends Resource
|
|
|
|
|
|
const CONFIG_PATH := "user://settings.cfg"
|
|
var _config := ConfigFile.new()
|
|
|
|
|
|
var current_file: String = "":
|
|
set(value):
|
|
current_file = value
|
|
_config.set_value("MAIN", "file", value)
|
|
save()
|
|
get:
|
|
var _default_path := OS.get_system_dir(OS.SYSTEM_DIR_DOCUMENTS, true).path_join("mouse_timer.csv")
|
|
return _config.get_value("MAIN", "file", _default_path)
|
|
|
|
|
|
var theme_path: String = "":
|
|
set(value):
|
|
theme_path = value
|
|
_config.set_value("MAIN", "theme", value)
|
|
save()
|
|
get:
|
|
return _config.get_value("MAIN", "theme", preload("res://assets/default_theme.theme").resource_path)
|
|
|
|
|
|
var last_task_name: String = "":
|
|
set(value):
|
|
last_task_name = value
|
|
_config.set_value("MAIN", "last_task_name", value)
|
|
save()
|
|
get:
|
|
return _config.get_value("MAIN", "last_task_name", "")
|
|
|
|
|
|
var sound_fx_on: bool = true:
|
|
set(value):
|
|
sound_fx_on = value
|
|
_config.set_value("MAIN", "sound_fx_on", value)
|
|
save()
|
|
get:
|
|
return _config.get_value("MAIN", "sound_fx", true)
|
|
|
|
|
|
|
|
func _init() -> void:
|
|
_config.load(CONFIG_PATH)
|
|
|
|
|
|
func save() -> void:
|
|
_config.save(CONFIG_PATH)
|