Fix settings being applied a second time with wrong data (#308)
This commit is contained in:
@@ -192,7 +192,8 @@ func save_settings():
|
|||||||
["There was an issue writing settings %s" % save_path])
|
["There was an issue writing settings %s" % save_path])
|
||||||
|
|
||||||
# Load the game settings from the settings file
|
# Load the game settings from the settings file
|
||||||
func load_settings():
|
# **Returns** The Resource structure loaded from settings file
|
||||||
|
func load_settings() -> Resource:
|
||||||
var save_settings_path: String = settings_folder.plus_file(SETTINGS_TEMPLATE)
|
var save_settings_path: String = settings_folder.plus_file(SETTINGS_TEMPLATE)
|
||||||
var file: File = File.new()
|
var file: File = File.new()
|
||||||
if not file.file_exists(save_settings_path):
|
if not file.file_exists(save_settings_path):
|
||||||
@@ -201,7 +202,5 @@ func load_settings():
|
|||||||
["Settings file %s doesn't exist" % save_settings_path,
|
["Settings file %s doesn't exist" % save_settings_path,
|
||||||
"Setting default settings."])
|
"Setting default settings."])
|
||||||
save_settings()
|
save_settings()
|
||||||
return
|
|
||||||
|
|
||||||
var settings_resource: Resource = load(save_settings_path)
|
return load(save_settings_path)
|
||||||
escoria._on_settings_loaded(settings_resource)
|
|
||||||
|
|||||||
@@ -385,5 +385,4 @@ func _on_settings_loaded(p_settings: ESCSaveSettings) -> void:
|
|||||||
linear2db(settings.music_volume)
|
linear2db(settings.music_volume)
|
||||||
)
|
)
|
||||||
TranslationServer.set_locale(settings.text_lang)
|
TranslationServer.set_locale(settings.text_lang)
|
||||||
# music_volume_changed()
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,16 +3,12 @@ extends Control
|
|||||||
signal back_button_pressed
|
signal back_button_pressed
|
||||||
|
|
||||||
onready var settings_changed = false
|
onready var settings_changed = false
|
||||||
onready var backup_settings
|
var backup_settings
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
|
||||||
initialize_options(escoria.settings)
|
|
||||||
|
|
||||||
|
|
||||||
func show():
|
func show():
|
||||||
backup_settings = escoria.settings.duplicate()
|
backup_settings = escoria.settings.duplicate()
|
||||||
initialize_options(backup_settings)
|
initialize_options(escoria.settings)
|
||||||
visible = true
|
visible = true
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user