44 lines
1.1 KiB
GDScript
44 lines
1.1 KiB
GDScript
class_name ABGSettingsService
|
|
extends RefCounted
|
|
|
|
const StoreScript = preload("res://entry/settings_store.gd")
|
|
const SETTINGS_VERSION := StoreScript.SETTINGS_VERSION
|
|
const TEXT_SCALES := StoreScript.TEXT_SCALES
|
|
const SAFE_AREA_PRESETS := StoreScript.SAFE_AREA_PRESETS
|
|
|
|
## Application-facing Settings boundary. The existing JSON schema, migration,
|
|
## validation and atomic file protocol remain owned by the proven backend; new
|
|
## pages depend on this boundary rather than opening a settings file directly.
|
|
|
|
var backend
|
|
|
|
var path: String:
|
|
get:
|
|
return String(backend.path)
|
|
set(value):
|
|
backend.path = value
|
|
|
|
|
|
func _init(existing_backend = null) -> void:
|
|
backend = existing_backend if existing_backend != null else StoreScript.new()
|
|
|
|
|
|
func defaults() -> Dictionary:
|
|
return backend.defaults()
|
|
|
|
|
|
func load_settings() -> Dictionary:
|
|
return backend.load_settings()
|
|
|
|
|
|
func save_settings(value: Dictionary) -> Dictionary:
|
|
return backend.save_settings(value)
|
|
|
|
|
|
func validate(value: Dictionary) -> Dictionary:
|
|
return backend.validate(value)
|
|
|
|
|
|
func backend_type_name() -> String:
|
|
return backend.get_script().resource_path.get_file()
|