diff --git a/project/scenes/app.tscn b/project/scenes/app.tscn index d717a32..d8dda7d 100644 --- a/project/scenes/app.tscn +++ b/project/scenes/app.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=17 format=3 uid="uid://ct8gsph3wnepl"] +[gd_scene load_steps=18 format=3 uid="uid://ct8gsph3wnepl"] [ext_resource type="Script" path="res://scripts/app.gd" id="1_skc7d"] [ext_resource type="Resource" uid="uid://b1xvdym0qh6td" path="res://resources/gate_events.res" id="2_cdryv"] @@ -16,6 +16,7 @@ [ext_resource type="Script" path="res://scripts/api/discover_gate.gd" id="13_3xhql"] [ext_resource type="Script" path="res://scripts/api/analytics/analytics_sender_bookmark.gd" id="13_74yg1"] [ext_resource type="Script" path="res://scripts/api/analytics/analytics_sender_gate.gd" id="13_jout6"] +[ext_resource type="Script" path="res://scripts/api/featured_gates.gd" id="15_c1fxl"] [node name="App" type="Node" node_paths=PackedStringArray("scenes_root")] script = ExtResource("1_skc7d") @@ -51,11 +52,16 @@ gate_events = ExtResource("2_cdryv") script = ExtResource("13_74yg1") bookmarks = ExtResource("6_rupvx") -[node name="AddGate" type="Node" parent="Api"] +[node name="DiscoverGate" type="Node" parent="Api"] script = ExtResource("13_3xhql") api = ExtResource("10_04o5h") gate_events = ExtResource("2_cdryv") +[node name="FeaturedGates" type="Node" parent="Api"] +script = ExtResource("15_c1fxl") +api = ExtResource("10_04o5h") +bookmarks = ExtResource("6_rupvx") + [node name="Debug" parent="." instance=ExtResource("7_3xeb8")] [node name="Window" parent="Debug" index="0"] diff --git a/project/scripts/api/featured_gates.gd b/project/scripts/api/featured_gates.gd new file mode 100644 index 0000000..a1dd8ae --- /dev/null +++ b/project/scripts/api/featured_gates.gd @@ -0,0 +1,13 @@ +extends Node + +@export var api: ApiSettings +@export var bookmarks: Bookmarks + + +func _ready() -> void: + bookmarks.on_ready.connect(on_bookmarks_ready) + + +func on_bookmarks_ready() -> void: + if bookmarks.gates.size() > 0: return + # TODO: Get featured gates diff --git a/project/scripts/loading/file_tools.gd b/project/scripts/loading/file_tools.gd index 8c0e6a2..1dd1073 100644 --- a/project/scripts/loading/file_tools.gd +++ b/project/scripts/loading/file_tools.gd @@ -1,6 +1,7 @@ extends Node class_name FileTools + static func remove_recursive(path: String) -> void: if not DirAccess.dir_exists_absolute(path) and not FileAccess.file_exists(path): return diff --git a/project/scripts/resources/api_settings.gd b/project/scripts/resources/api_settings.gd index 1dce1a5..84b71fa 100644 --- a/project/scripts/resources/api_settings.gd +++ b/project/scripts/resources/api_settings.gd @@ -22,6 +22,9 @@ var create_user_id: String : var discover_gate: String : get: return url + "/api/discover_gate" +var featured_gates: String : + get: return url + "/api/featured_gates" + var search: String : get: return url + "/api/search?query=" diff --git a/project/scripts/resources/bookmarks.gd b/project/scripts/resources/bookmarks.gd index ee3f07d..e78eb7e 100644 --- a/project/scripts/resources/bookmarks.gd +++ b/project/scripts/resources/bookmarks.gd @@ -1,6 +1,7 @@ extends Resource class_name Bookmarks +signal on_ready() signal on_star(gate: Gate) signal on_unstar(gate: Gate) signal save_image(gate: Gate) @@ -14,6 +15,8 @@ func ready() -> void: for gate in starred_gates: if gate == null or not Url.is_valid(gate.url): continue gates[gate.url] = gate + + on_ready.emit() func update(gate: Gate) -> void: