load scene by state
This commit is contained in:
parent
810a3aa9b5
commit
d1992c62d9
5 changed files with 35 additions and 9 deletions
|
|
@ -22,7 +22,6 @@ func _ready():
|
|||
if err == OK:
|
||||
var db_path = config.get_value("general", "db_path")
|
||||
load_db(db_path)
|
||||
|
||||
|
||||
func switch_state(new: State):
|
||||
var old = current_state
|
||||
|
|
@ -30,6 +29,7 @@ func switch_state(new: State):
|
|||
return
|
||||
|
||||
current_state = new
|
||||
emit_signal("state_changed", old, new)
|
||||
#signal state_changed(old, new)
|
||||
|
||||
func load_db(path: String):
|
||||
|
|
@ -38,8 +38,10 @@ func load_db(path: String):
|
|||
if success:
|
||||
config.set_value("general", "db_path", path)
|
||||
config.save(config_path)
|
||||
switch_state(State.LOADED)
|
||||
else:
|
||||
db.path = ""
|
||||
switch_state(State.UNLOADED)
|
||||
|
||||
func goto_scene(path):
|
||||
call_deferred("_deferred_goto_scene", path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue