From 1249fa186b4cb613cd0a549d39311a8a54fe8204 Mon Sep 17 00:00:00 2001 From: Nordup Date: Wed, 14 Jun 2023 00:06:30 +0300 Subject: [PATCH] menu body --- project/scenes/menu.tscn | 468 +----------------- project/scripts/ui/menu/bookmark_container.gd | 2 +- project/scripts/ui/menu/bottom_animation.gd | 13 - project/scripts/ui/menu/menu_animation.gd | 13 - 4 files changed, 28 insertions(+), 468 deletions(-) delete mode 100644 project/scripts/ui/menu/bottom_animation.gd delete mode 100644 project/scripts/ui/menu/menu_animation.gd diff --git a/project/scenes/menu.tscn b/project/scenes/menu.tscn index 22759e6..f5b7aaf 100644 --- a/project/scenes/menu.tscn +++ b/project/scenes/menu.tscn @@ -1,13 +1,9 @@ -[gd_scene load_steps=18 format=3 uid="uid://5btb7nvgmfhl"] +[gd_scene load_steps=9 format=3 uid="uid://5btb7nvgmfhl"] [ext_resource type="Texture2D" uid="uid://dystd8vvbqwo2" path="res://textures/exit.svg" id="3_1a6fk"] [ext_resource type="Script" path="res://scripts/ui/menu/exit_app.gd" id="4_2065t"] -[ext_resource type="Script" path="res://scripts/ui/menu/bottom_animation.gd" id="4_c1cpy"] [ext_resource type="PackedScene" uid="uid://ctam0fxigbefk" path="res://scenes/components/search.tscn" id="5_li2do"] -[ext_resource type="PackedScene" path="res://scenes/components/hint.tscn" id="5_nsugo"] [ext_resource type="Resource" uid="uid://bewhdj6jugt6q" path="res://resources/bookmarks.tres" id="7_ern1s"] -[ext_resource type="Script" path="res://scripts/ui/menu/menu_animation.gd" id="7_ljms6"] -[ext_resource type="Texture2D" uid="uid://bpj05amcrq1cq" path="res://textures/slide-up.png" id="7_qsgsx"] [ext_resource type="Script" path="res://scripts/ui/menu/bookmark_container.gd" id="7_wj13t"] [ext_resource type="PackedScene" uid="uid://82ca8so31njy" path="res://scenes/components/bookmark.tscn" id="8_h7tks"] @@ -17,204 +13,6 @@ bg_color = Color(0.156863, 0.156863, 0.156863, 1) [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_re7ca"] bg_color = Color(0.231373, 0.184314, 0.541176, 1) -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ugnti"] -bg_color = Color(0.16, 0.16, 0.16, 0.67) -border_width_top = 3 -border_color = Color(0.231373, 0.184314, 0.541176, 1) - -[sub_resource type="Animation" id="Animation_voms2"] -length = 0.2 -loop_mode = 2 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Bottom/SlideButtons/SlideDown:visible") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [false] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Bottom/SlideButtons/SlideUp:visible") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [true] -} -tracks/2/type = "value" -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/path = NodePath("Bottom/SlideButtons/SlideDown:rotation") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [0.0] -} -tracks/3/type = "value" -tracks/3/imported = false -tracks/3/enabled = true -tracks/3/path = NodePath("Bottom/SlideButtons/SlideUp:rotation") -tracks/3/interp = 1 -tracks/3/loop_wrap = true -tracks/3/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [0.0] -} - -[sub_resource type="Animation" id="Animation_dcb22"] -resource_name = "hide_favorites" -length = 0.2 -step = 0.05 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Bottom/SlideButtons/SlideUp:visible") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 0.2), -"transitions": PackedFloat32Array(1, 1), -"update": 1, -"values": [false, true] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Bottom/SlideButtons/SlideDown:visible") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0, 0.2), -"transitions": PackedFloat32Array(1, 1), -"update": 1, -"values": [true, false] -} -tracks/2/type = "value" -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/path = NodePath("Bottom/SlideButtons/SlideDown:rotation") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/keys = { -"times": PackedFloat32Array(0, 0.2), -"transitions": PackedFloat32Array(1, 1), -"update": 0, -"values": [0.0, -3.14159] -} -tracks/3/type = "value" -tracks/3/imported = false -tracks/3/enabled = true -tracks/3/path = NodePath("Bottom/SlideButtons/SlideUp:rotation") -tracks/3/interp = 1 -tracks/3/loop_wrap = true -tracks/3/keys = { -"times": PackedFloat32Array(0.2), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [0.0] -} -tracks/4/type = "method" -tracks/4/imported = false -tracks/4/enabled = true -tracks/4/path = NodePath("Bottom") -tracks/4/interp = 1 -tracks/4/loop_wrap = true -tracks/4/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"values": [{ -"args": [0.2], -"method": &"_hide" -}] -} - -[sub_resource type="Animation" id="Animation_pq70r"] -resource_name = "MenuAnimations" -length = 0.2 -step = 0.05 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Bottom/SlideButtons/SlideUp:rotation") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 0.2), -"transitions": PackedFloat32Array(1, 1), -"update": 0, -"values": [0.0, 3.14159] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Bottom/SlideButtons/SlideDown:visible") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0, 0.2), -"transitions": PackedFloat32Array(1, 1), -"update": 1, -"values": [false, true] -} -tracks/2/type = "value" -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/path = NodePath("Bottom/SlideButtons/SlideUp:visible") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/keys = { -"times": PackedFloat32Array(0, 0.2), -"transitions": PackedFloat32Array(1, 1), -"update": 1, -"values": [true, false] -} -tracks/3/type = "value" -tracks/3/imported = false -tracks/3/enabled = true -tracks/3/path = NodePath("Bottom/SlideButtons/SlideDown:rotation") -tracks/3/interp = 1 -tracks/3/loop_wrap = true -tracks/3/keys = { -"times": PackedFloat32Array(0.2), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [0.0] -} -tracks/4/type = "method" -tracks/4/imported = false -tracks/4/enabled = true -tracks/4/path = NodePath("Bottom") -tracks/4/interp = 1 -tracks/4/loop_wrap = true -tracks/4/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"values": [{ -"args": [0.2], -"method": &"_show" -}] -} - -[sub_resource type="AnimationLibrary" id="AnimationLibrary_idmlf"] -_data = { -"RESET": SubResource("Animation_voms2"), -"hide_favorites": SubResource("Animation_dcb22"), -"show_favorites": SubResource("Animation_pq70r") -} - [node name="Menu" type="Control"] layout_mode = 3 anchors_preset = 15 @@ -222,7 +20,6 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -metadata/_edit_lock_ = true [node name="Background" type="Panel" parent="."] layout_mode = 0 @@ -232,14 +29,20 @@ grow_horizontal = 2 grow_vertical = 2 theme_override_styles/panel = SubResource("StyleBoxFlat_pveoh") -[node name="SearchBar" type="Control" parent="."] -custom_minimum_size = Vector2(0, 60) +[node name="VBoxContainer" type="VBoxContainer" parent="."] layout_mode = 1 -anchors_preset = 10 +anchors_preset = 15 anchor_right = 1.0 +anchor_bottom = 1.0 grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/separation = 0 -[node name="Background" type="Panel" parent="SearchBar"] +[node name="Top" type="Control" parent="VBoxContainer"] +custom_minimum_size = Vector2(0, 60) +layout_mode = 2 + +[node name="Background" type="Panel" parent="VBoxContainer/Top"] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -248,12 +51,12 @@ grow_horizontal = 2 grow_vertical = 2 theme_override_styles/panel = SubResource("StyleBoxFlat_re7ca") -[node name="Search" parent="SearchBar" instance=ExtResource("5_li2do")] +[node name="Search" parent="VBoxContainer/Top" instance=ExtResource("5_li2do")] layout_mode = 1 offset_top = -20.0 offset_bottom = 20.0 -[node name="Exit" type="BaseButton" parent="SearchBar"] +[node name="Exit" type="BaseButton" parent="VBoxContainer/Top"] _import_path = NodePath("") unique_name_in_owner = false process_mode = 0 @@ -322,7 +125,7 @@ shortcut_feedback = true shortcut_in_tooltip = true script = ExtResource("4_2065t") -[node name="TextureRect" type="TextureRect" parent="SearchBar/Exit"] +[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Top/Exit"] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -334,247 +137,30 @@ size_flags_vertical = 4 texture = ExtResource("3_1a6fk") expand_mode = 1 -[node name="Bottom" type="Control" parent="."] -layout_mode = 1 -anchors_preset = 12 -anchor_top = 1.0 -anchor_right = 1.0 -anchor_bottom = 1.0 -offset_bottom = 250.0 -grow_horizontal = 2 -grow_vertical = 0 -pivot_offset = Vector2(960, 250) -script = ExtResource("4_c1cpy") +[node name="Body" type="Control" parent="VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 -[node name="Background" type="Panel" parent="Bottom"] -layout_mode = 0 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -theme_override_styles/panel = SubResource("StyleBoxFlat_ugnti") - -[node name="SlideButtons" type="Control" parent="Bottom"] +[node name="Bookmarks" type="ScrollContainer" parent="VBoxContainer/Body"] +custom_minimum_size = Vector2(1200, 400) layout_mode = 1 -anchors_preset = 5 +anchors_preset = 8 anchor_left = 0.5 -anchor_right = 0.5 -offset_left = -615.0 -offset_top = -130.0 -offset_right = -535.0 -offset_bottom = -50.0 -grow_horizontal = 2 -pivot_offset = Vector2(40, 40) -focus_mode = 2 - -[node name="Hint" parent="Bottom/SlideButtons" node_paths=PackedStringArray("button") instance=ExtResource("5_nsugo")] -layout_mode = 1 -offset_left = -85.0 -offset_right = 85.0 -key = "hint_bookmarks" -button = NodePath("../SlideUp") - -[node name="AnimRoot" parent="Bottom/SlideButtons/Hint" index="0"] -layout_mode = 1 - -[node name="Background" parent="Bottom/SlideButtons/Hint/AnimRoot" index="0"] -layout_mode = 1 - -[node name="Label" parent="Bottom/SlideButtons/Hint/AnimRoot" index="1"] -layout_mode = 1 -text = "Open bookmarks!" - -[node name="TextureRect" parent="Bottom/SlideButtons/Hint/AnimRoot" index="2"] -layout_mode = 1 -expand_mode = 1 - -[node name="SlideUp" type="BaseButton" parent="Bottom/SlideButtons"] -_import_path = NodePath("") -unique_name_in_owner = false -process_mode = 0 -process_priority = 0 -editor_description = "" -visible = true -modulate = Color(1, 1, 1, 1) -self_modulate = Color(1, 1, 1, 1) -show_behind_parent = false -top_level = false -clip_children = 0 -light_mask = 1 -visibility_layer = 1 -z_index = 0 -z_as_relative = true -y_sort_enabled = false -texture_filter = 0 -texture_repeat = 0 -material = null -use_parent_material = false -clip_contents = false -custom_minimum_size = Vector2(0, 0) -layout_direction = 0 -layout_mode = 1 -anchors_preset = 5 -anchor_left = 0.5 -anchor_top = 0.0 -anchor_right = 0.5 -anchor_bottom = 0.0 -offset_left = -40.0 -offset_top = 0.0 -offset_right = 40.0 -offset_bottom = 80.0 -grow_horizontal = 2 -grow_vertical = 1 -rotation = 0.0 -scale = Vector2(1, 1) -pivot_offset = Vector2(40, 40) -size_flags_horizontal = 1 -size_flags_vertical = 1 -size_flags_stretch_ratio = 1.0 -auto_translate = true -localize_numeral_system = true -tooltip_text = "" -focus_neighbor_left = NodePath("") -focus_neighbor_top = NodePath("") -focus_neighbor_right = NodePath("") -focus_neighbor_bottom = NodePath("") -focus_next = NodePath("") -focus_previous = NodePath("") -focus_mode = 2 -mouse_filter = 0 -mouse_force_pass_scroll_events = true -mouse_default_cursor_shape = 2 -theme = null -theme_type_variation = &"" -disabled = false -toggle_mode = false -button_pressed = false -action_mode = 1 -button_mask = 1 -keep_pressed_outside = false -button_group = null -shortcut = null -shortcut_feedback = true -shortcut_in_tooltip = true -script = null - -[node name="TextureRect" type="TextureRect" parent="Bottom/SlideButtons/SlideUp"] -layout_mode = 0 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -texture = ExtResource("7_qsgsx") - -[node name="SlideDown" type="BaseButton" parent="Bottom/SlideButtons"] -_import_path = NodePath("") -unique_name_in_owner = false -process_mode = 0 -process_priority = 0 -editor_description = "" -visible = false -modulate = Color(1, 1, 1, 1) -self_modulate = Color(1, 1, 1, 1) -show_behind_parent = false -top_level = false -clip_children = 0 -light_mask = 1 -visibility_layer = 1 -z_index = 0 -z_as_relative = true -y_sort_enabled = false -texture_filter = 0 -texture_repeat = 0 -material = null -use_parent_material = false -clip_contents = false -custom_minimum_size = Vector2(0, 0) -layout_direction = 0 -layout_mode = 1 -anchors_preset = 5 -anchor_left = 0.5 -anchor_top = 0.0 -anchor_right = 0.5 -anchor_bottom = 0.0 -offset_left = -40.0 -offset_top = 0.0 -offset_right = 40.0 -offset_bottom = 80.0 -grow_horizontal = 2 -grow_vertical = 1 -rotation = 0.0 -scale = Vector2(1, 1) -pivot_offset = Vector2(40, 40) -size_flags_horizontal = 1 -size_flags_vertical = 1 -size_flags_stretch_ratio = 1.0 -auto_translate = true -localize_numeral_system = true -tooltip_text = "" -focus_neighbor_left = NodePath("") -focus_neighbor_top = NodePath("") -focus_neighbor_right = NodePath("") -focus_neighbor_bottom = NodePath("") -focus_next = NodePath("") -focus_previous = NodePath("") -focus_mode = 2 -mouse_filter = 0 -mouse_force_pass_scroll_events = true -mouse_default_cursor_shape = 2 -theme = null -theme_type_variation = &"" -disabled = false -toggle_mode = false -button_pressed = false -action_mode = 1 -button_mask = 1 -keep_pressed_outside = false -button_group = null -shortcut = null -shortcut_feedback = true -shortcut_in_tooltip = true -script = null - -[node name="TextureRect" type="TextureRect" parent="Bottom/SlideButtons/SlideDown"] -layout_mode = 0 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -rotation = 3.14159 -pivot_offset = Vector2(40, 40) -texture = ExtResource("7_qsgsx") - -[node name="Bookmarks" type="ScrollContainer" parent="Bottom"] -layout_mode = 0 anchor_top = 0.5 -anchor_right = 1.0 +anchor_right = 0.5 anchor_bottom = 0.5 -offset_top = -94.0 -offset_bottom = 106.0 +offset_top = -100.0 +offset_bottom = 100.0 grow_horizontal = 2 grow_vertical = 2 follow_focus = true -vertical_scroll_mode = 0 +horizontal_scroll_mode = 0 -[node name="HBoxContainer" type="HBoxContainer" parent="Bottom/Bookmarks"] -custom_minimum_size = Vector2(0, 160) +[node name="GridContainer" type="GridContainer" parent="VBoxContainer/Body/Bookmarks"] layout_mode = 2 -size_flags_horizontal = 3 -size_flags_vertical = 6 -theme_override_constants/separation = 30 -alignment = 1 +columns = 6 script = ExtResource("7_wj13t") bookmarks = ExtResource("7_ern1s") bookmark_scene = ExtResource("8_h7tks") -[node name="AnimationPlayer" type="AnimationPlayer" parent="."] -libraries = { -"": SubResource("AnimationLibrary_idmlf") -} -script = ExtResource("7_ljms6") - -[connection signal="pressed" from="SearchBar/Exit" to="SearchBar/Exit" method="_on_pressed"] -[connection signal="pressed" from="Bottom/SlideButtons/SlideUp" to="AnimationPlayer" method="_on_slide_up_pressed"] -[connection signal="pressed" from="Bottom/SlideButtons/SlideDown" to="AnimationPlayer" method="_on_slide_down_pressed"] - -[editable path="Bottom/SlideButtons/Hint"] +[connection signal="pressed" from="VBoxContainer/Top/Exit" to="VBoxContainer/Top/Exit" method="_on_pressed"] diff --git a/project/scripts/ui/menu/bookmark_container.gd b/project/scripts/ui/menu/bookmark_container.gd index 424b737..7a15c8b 100644 --- a/project/scripts/ui/menu/bookmark_container.gd +++ b/project/scripts/ui/menu/bookmark_container.gd @@ -1,4 +1,4 @@ -extends HBoxContainer +extends GridContainer @export var bookmarks: Bookmarks @export var bookmark_scene: PackedScene diff --git a/project/scripts/ui/menu/bottom_animation.gd b/project/scripts/ui/menu/bottom_animation.gd deleted file mode 100644 index e35bcd0..0000000 --- a/project/scripts/ui/menu/bottom_animation.gd +++ /dev/null @@ -1,13 +0,0 @@ -extends Control - - -func _show(duration: float) -> void: - var tween = get_tree().create_tween() - var shown_pos = Vector2(0, position.y - size.y) - tween.tween_property(self, "position", shown_pos, duration) - - -func _hide(duration: float) -> void: - var tween = get_tree().create_tween() - var hidden_pos = Vector2(0, position.y + size.y) - tween.tween_property(self, "position", hidden_pos, duration) diff --git a/project/scripts/ui/menu/menu_animation.gd b/project/scripts/ui/menu/menu_animation.gd deleted file mode 100644 index cd120fb..0000000 --- a/project/scripts/ui/menu/menu_animation.gd +++ /dev/null @@ -1,13 +0,0 @@ -extends AnimationPlayer - - -func _ready() -> void: - play("RESET") - - -func _on_slide_up_pressed() -> void: - play("show_favorites") - - -func _on_slide_down_pressed() -> void: - play("hide_favorites")