From c8956dc38baa905eaf2877bcea673edbdac3e57b Mon Sep 17 00:00:00 2001 From: Rendo Date: Thu, 3 Jul 2025 23:50:14 +0500 Subject: [PATCH] almanach button --- scenes/gui/almanach.gd | 5 ++ scenes/gui/almanach.gd.uid | 1 + scenes/gui/almanach.tscn | 63 ++++++++++++++++++------- scenes/gui/choose_your_seeds.tscn | 31 +++++++++++- scenes/main_menu.tscn | 18 +++++-- scripts/components/gui/menu_buttons.gd | 5 ++ translations/plants.en.translation | Bin 3102 -> 1205 bytes 7 files changed, 102 insertions(+), 21 deletions(-) create mode 100644 scenes/gui/almanach.gd create mode 100644 scenes/gui/almanach.gd.uid diff --git a/scenes/gui/almanach.gd b/scenes/gui/almanach.gd new file mode 100644 index 0000000..c7e60de --- /dev/null +++ b/scenes/gui/almanach.gd @@ -0,0 +1,5 @@ +extends TabContainer + +func _on_quit_button_pressed() -> void: + visible = false + $ChannelPlayer.call("Play") diff --git a/scenes/gui/almanach.gd.uid b/scenes/gui/almanach.gd.uid new file mode 100644 index 0000000..4a51bc8 --- /dev/null +++ b/scenes/gui/almanach.gd.uid @@ -0,0 +1 @@ +uid://bs1qywtqijyd2 diff --git a/scenes/gui/almanach.tscn b/scenes/gui/almanach.tscn index 7073275..f0b6f7c 100644 --- a/scenes/gui/almanach.tscn +++ b/scenes/gui/almanach.tscn @@ -1,15 +1,18 @@ -[gd_scene load_steps=7 format=3 uid="uid://bvpt0q4j6nx18"] +[gd_scene load_steps=10 format=3 uid="uid://bvpt0q4j6nx18"] [ext_resource type="Texture2D" uid="uid://dr8a0rx42o3qy" path="res://assets/sprites/gui/ChooseYourSeeds/PlantFrame.tres" id="1_1hnxi"] +[ext_resource type="Script" uid="uid://bs1qywtqijyd2" path="res://scenes/gui/almanach.gd" id="1_oy57w"] [ext_resource type="Script" uid="uid://0mvmfvwe1bc7" path="res://scripts/components/gui/almanach/AlmanachGrid.cs" id="1_ru62c"] [ext_resource type="Script" uid="uid://covbig00p22di" path="res://scripts/components/gui/choose_your_seeds/Previewport.cs" id="2_ru62c"] [ext_resource type="Texture2D" uid="uid://dycdvvgmgmfu6" path="res://assets/sprites/gui/ChooseYourSeeds/FrameField.tres" id="3_oy57w"] +[ext_resource type="Script" uid="uid://c36bj8u7jghc7" path="res://scripts/audio/ChannelPlayer.cs" id="6_7vo1l"] +[ext_resource type="AudioStream" uid="uid://bdx83fokp6kha" path="res://assets/audio/sfx/buttonclick.mp3" id="7_vvhxq"] [sub_resource type="ViewportTexture" id="ViewportTexture_ru62c"] -viewport_path = NodePath("plants/Infobox/FrameAndTitle/Frame/Previewport") +viewport_path = NodePath("plants/Infobox/FrameAndTitle/VboxContainer/Frame/Previewport") [sub_resource type="ViewportTexture" id="ViewportTexture_7yl8g"] -viewport_path = NodePath("zombies/Infobox/FrameAndTitle/Frame/Previewport") +viewport_path = NodePath("zombies/Infobox/FrameAndTitle/VBoxContainer/Frame/Previewport") [node name="Almanach" type="TabContainer"] anchors_preset = 15 @@ -19,6 +22,7 @@ grow_horizontal = 2 grow_vertical = 2 tab_alignment = 1 current_tab = 0 +script = ExtResource("1_oy57w") [node name="plants" type="HBoxContainer" parent="."] layout_mode = 2 @@ -40,26 +44,29 @@ size_flags_horizontal = 3 [node name="FrameAndTitle" type="HBoxContainer" parent="plants/Infobox"] layout_mode = 2 -[node name="Frame" type="TextureRect" parent="plants/Infobox/FrameAndTitle"] +[node name="VboxContainer" type="VBoxContainer" parent="plants/Infobox/FrameAndTitle"] +layout_mode = 2 + +[node name="Frame" type="TextureRect" parent="plants/Infobox/FrameAndTitle/VboxContainer"] clip_contents = true layout_mode = 2 size_flags_horizontal = 0 size_flags_vertical = 0 texture = ExtResource("1_1hnxi") -[node name="Previewport" type="SubViewport" parent="plants/Infobox/FrameAndTitle/Frame" node_paths=PackedStringArray("title", "description")] +[node name="Previewport" type="SubViewport" parent="plants/Infobox/FrameAndTitle/VboxContainer/Frame" node_paths=PackedStringArray("title", "description")] canvas_item_default_texture_filter = 0 size = Vector2i(65, 65) script = ExtResource("2_ru62c") -title = NodePath("../../Label") -description = NodePath("../../../Description/ScrollContainer/RichTextLabel") +title = NodePath("../../../Label") +description = NodePath("../../../../Description/ScrollContainer/RichTextLabel") -[node name="FrameField" type="Sprite2D" parent="plants/Infobox/FrameAndTitle/Frame/Previewport"] +[node name="FrameField" type="Sprite2D" parent="plants/Infobox/FrameAndTitle/VboxContainer/Frame/Previewport"] texture = ExtResource("3_oy57w") -[node name="Camera2D" type="Camera2D" parent="plants/Infobox/FrameAndTitle/Frame/Previewport"] +[node name="Camera2D" type="Camera2D" parent="plants/Infobox/FrameAndTitle/VboxContainer/Frame/Previewport"] -[node name="Render" type="TextureRect" parent="plants/Infobox/FrameAndTitle/Frame"] +[node name="Render" type="TextureRect" parent="plants/Infobox/FrameAndTitle/VboxContainer/Frame"] show_behind_parent = true layout_mode = 1 anchors_preset = 15 @@ -69,6 +76,11 @@ grow_horizontal = 2 grow_vertical = 2 texture = SubResource("ViewportTexture_ru62c") +[node name="QuitButton" type="Button" parent="plants/Infobox/FrameAndTitle/VboxContainer"] +layout_mode = 2 +size_flags_vertical = 4 +text = "exit" + [node name="Label" type="Label" parent="plants/Infobox/FrameAndTitle"] layout_mode = 2 size_flags_horizontal = 3 @@ -115,27 +127,30 @@ size_flags_horizontal = 3 [node name="FrameAndTitle" type="HBoxContainer" parent="zombies/Infobox"] layout_mode = 2 -[node name="Frame" type="TextureRect" parent="zombies/Infobox/FrameAndTitle"] +[node name="VBoxContainer" type="VBoxContainer" parent="zombies/Infobox/FrameAndTitle"] +layout_mode = 2 + +[node name="Frame" type="TextureRect" parent="zombies/Infobox/FrameAndTitle/VBoxContainer"] clip_contents = true layout_mode = 2 size_flags_horizontal = 0 size_flags_vertical = 0 texture = ExtResource("1_1hnxi") -[node name="Previewport" type="SubViewport" parent="zombies/Infobox/FrameAndTitle/Frame" node_paths=PackedStringArray("title", "description")] +[node name="Previewport" type="SubViewport" parent="zombies/Infobox/FrameAndTitle/VBoxContainer/Frame" node_paths=PackedStringArray("title", "description")] canvas_item_default_texture_filter = 0 size = Vector2i(130, 130) script = ExtResource("2_ru62c") -title = NodePath("../../Label") -description = NodePath("../../../Description/ScrollContainer/RichTextLabel") +title = NodePath("../../../Label") +description = NodePath("../../../../Description/ScrollContainer/RichTextLabel") -[node name="FrameField" type="Sprite2D" parent="zombies/Infobox/FrameAndTitle/Frame/Previewport"] +[node name="FrameField" type="Sprite2D" parent="zombies/Infobox/FrameAndTitle/VBoxContainer/Frame/Previewport"] texture = ExtResource("3_oy57w") -[node name="Camera2D" type="Camera2D" parent="zombies/Infobox/FrameAndTitle/Frame/Previewport"] +[node name="Camera2D" type="Camera2D" parent="zombies/Infobox/FrameAndTitle/VBoxContainer/Frame/Previewport"] position = Vector2(0, -45) -[node name="Render" type="TextureRect" parent="zombies/Infobox/FrameAndTitle/Frame"] +[node name="Render" type="TextureRect" parent="zombies/Infobox/FrameAndTitle/VBoxContainer/Frame"] show_behind_parent = true layout_mode = 1 anchors_preset = 15 @@ -146,6 +161,11 @@ grow_vertical = 2 texture = SubResource("ViewportTexture_7yl8g") expand_mode = 1 +[node name="QuitButton" type="Button" parent="zombies/Infobox/FrameAndTitle/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 4 +text = "exit" + [node name="Label" type="Label" parent="zombies/Infobox/FrameAndTitle"] layout_mode = 2 size_flags_horizontal = 3 @@ -169,3 +189,12 @@ size_flags_vertical = 3 theme_override_colors/default_color = Color(0, 0, 0, 1) theme_override_colors/font_selected_color = Color(0, 0, 0, 1) bbcode_enabled = true + +[node name="ChannelPlayer" type="Node" parent="."] +script = ExtResource("6_7vo1l") +audioStream = ExtResource("7_vvhxq") +channel = "button" +metadata/_custom_type_script = "uid://c36bj8u7jghc7" + +[connection signal="pressed" from="plants/Infobox/FrameAndTitle/VboxContainer/QuitButton" to="." method="_on_quit_button_pressed"] +[connection signal="pressed" from="zombies/Infobox/FrameAndTitle/VBoxContainer/QuitButton" to="." method="_on_quit_button_pressed"] diff --git a/scenes/gui/choose_your_seeds.tscn b/scenes/gui/choose_your_seeds.tscn index 7ee96bc..7279861 100644 --- a/scenes/gui/choose_your_seeds.tscn +++ b/scenes/gui/choose_your_seeds.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=16 format=3 uid="uid://dpxxjfd5lv5sv"] +[gd_scene load_steps=19 format=3 uid="uid://dpxxjfd5lv5sv"] [ext_resource type="Theme" uid="uid://e8n88g31w7x7" path="res://resources/themes/ChooseYourSeeds.tres" id="1_bfo8i"] [ext_resource type="Texture2D" uid="uid://dr8a0rx42o3qy" path="res://assets/sprites/gui/ChooseYourSeeds/PlantFrame.tres" id="2_so2bw"] @@ -7,8 +7,10 @@ [ext_resource type="Script" uid="uid://eq3ecja30mlj" path="res://scripts/components/gui/choose_your_seeds/GridLoader.cs" id="4_i7sou"] [ext_resource type="PackedScene" uid="uid://10b1egek6upx" path="res://scenes/gui/level_run_button.tscn" id="5_n80ic"] [ext_resource type="Script" uid="uid://d26waisd3v488" path="res://scripts/components/gui/choose_your_seeds/LevelRunButton.cs" id="7_k6b6g"] +[ext_resource type="Texture2D" uid="uid://drydueofrb448" path="res://assets/sprites/gui/almanach/book.tres" id="8_hmdmm"] [ext_resource type="Script" uid="uid://c36bj8u7jghc7" path="res://scripts/audio/ChannelPlayer.cs" id="8_v7xff"] [ext_resource type="AudioStream" uid="uid://bdx83fokp6kha" path="res://assets/audio/sfx/buttonclick.mp3" id="9_v7xff"] +[ext_resource type="PackedScene" uid="uid://bvpt0q4j6nx18" path="res://scenes/gui/almanach.tscn" id="11_nlh6x"] [sub_resource type="Animation" id="Animation_0rps3"] resource_name = "Hide" @@ -106,6 +108,16 @@ viewport_path = NodePath("Panel/MarginContainer/VBoxContainer/HBoxContainer/Fram font_size = 24 font_color = Color(0, 0, 0, 1) +[sub_resource type="GDScript" id="GDScript_hmdmm"] +resource_name = "Almanach" +script/source = "extends Button + + +func _pressed() -> void: + $\"../../Independer/Almanach\".visible = true + $\"../../ChannelPlayer\".call(\"Play\") +" + [node name="ChooseYourSeeds" type="Control"] process_mode = 3 layout_mode = 3 @@ -222,10 +234,27 @@ offset_bottom = -16.016 script = ExtResource("7_k6b6g") _player = NodePath("../../AnimationPlayer") +[node name="AlmanachButton" type="Button" parent="Panel"] +layout_mode = 0 +anchor_left = 1.0 +anchor_top = 0.883929 +anchor_right = 1.14167 +anchor_bottom = 1.0 +offset_bottom = -3.05176e-05 +icon = ExtResource("8_hmdmm") +icon_alignment = 1 +script = SubResource("GDScript_hmdmm") +metadata/_edit_use_anchors_ = true + [node name="ChannelPlayer" type="Node" parent="."] script = ExtResource("8_v7xff") audioStream = ExtResource("9_v7xff") channel = "button" metadata/_custom_type_script = "uid://c36bj8u7jghc7" +[node name="Independer" type="Node" parent="."] + +[node name="Almanach" parent="Independer" instance=ExtResource("11_nlh6x")] +visible = false + [connection signal="pressed" from="Panel/LevelRunButton" to="ChannelPlayer" method="Play"] diff --git a/scenes/main_menu.tscn b/scenes/main_menu.tscn index 2df74f2..060e4ad 100644 --- a/scenes/main_menu.tscn +++ b/scenes/main_menu.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=14 format=3 uid="uid://bfstrli64u23y"] +[gd_scene load_steps=16 format=3 uid="uid://bfstrli64u23y"] [ext_resource type="Texture2D" uid="uid://dvldjlg0nr355" path="res://assets/sprites/atlases/atlas1.png" id="1_jk1qb"] [ext_resource type="Script" uid="uid://drru785m4eep" path="res://scripts/components/gui/main_menu_rich_text.gd" id="2_5dd4i"] @@ -8,8 +8,10 @@ [ext_resource type="Script" uid="uid://c06k4k3ww48ev" path="res://scripts/components/gui/menu_buttons.gd" id="5_rcqid"] [ext_resource type="Script" uid="uid://6e8n6kc0y11o" path="res://scripts/sacrifice.gd" id="6_1ajci"] [ext_resource type="Script" uid="uid://c36bj8u7jghc7" path="res://scripts/audio/ChannelPlayer.cs" id="7_7b55j"] +[ext_resource type="Texture2D" uid="uid://drydueofrb448" path="res://assets/sprites/gui/almanach/book.tres" id="7_flqon"] [ext_resource type="AudioStream" uid="uid://bdx83fokp6kha" path="res://assets/audio/sfx/buttonclick.mp3" id="8_5pajh"] [ext_resource type="AudioStream" uid="uid://djgyc7bbwcepp" path="res://assets/audio/music/Александр Зацепин - Увертюра.mp3" id="9_j7ex8"] +[ext_resource type="PackedScene" uid="uid://bvpt0q4j6nx18" path="res://scenes/gui/almanach.tscn" id="12_rcqid"] [sub_resource type="GDScript" id="GDScript_5dd4i"] resource_name = "main_menu" @@ -135,10 +137,15 @@ offset_top = 188.0 offset_right = 86.0 offset_bottom = 235.0 -[node name="Button" type="Button" parent="Buttons/InfoButtons"] +[node name="AboutButton" type="Button" parent="Buttons/InfoButtons"] layout_mode = 2 text = "about" +[node name="AlmanachButton" type="Button" parent="Buttons/InfoButtons"] +layout_mode = 2 +icon = ExtResource("7_flqon") +icon_alignment = 1 + [node name="SACRIFICE" type="TextureButton" parent="Buttons"] layout_mode = 0 offset_left = 338.0 @@ -167,9 +174,14 @@ volume_db = -20.0 autoplay = true bus = &"MusicBus" +[node name="Almanach" parent="." instance=ExtResource("12_rcqid")] +visible = false +layout_mode = 1 + [connection signal="meta_clicked" from="PrototypeWindow/ScrollContainer/PrototypeNotification" to="PrototypeWindow/ScrollContainer/PrototypeNotification" method="_on_meta_clicked"] [connection signal="pressed" from="Buttons/GameButtons/PlayButton" to="Buttons" method="_on_play_button_pressed"] [connection signal="pressed" from="Buttons/GameButtons/ExitButton" to="Buttons" method="_on_exit_button_pressed"] -[connection signal="pressed" from="Buttons/InfoButtons/Button" to="Buttons" method="_on_button_pressed"] +[connection signal="pressed" from="Buttons/InfoButtons/AboutButton" to="Buttons" method="_on_button_pressed"] +[connection signal="pressed" from="Buttons/InfoButtons/AlmanachButton" to="Buttons" method="_on_almanach_button_pressed"] [connection signal="close_requested" from="Buttons/SACRIFICE/CONFIRM" to="Buttons/SACRIFICE" method="_on_confirm_close_requested"] [connection signal="confirmed" from="Buttons/SACRIFICE/CONFIRM" to="Buttons/SACRIFICE" method="_on_confirm_confirmed"] diff --git a/scripts/components/gui/menu_buttons.gd b/scripts/components/gui/menu_buttons.gd index e6682e4..9c89ded 100644 --- a/scripts/components/gui/menu_buttons.gd +++ b/scripts/components/gui/menu_buttons.gd @@ -14,3 +14,8 @@ func _on_exit_button_pressed() -> void: func _on_button_pressed() -> void: $"../AboutWindow".popup_centered() $ChannelPlayer.call("Play") + + +func _on_almanach_button_pressed() -> void: + $"../Almanach".visible = true + $ChannelPlayer.call("Play") diff --git a/translations/plants.en.translation b/translations/plants.en.translation index b6310f1cd2f42e3731f7c22320dc701cd24c0bd5..80e6a4e00da9602b4a74c264832f6155fef0d377 100644 GIT binary patch literal 1205 zcmV;m1WNl-Q$s@n000005C8xm3;+O~1ONaiwJ-f(APb!&0EYC%N`RVm4zgvI6(*i0 zw=rV%v%5?Yn>iY4w@)_jsZb%k%1LN+5Pipc`G{(K?!6yoa${AT@=B;~Re8Q>Eh*mk z=3hcZw@I7f+m-VU9XV`e0-`JR39_u*y|F{2F-z8E~wIymt>HlF*A7v#x z*EF0&DiN!YpJXNS=>HA;e;WG_o#wzPSA&idy~Yj&tf{S6+)tO-KR(XAe|5?K>s0xF zDE~58ff$vQs`3QcBKH5+@&7gcH-Rl284!y4xbl5~t^R+DP5VcSAcI~^H^Ah0q5u2me;@dl zVX0M+!Nk5&^eBVlVM)-mfI+k;{O{dA%t;q3X^zbPpZ}+4t{4S3s;wQLldckvF4}y> z-pGLHQ93zJ7d6sS!k$QNE}I`(i=f1StJ6OhIhBan)0T&i$0=sUvwrfj5$3jiYp@oIva_UgfD9=fl!x#4xXDER6+9~$iOvSljp|o06 zz$urtF+1pXUq?G~99lFVB~?I{+2C%Y+ykg2LecZ{9joaZYYD@q$I_>rpG4G`mXbW!)e}@HmpA z9u)oG)P|F_sv7L)%a~eoII?gS#);+zAaw`*CdGNUs7**9^cob==Y-v^1`S-#t!{b| z8mjG$2aa~p#3=B>S*e~|4NS&R$JqqEw9si?(DGf;{1OuLc|~!5LQWm`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