fabapp/godot/main.gd

34 lines
989 B
GDScript3
Raw Normal View History

2023-12-04 13:13:36 +01:00
extends Control
# Called when the node enters the scene tree for the first time.
func _ready():
2023-12-04 22:19:23 +01:00
$FileDialog.mode = FileDialog.FILE_MODE_OPEN_FILE
2023-12-04 13:13:36 +01:00
$FileDialog.access = FileDialog.ACCESS_FILESYSTEM
$FileDialog.use_native_dialog = true
2023-12-07 23:14:24 +01:00
2023-12-18 23:03:56 +01:00
$MarginContainer/Unloaded/Button.pressed.connect(_on_button_pressed)
2023-12-07 23:14:24 +01:00
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)
2023-12-04 13:13:36 +01:00
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _on_button_pressed():
$FileDialog.show()
print("button pressed")
2023-12-04 22:19:23 +01:00
func _on_file_dialog_file_selected(path):
2023-12-05 13:42:52 +01:00
Global.load_db(path)
2023-12-07 23:14:24 +01:00
func _update_state(old: Global.State, new: Global.State):
print("updated state")
pass