From 2c804bb95e68fbce8ed72dee5aad76f8b830427e Mon Sep 17 00:00:00 2001 From: cmod31 Date: Fri, 3 Feb 2023 13:02:49 +0100 Subject: [PATCH] more dialogue system stuff --- dialogue/npcs/villager_normal.json | 7 +- scenes/dialog_trigger_area.tscn | 4 +- scenes/gui/dialog_bubble.tscn | 115 ++++++++++++------ scenes/player.tscn | 3 +- scenes/tiles/dialogdebug_cupcake.tscn | 2 +- src/scene-scripts/{gui => }/dialog_bubble.cs | 2 +- .../dialog_trigger_area.cs | 0 src/scene-scripts/player.cs | 16 +-- theme/main-theme.tres | 26 ++++ 9 files changed, 122 insertions(+), 53 deletions(-) rename src/scene-scripts/{gui => }/dialog_bubble.cs (88%) rename src/scene-scripts/{ => dialogue-system}/dialog_trigger_area.cs (100%) create mode 100644 theme/main-theme.tres diff --git a/dialogue/npcs/villager_normal.json b/dialogue/npcs/villager_normal.json index 890036c..b3b7371 100644 --- a/dialogue/npcs/villager_normal.json +++ b/dialogue/npcs/villager_normal.json @@ -1,5 +1,5 @@ { - "dialogTitle": "Debug Character", + "dialogTitle": "Brain damaged Debug Character", "dialogType": "villager", "playerbeginoptions": { "talk": [ @@ -57,14 +57,15 @@ ], "No thats enough": false }, - "orem ipsumorem ipsumorem ipsumorem ipsumorem ipsumorem ipsumorem ipsumorem ipsum." + "after yes tell me more debug text" ], "Make it short": [ "okay so this is the short version: xyxyxyxy is xyxyxxyxxyyx123!" ], "No I'm good": false }, - "This is the text after the prompt" + "This is the text after the prompt", + "and another text after the prompt" ] ] } \ No newline at end of file diff --git a/scenes/dialog_trigger_area.tscn b/scenes/dialog_trigger_area.tscn index c07e84e..b485d62 100644 --- a/scenes/dialog_trigger_area.tscn +++ b/scenes/dialog_trigger_area.tscn @@ -1,6 +1,6 @@ -[gd_scene load_steps=2 format=3 uid="uid://hyhe4kitrbt6"] +[gd_scene load_steps=2 format=3] -[ext_resource type="Script" path="res://src/scene-scripts/dialog_trigger_area.cs" id="1_ujbo8"] +[ext_resource type="Script" path="res://src/scene-scripts/dialogue-system/dialog_trigger_area.cs" id="1_ujbo8"] [node name="dialog_trigger_area" type="Area2D"] collision_layer = 2 diff --git a/scenes/gui/dialog_bubble.tscn b/scenes/gui/dialog_bubble.tscn index 442fcaa..c6bc828 100644 --- a/scenes/gui/dialog_bubble.tscn +++ b/scenes/gui/dialog_bubble.tscn @@ -1,54 +1,97 @@ -[gd_scene load_steps=3 format=3 uid="uid://cnmlidl1blxam"] +[gd_scene load_steps=4 format=3 uid="uid://cg86tsupfq53i"] -[ext_resource type="Script" path="res://src/scene-scripts/gui/dialog_bubble.cs" id="1_txwv4"] +[ext_resource type="Script" path="res://src/scene-scripts/dialog_bubble.cs" id="1_210k6"] [ext_resource type="FontFile" uid="uid://cx6bvqk0ghmjv" path="res://assets/fonts/urbane-rounded-medium.otf" id="2_qrihj"] +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5w2xu"] + [node name="dialog_bubble" type="CanvasLayer"] -script = ExtResource("1_txwv4") +script = ExtResource("1_210k6") metadata/_edit_use_anchors_ = true -[node name="ColorRect" type="ColorRect" parent="."] +[node name="color_rect" type="ColorRect" parent="."] anchors_preset = -1 -anchor_left = 0.163 -anchor_top = 0.78 -anchor_right = 0.863 -anchor_bottom = 0.977 -offset_left = -0.531006 -offset_top = 0.0799561 -offset_right = 0.56897 -offset_bottom = -0.128052 +anchor_left = 0.083 +anchor_top = 0.694 +anchor_right = 0.923 +anchor_bottom = 0.968 +offset_left = 0.428993 +offset_top = 0.383972 +offset_right = -40.651 +offset_bottom = 19.6479 grow_horizontal = 2 grow_vertical = 0 -[node name="text_label" type="Label" parent="."] +[node name="text_label" type="RichTextLabel" parent="color_rect"] +layout_mode = 1 anchors_preset = -1 -anchor_left = 0.218 -anchor_top = 0.812 -anchor_right = 0.837 -anchor_bottom = 0.972 -offset_left = -15.066 -offset_top = 8.43201 -offset_right = -16.469 -offset_bottom = -9.80798 +anchor_left = 0.034 +anchor_top = 0.276 +anchor_right = 0.964 +anchor_bottom = 0.914 +offset_left = 0.569996 +offset_top = 0.0679932 +offset_right = 0.219971 +offset_bottom = 0.10199 grow_horizontal = 2 grow_vertical = 0 +theme_override_colors/default_color = Color(0, 0, 0, 1) +theme_override_fonts/normal_font = ExtResource("2_qrihj") +theme_override_font_sizes/normal_font_size = 32 +theme_override_font_sizes/bold_font_size = 80 +bbcode_enabled = true +text = "this is test text or [center][b][wave amp=50 freq=15][rainbow]This is test text[/rainbow][/wave][/b][/center]" +scroll_active = false + +[node name="name_label" type="Label" parent="color_rect"] +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.01 +anchor_top = 0.039 +anchor_right = 0.118 +anchor_bottom = 0.233 +offset_left = 0.0499992 +offset_top = -0.0229998 +offset_right = 0.389984 +offset_bottom = 0.118996 theme_override_colors/font_color = Color(0, 0, 0, 1) theme_override_fonts/font = ExtResource("2_qrihj") theme_override_font_sizes/font_size = 32 -text = "This is test text" -autowrap_mode = 3 +text = "???" -[node name="name_label" type="Label" parent="."] -anchors_preset = -1 -anchor_left = 0.164 -anchor_top = 0.782 -anchor_right = 0.197 -anchor_bottom = 0.808 -offset_left = 7.93199 -offset_top = 4.35199 -offset_right = 7.27698 -offset_bottom = 4.888 -theme_override_colors/font_color = Color(0, 0, 0, 1) +[node name="PanelContainer" type="PanelContainer" parent="."] +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -466.0 +offset_top = -312.0 +offset_right = -144.0 +offset_bottom = -239.0 +grow_horizontal = 0 +grow_vertical = 0 +size_flags_horizontal = 8 +size_flags_vertical = 8 +theme_override_styles/panel = SubResource("StyleBoxEmpty_5w2xu") + +[node name="NinePatchRect" type="NinePatchRect" parent="PanelContainer"] +layout_mode = 2 + +[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"] +layout_mode = 2 +theme_override_constants/margin_left = 15 +theme_override_constants/margin_top = 15 +theme_override_constants/margin_right = 15 +theme_override_constants/margin_bottom = 15 + +[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"] +layout_mode = 2 + +[node name="Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"] +custom_minimum_size = Vector2(128, 32) +layout_mode = 2 theme_override_fonts/font = ExtResource("2_qrihj") -theme_override_font_sizes/font_size = 16 -text = "Name" +theme_override_font_sizes/font_size = 28 +text = "i want to hear more" +alignment = 0 diff --git a/scenes/player.tscn b/scenes/player.tscn index b16ee8d..cdfc770 100644 --- a/scenes/player.tscn +++ b/scenes/player.tscn @@ -2,7 +2,7 @@ [ext_resource type="Script" path="res://src/scene-scripts/player.cs" id="1_qehox"] [ext_resource type="Texture2D" uid="uid://olceowuycu8c" path="res://assets/textures/debug/dummy-player-atlas.png" id="2_yu1q5"] -[ext_resource type="PackedScene" uid="uid://cnmlidl1blxam" path="res://scenes/gui/dialog_bubble.tscn" id="3_8f573"] +[ext_resource type="PackedScene" uid="uid://cg86tsupfq53i" path="res://scenes/gui/dialog_bubble.tscn" id="3_8f573"] [sub_resource type="AtlasTexture" id="AtlasTexture_tokqm"] atlas = ExtResource("2_yu1q5") @@ -132,4 +132,3 @@ editor_draw_drag_margin = true current = true [node name="dialog_bubble" parent="." instance=ExtResource("3_8f573")] -visible = false diff --git a/scenes/tiles/dialogdebug_cupcake.tscn b/scenes/tiles/dialogdebug_cupcake.tscn index 800660e..71a762c 100644 --- a/scenes/tiles/dialogdebug_cupcake.tscn +++ b/scenes/tiles/dialogdebug_cupcake.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=5 format=3 uid="uid://dckxciecwjfgf"] [ext_resource type="Texture2D" uid="uid://p5ubildre2tg" path="res://assets/textures/debug/cupcake.png" id="1_imilm"] -[ext_resource type="PackedScene" uid="uid://hyhe4kitrbt6" path="res://scenes/dialog_trigger_area.tscn" id="2_blpmd"] +[ext_resource type="PackedScene" path="res://scenes/dialog_trigger_area.tscn" id="2_blpmd"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_pchpi"] size = Vector2(64, 17.25) diff --git a/src/scene-scripts/gui/dialog_bubble.cs b/src/scene-scripts/dialog_bubble.cs similarity index 88% rename from src/scene-scripts/gui/dialog_bubble.cs rename to src/scene-scripts/dialog_bubble.cs index ae5f0df..4dce904 100644 --- a/src/scene-scripts/gui/dialog_bubble.cs +++ b/src/scene-scripts/dialog_bubble.cs @@ -18,7 +18,7 @@ public partial class dialog_bubble : CanvasLayer public void GetDialog(string dialogFile) { parsedDialog = Json.ParseString(FileAccess.Open(dialogFile, FileAccess.ModeFlags.Read).GetAsText()); - GetNode