load scene by state
This commit is contained in:
parent
810a3aa9b5
commit
d1992c62d9
5 changed files with 35 additions and 9 deletions
|
|
@ -5,6 +5,16 @@ func _ready():
|
|||
$FileDialog.mode = FileDialog.FILE_MODE_OPEN_FILE
|
||||
$FileDialog.access = FileDialog.ACCESS_FILESYSTEM
|
||||
$FileDialog.use_native_dialog = true
|
||||
|
||||
Global.state_changed.connect(_update_state)
|
||||
if Global.current_state == Global.State.UNLOADED:
|
||||
pass
|
||||
elif Global.current_state == Global.State.LOADED:
|
||||
$MarginContainer.remove_child($MarginContainer/Unloaded)
|
||||
var s = ResourceLoader.load("res://loaded.tscn")
|
||||
var current_scene = s.instantiate()
|
||||
$MarginContainer.add_child(current_scene)
|
||||
pass
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
|
|
@ -16,3 +26,7 @@ func _on_button_pressed():
|
|||
|
||||
func _on_file_dialog_file_selected(path):
|
||||
Global.load_db(path)
|
||||
|
||||
func _update_state(old: Global.State, new: Global.State):
|
||||
print("updated state")
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue