small racing game im working on
seperate start.tscn
| -rw-r--r-- | globals.gd | 1 | ||||
| -rw-r--r-- | start.tscn | 93 | ||||
| -rw-r--r-- | ui/editor/track_editor.tscn | 2 | ||||
| -rw-r--r-- | ui/editor/track_select.gd | 3 | ||||
| -rw-r--r-- | ui/tabs/create.tscn | 79 | ||||
| -rw-r--r-- | ui/tabs/play.tscn | 22 | ||||
| -rw-r--r-- | ui/tracks.gd | 4 |
7 files changed, 113 insertions, 91 deletions
@@ -4,6 +4,7 @@ class_name Utils var playing: TrackResource var editing: TrackResource var ghost: GhostData +var track_select: BuiltinTrackSelect const SAVES := "user://ghosts/%s.ghost" const TRACKS := "user://player data/tracks/%s.track" const THUMBS := "user://thumbs/%s.thumb" @@ -1,18 +1,10 @@ -[gd_scene load_steps=9 format=3 uid="uid://co11ood2nmady"] +[gd_scene load_steps=5 format=3 uid="uid://co11ood2nmady"] [ext_resource type="Theme" uid="uid://d3ywcokn5ddy8" path="res://ui/theme.tres" id="1_gm0ws"] -[ext_resource type="Script" path="res://ui/tracks.gd" id="2_po2ce"] -[ext_resource type="Theme" uid="uid://bds815vxta4ma" path="res://ui/editor/bar_button.tres" id="6_e1quy"] -[ext_resource type="Script" path="res://ui/multi_button.gd" id="7_rhu6g"] -[ext_resource type="Script" path="res://ui/editor/import.gd" id="8_1f3ce"] -[ext_resource type="Script" path="res://ui/editor/track_select.gd" id="8_v6p1s"] +[ext_resource type="PackedScene" uid="uid://oq2hhcxu57xx" path="res://ui/tabs/create.tscn" id="2_sm0m7"] +[ext_resource type="PackedScene" uid="uid://6p50mntqmyvq" path="res://ui/tabs/play.tscn" id="3_4rfac"] [ext_resource type="AudioStream" uid="uid://bwiyphl31lwu6" path="res://assets/sounds/music.ogg" id="9_ma7kx"] -[sub_resource type="LabelSettings" id="LabelSettings_8ohli"] -font_size = 24 -outline_size = 12 -outline_color = Color(0, 0.168627, 0.211765, 1) - [node name="start" type="Control"] layout_mode = 3 anchors_preset = 15 @@ -38,90 +30,15 @@ theme_override_constants/margin_bottom = 50 layout_mode = 2 tab_alignment = 1 -[node name="play" type="ScrollContainer" parent="margin/tabs"] -layout_mode = 2 -horizontal_scroll_mode = 0 - -[node name="cont" type="VBoxContainer" parent="margin/tabs/play"] +[node name="play" parent="margin/tabs" instance=ExtResource("3_4rfac")] layout_mode = 2 -size_flags_horizontal = 3 -size_flags_vertical = 3 -[node name="tracks" type="HFlowContainer" parent="margin/tabs/play/cont"] -layout_mode = 2 -size_flags_vertical = 3 -theme_override_constants/h_separation = 15 -theme_override_constants/v_separation = 15 -script = ExtResource("2_po2ce") -editable = false -metadata/_edit_pinned_properties_ = [&"editable"] - -[node name="create" type="VBoxContainer" parent="margin/tabs"] +[node name="create" parent="margin/tabs" instance=ExtResource("2_sm0m7")] visible = false layout_mode = 2 -[node name="buttons" type="HFlowContainer" parent="margin/tabs/create"] -layout_mode = 2 -theme = ExtResource("6_e1quy") - -[node name="new" type="Button" parent="margin/tabs/create/buttons" node_paths=PackedStringArray("secondary")] -custom_minimum_size = Vector2(50, 0) -layout_mode = 2 -theme_override_font_sizes/font_size = 52 -action_mode = 0 -text = "" -script = ExtResource("7_rhu6g") -secondary = NodePath("plus") - -[node name="plus" type="Label" parent="margin/tabs/create/buttons/new"] -layout_mode = 1 -anchors_preset = 3 -anchor_left = 1.0 -anchor_top = 1.0 -anchor_right = 1.0 -anchor_bottom = 1.0 -offset_left = -9.0 -offset_top = -24.0 -offset_right = 4.0 -offset_bottom = 4.0 -grow_horizontal = 0 -grow_vertical = 0 -text = "" -label_settings = SubResource("LabelSettings_8ohli") - -[node name="import" type="Button" parent="margin/tabs/create/buttons"] -custom_minimum_size = Vector2(50, 0) -layout_mode = 2 -theme_override_font_sizes/font_size = 52 -disabled = true -action_mode = 0 -text = "" -script = ExtResource("8_1f3ce") - -[node name="scroll" type="ScrollContainer" parent="margin/tabs/create"] -layout_mode = 2 -size_flags_vertical = 3 -horizontal_scroll_mode = 0 - -[node name="vbox" type="VBoxContainer" parent="margin/tabs/create/scroll"] -editor_description = "needed for horizontal expansion" -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_vertical = 3 - -[node name="tracks_owned" type="HFlowContainer" parent="margin/tabs/create/scroll/vbox" node_paths=PackedStringArray("other")] -layout_mode = 2 -size_flags_vertical = 3 -script = ExtResource("8_v6p1s") -other = NodePath("../../../../play/cont/tracks") -editable = true -metadata/_edit_pinned_properties_ = [&"editable"] - [node name="music" type="AudioStreamPlayer" parent="."] stream = ExtResource("9_ma7kx") volume_db = -25.0 autoplay = true bus = &"music" - -[connection signal="pressed" from="margin/tabs/create/buttons/new" to="margin/tabs/create/scroll/vbox/tracks_owned" method="_on_new_pressed"] -[connection signal="import" from="margin/tabs/create/buttons/import" to="margin/tabs/create/scroll/vbox/tracks_owned" method="_on_import_import"] diff --git a/ui/editor/track_editor.tscn b/ui/editor/track_editor.tscn index 4e61634..8bfdd0e 100644 --- a/ui/editor/track_editor.tscn +++ b/ui/editor/track_editor.tscn @@ -554,8 +554,8 @@ max_polyphony = 2 [connection signal="back" from="split/left dock/data/container/buttons/back" to="." method="queue_free"] [connection signal="pressed" from="split/left dock/data/container/buttons/back" to="split/left dock/data/container/buttons/back" method="_on_pressed"] [connection signal="pressed" from="split/left dock/data/container/buttons/save" to="split/left dock/data/container/buttons/save" method="_on_pressed"] -[connection signal="cell_selected" from="split/left dock/fs/fs tree" to="split/left dock/fs/fs tree" method="expand_selected"] [connection signal="cell_selected" from="split/left dock/fs/fs tree" to="split/left dock/fs/fs tree" method="_on_cell_selected"] +[connection signal="cell_selected" from="split/left dock/fs/fs tree" to="split/left dock/fs/fs tree" method="expand_selected"] [connection signal="selected_dir" from="split/left dock/fs/fs tree" to="split/left dock/fs/items" method="open_dir"] [connection signal="dir_selected" from="split/left dock/fs/items" to="split/left dock/fs/fs tree" method="_on_items_dir_selected"] [connection signal="dir_selected" from="split/left dock/fs/items" to="split/left dock/fs/fs tree" method="expand_selected" unbinds=1] diff --git a/ui/editor/track_select.gd b/ui/editor/track_select.gd index 6582ef3..2a229fe 100644 --- a/ui/editor/track_select.gd +++ b/ui/editor/track_select.gd @@ -1,7 +1,6 @@ extends TrackSelect class_name TrackEditorList -@export var other: BuiltinTrackSelect var tracks: Array[TrackResource] = [] func _ready() -> void: @@ -18,7 +17,7 @@ func _ready() -> void: func _on_mkbutton(b: TrackButton, t: TrackResource) -> void: @warning_ignore("static_called_on_instance") - b.include.connect(func(): other.add(t); TrackSelect.delete(t); b.queue_free()) + b.include.connect(func(): Globals.track_select.add(t); TrackSelect.delete(t); b.queue_free()) func _on_new_pressed() -> void: var res := TrackResource.new([]) diff --git a/ui/tabs/create.tscn b/ui/tabs/create.tscn new file mode 100644 index 0000000..069913e --- /dev/null +++ b/ui/tabs/create.tscn @@ -0,0 +1,79 @@ +[gd_scene load_steps=7 format=3 uid="uid://oq2hhcxu57xx"] + +[ext_resource type="Theme" uid="uid://bds815vxta4ma" path="res://ui/editor/bar_button.tres" id="1_l1v08"] +[ext_resource type="Theme" uid="uid://d3ywcokn5ddy8" path="res://ui/theme.tres" id="1_vkyg2"] +[ext_resource type="Script" path="res://ui/multi_button.gd" id="2_7621o"] +[ext_resource type="Script" path="res://ui/editor/import.gd" id="3_167pb"] +[ext_resource type="Script" path="res://ui/editor/track_select.gd" id="4_cxprj"] + +[sub_resource type="LabelSettings" id="LabelSettings_8ohli"] +font_size = 24 +outline_size = 12 +outline_color = Color(0, 0.168627, 0.211765, 1) + +[node name="create" type="VBoxContainer"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme = ExtResource("1_vkyg2") + +[node name="buttons" type="HFlowContainer" parent="."] +layout_mode = 2 +theme = ExtResource("1_l1v08") + +[node name="new" type="Button" parent="buttons" node_paths=PackedStringArray("secondary")] +custom_minimum_size = Vector2(50, 0) +layout_mode = 2 +theme_override_font_sizes/font_size = 52 +action_mode = 0 +text = "" +script = ExtResource("2_7621o") +secondary = NodePath("plus") + +[node name="plus" type="Label" parent="buttons/new"] +layout_mode = 1 +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -9.0 +offset_top = -24.0 +offset_right = 4.0 +offset_bottom = 4.0 +grow_horizontal = 0 +grow_vertical = 0 +text = "" +label_settings = SubResource("LabelSettings_8ohli") + +[node name="import" type="Button" parent="buttons"] +custom_minimum_size = Vector2(50, 0) +layout_mode = 2 +theme_override_font_sizes/font_size = 52 +disabled = true +action_mode = 0 +text = "" +script = ExtResource("3_167pb") + +[node name="scroll" type="ScrollContainer" parent="."] +layout_mode = 2 +size_flags_vertical = 3 +horizontal_scroll_mode = 0 + +[node name="vbox" type="VBoxContainer" parent="scroll"] +editor_description = "needed for horizontal expansion" +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="tracks_owned" type="HFlowContainer" parent="scroll/vbox"] +layout_mode = 2 +size_flags_vertical = 3 +script = ExtResource("4_cxprj") +editable = true +metadata/_edit_pinned_properties_ = [&"editable"] + +[connection signal="pressed" from="buttons/new" to="scroll/vbox/tracks_owned" method="_on_new_pressed"] +[connection signal="import" from="buttons/import" to="scroll/vbox/tracks_owned" method="_on_import_import"] diff --git a/ui/tabs/play.tscn b/ui/tabs/play.tscn new file mode 100644 index 0000000..3e492ab --- /dev/null +++ b/ui/tabs/play.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=2 format=3 uid="uid://6p50mntqmyvq"] + +[ext_resource type="Script" path="res://ui/tracks.gd" id="1_11hct"] + +[node name="play" type="ScrollContainer"] +size_flags_horizontal = 3 +size_flags_vertical = 3 +horizontal_scroll_mode = 0 + +[node name="cont" type="VBoxContainer" parent="."] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="tracks" type="HFlowContainer" parent="cont"] +layout_mode = 2 +size_flags_vertical = 3 +theme_override_constants/h_separation = 15 +theme_override_constants/v_separation = 15 +script = ExtResource("1_11hct") +editable = false +metadata/_edit_pinned_properties_ = [&"editable"] diff --git a/ui/tracks.gd b/ui/tracks.gd index 38093e2..5e0dec2 100644 --- a/ui/tracks.gd +++ b/ui/tracks.gd @@ -3,9 +3,13 @@ class_name BuiltinTrackSelect func _ready() -> void: _load() + Globals.track_select = self mkbuttons(Globals.builtin_tracks) super() +func _exit_tree() -> void: + Globals.track_select = null + func _load(): var tracks: Array = str_to_var(FileAccess.get_file_as_string("res://tracks.cfg")) for track in tracks: |