Working dialogue system

This commit is contained in:
2ndbeam 2024-05-19 17:14:52 +03:00
commit c0c68c8662
16 changed files with 267 additions and 103 deletions

182
scenes/Base/bas42D5.tmp Normal file
View file

@ -0,0 +1,182 @@
[gd_scene load_steps=8 format=3 uid="uid://crq284yed2if5"]
[ext_resource type="Script" path="res://scripts/Base/base_menu.gd" id="1_3hgu4"]
[ext_resource type="Theme" uid="uid://dmb8bcdghdjd" path="res://main_theme.tres" id="1_p1gsn"]
[ext_resource type="Texture2D" uid="uid://db4euprxhape0" path="res://sprites/9s.png" id="1_uf5rv"]
[ext_resource type="Texture2D" uid="uid://hxrx87gda3uf" path="res://sprites/Bases/Menu/end_communications.png" id="2_ceeiv"]
[ext_resource type="Script" path="res://scripts/Base/actions_menu.gd" id="4_3gtyd"]
[ext_resource type="Script" path="res://scripts/Base/close_button.gd" id="4_68ool"]
[ext_resource type="Resource" uid="uid://c4jg3vwtxskjm" path="res://menus/Base Menu/test_menu_1.tres" id="5_rkret"]
[node name="BaseMenu" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_p1gsn")
script = ExtResource("1_3hgu4")
[node name="MenuBackground" type="NinePatchRect" parent="."]
layout_mode = 0
offset_left = 40.0
offset_top = 40.0
offset_right = 1240.0
offset_bottom = 640.0
texture = ExtResource("1_uf5rv")
region_rect = Rect2(0, 0, 5, 5)
patch_margin_left = 2
patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
[node name="HeaderBackground" type="NinePatchRect" parent="MenuBackground"]
layout_mode = 0
offset_left = 2.0
offset_top = 2.0
offset_right = 1198.0
offset_bottom = 76.0
texture = ExtResource("1_uf5rv")
region_rect = Rect2(0, 0, 5, 5)
patch_margin_left = 2
patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
[node name="PortraitBackground" type="NinePatchRect" parent="MenuBackground"]
layout_mode = 0
offset_left = 2.0
offset_top = 77.0
offset_right = 324.0
offset_bottom = 598.0
texture = ExtResource("1_uf5rv")
region_rect = Rect2(0, 0, 5, 5)
patch_margin_left = 2
patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
[node name="DialogueBackground" type="NinePatchRect" parent="MenuBackground"]
layout_mode = 0
offset_left = 325.0
offset_top = 77.0
offset_right = 1198.0
offset_bottom = 399.0
texture = ExtResource("1_uf5rv")
region_rect = Rect2(0, 0, 5, 5)
patch_margin_left = 2
patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
[node name="RichTextLabel" type="RichTextLabel" parent="MenuBackground/DialogueBackground"]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.001
anchor_top = 0.003
anchor_right = 0.999
anchor_bottom = 0.997
offset_left = 0.127
offset_top = 0.034
offset_right = -0.127075
offset_bottom = -0.0340271
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 4
size_flags_vertical = 8
focus_mode = 2
bbcode_enabled = true
scroll_following = true
selection_enabled = true
[node name="ActionsBackground" type="NinePatchRect" parent="MenuBackground"]
layout_mode = 0
offset_left = 325.0
offset_top = 400.0
offset_right = 1198.0
offset_bottom = 598.0
texture = ExtResource("1_uf5rv")
region_rect = Rect2(0, 0, 5, 5)
patch_margin_left = 2
patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
[node name="ActionsMenu" type="GridContainer" parent="MenuBackground/ActionsBackground"]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.00114548
anchor_top = 0.00505051
anchor_right = 1.0
anchor_bottom = 0.99495
grow_horizontal = 2
grow_vertical = 2
columns = 2
script = ExtResource("4_3gtyd")
menu = ExtResource("5_rkret")
metadata/_edit_use_anchors_ = true
[node name="Action1" type="Button" parent="MenuBackground/ActionsBackground/ActionsMenu"]
clip_contents = true
custom_minimum_size = Vector2(434, 46)
layout_mode = 2
[node name="Action5" type="Button" parent="MenuBackground/ActionsBackground/ActionsMenu"]
clip_contents = true
custom_minimum_size = Vector2(434, 46)
layout_mode = 2
[node name="Action2" type="Button" parent="MenuBackground/ActionsBackground/ActionsMenu"]
clip_contents = true
custom_minimum_size = Vector2(434, 46)
layout_mode = 2
[node name="Action6" type="Button" parent="MenuBackground/ActionsBackground/ActionsMenu"]
clip_contents = true
custom_minimum_size = Vector2(434, 46)
layout_mode = 2
[node name="Action3" type="Button" parent="MenuBackground/ActionsBackground/ActionsMenu"]
clip_contents = true
custom_minimum_size = Vector2(434, 46)
layout_mode = 2
[node name="Action7" type="Button" parent="MenuBackground/ActionsBackground/ActionsMenu"]
clip_contents = true
custom_minimum_size = Vector2(434, 46)
layout_mode = 2
[node name="Action4" type="Button" parent="MenuBackground/ActionsBackground/ActionsMenu"]
clip_contents = true
custom_minimum_size = Vector2(434, 46)
layout_mode = 2
[node name="Action8" type="Button" parent="MenuBackground/ActionsBackground/ActionsMenu"]
clip_contents = true
custom_minimum_size = Vector2(434, 46)
layout_mode = 2
[node name="CloseButtonBackground" type="NinePatchRect" parent="MenuBackground"]
layout_mode = 0
offset_left = 1124.0
offset_top = 2.0
offset_right = 1198.0
offset_bottom = 76.0
texture = ExtResource("1_uf5rv")
region_rect = Rect2(0, 0, 5, 5)
patch_margin_left = 2
patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
[node name="CloseButton" type="Button" parent="MenuBackground/CloseButtonBackground"]
layout_mode = 0
offset_left = 1.0
offset_top = 1.0
offset_right = 73.0
offset_bottom = 73.0
icon = ExtResource("2_ceeiv")
script = ExtResource("4_68ool")
[connection signal="button_up" from="MenuBackground/CloseButtonBackground/CloseButton" to="MenuBackground/CloseButtonBackground/CloseButton" method="_on_button_up"]

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=8 format=3 uid="uid://crq284yed2if5"]
[gd_scene load_steps=9 format=3 uid="uid://crq284yed2if5"]
[ext_resource type="Script" path="res://scripts/Base/base_menu.gd" id="1_3hgu4"]
[ext_resource type="Theme" uid="uid://dmb8bcdghdjd" path="res://main_theme.tres" id="1_p1gsn"]
@ -6,6 +6,7 @@
[ext_resource type="Texture2D" uid="uid://hxrx87gda3uf" path="res://sprites/Bases/Menu/end_communications.png" id="2_ceeiv"]
[ext_resource type="Script" path="res://scripts/Base/actions_menu.gd" id="4_3gtyd"]
[ext_resource type="Script" path="res://scripts/Base/close_button.gd" id="4_68ool"]
[ext_resource type="Script" path="res://scripts/Base/Menu/dialogue.gd" id="4_swpa1"]
[ext_resource type="Resource" uid="uid://c4jg3vwtxskjm" path="res://menus/Base Menu/test_menu_1.tres" id="5_rkret"]
[node name="BaseMenu" type="Control"]
@ -31,7 +32,7 @@ patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
[node name="HeaderBackground" type="NinePatchRect" parent="MenuBackground"]
[node name="Header" type="NinePatchRect" parent="MenuBackground"]
layout_mode = 0
offset_left = 2.0
offset_top = 2.0
@ -44,7 +45,7 @@ patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
[node name="PortraitBackground" type="NinePatchRect" parent="MenuBackground"]
[node name="Portrait" type="NinePatchRect" parent="MenuBackground"]
layout_mode = 0
offset_left = 2.0
offset_top = 77.0
@ -57,7 +58,7 @@ patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
[node name="DialogueBackground" type="NinePatchRect" parent="MenuBackground"]
[node name="Dialogue" type="NinePatchRect" parent="MenuBackground"]
layout_mode = 0
offset_left = 325.0
offset_top = 77.0
@ -69,8 +70,9 @@ patch_margin_left = 2
patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
script = ExtResource("4_swpa1")
[node name="RichTextLabel" type="RichTextLabel" parent="MenuBackground/DialogueBackground"]
[node name="DialogueView" type="RichTextLabel" parent="MenuBackground/Dialogue"]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.001
@ -87,10 +89,11 @@ size_flags_horizontal = 4
size_flags_vertical = 8
focus_mode = 2
bbcode_enabled = true
text = "DIALOGUE_ENTRY_POINT"
scroll_following = true
selection_enabled = true
[node name="ActionsBackground" type="NinePatchRect" parent="MenuBackground"]
[node name="Actions" type="NinePatchRect" parent="MenuBackground"]
layout_mode = 0
offset_left = 325.0
offset_top = 400.0
@ -103,7 +106,7 @@ patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
[node name="ActionsMenu" type="GridContainer" parent="MenuBackground/ActionsBackground"]
[node name="ActionsMenu" type="GridContainer" parent="MenuBackground/Actions"]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.00114548
@ -117,47 +120,47 @@ script = ExtResource("4_3gtyd")
menu = ExtResource("5_rkret")
metadata/_edit_use_anchors_ = true
[node name="Action1" type="Button" parent="MenuBackground/ActionsBackground/ActionsMenu"]
[node name="Action1" type="Button" parent="MenuBackground/Actions/ActionsMenu"]
clip_contents = true
custom_minimum_size = Vector2(434, 46)
layout_mode = 2
[node name="Action5" type="Button" parent="MenuBackground/ActionsBackground/ActionsMenu"]
[node name="Action5" type="Button" parent="MenuBackground/Actions/ActionsMenu"]
clip_contents = true
custom_minimum_size = Vector2(434, 46)
layout_mode = 2
[node name="Action2" type="Button" parent="MenuBackground/ActionsBackground/ActionsMenu"]
[node name="Action2" type="Button" parent="MenuBackground/Actions/ActionsMenu"]
clip_contents = true
custom_minimum_size = Vector2(434, 46)
layout_mode = 2
[node name="Action6" type="Button" parent="MenuBackground/ActionsBackground/ActionsMenu"]
[node name="Action6" type="Button" parent="MenuBackground/Actions/ActionsMenu"]
clip_contents = true
custom_minimum_size = Vector2(434, 46)
layout_mode = 2
[node name="Action3" type="Button" parent="MenuBackground/ActionsBackground/ActionsMenu"]
[node name="Action3" type="Button" parent="MenuBackground/Actions/ActionsMenu"]
clip_contents = true
custom_minimum_size = Vector2(434, 46)
layout_mode = 2
[node name="Action7" type="Button" parent="MenuBackground/ActionsBackground/ActionsMenu"]
[node name="Action7" type="Button" parent="MenuBackground/Actions/ActionsMenu"]
clip_contents = true
custom_minimum_size = Vector2(434, 46)
layout_mode = 2
[node name="Action4" type="Button" parent="MenuBackground/ActionsBackground/ActionsMenu"]
[node name="Action4" type="Button" parent="MenuBackground/Actions/ActionsMenu"]
clip_contents = true
custom_minimum_size = Vector2(434, 46)
layout_mode = 2
[node name="Action8" type="Button" parent="MenuBackground/ActionsBackground/ActionsMenu"]
[node name="Action8" type="Button" parent="MenuBackground/Actions/ActionsMenu"]
clip_contents = true
custom_minimum_size = Vector2(434, 46)
layout_mode = 2
[node name="CloseButtonBackground" type="NinePatchRect" parent="MenuBackground"]
[node name="CloseButtonBack" type="NinePatchRect" parent="MenuBackground"]
layout_mode = 0
offset_left = 1124.0
offset_top = 2.0
@ -170,7 +173,7 @@ patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
[node name="CloseButton" type="Button" parent="MenuBackground/CloseButtonBackground"]
[node name="CloseButton" type="Button" parent="MenuBackground/CloseButtonBack"]
layout_mode = 0
offset_left = 1.0
offset_top = 1.0
@ -179,4 +182,4 @@ offset_bottom = 73.0
icon = ExtResource("2_ceeiv")
script = ExtResource("4_68ool")
[connection signal="button_up" from="MenuBackground/CloseButtonBackground/CloseButton" to="MenuBackground/CloseButtonBackground/CloseButton" method="_on_button_up"]
[connection signal="button_up" from="MenuBackground/CloseButtonBack/CloseButton" to="MenuBackground/CloseButtonBack/CloseButton" method="_on_button_up"]