diff --git a/addons/dialogue_nodes/Editor.tscn b/addons/dialogue_nodes/Editor.tscn index 8de882f..9b21412 100644 --- a/addons/dialogue_nodes/Editor.tscn +++ b/addons/dialogue_nodes/Editor.tscn @@ -244,6 +244,7 @@ grow_horizontal = 2 grow_vertical = 2 [node name="DialogueBox" type="Panel" parent="."] +visible = false layout_mode = 1 anchors_preset = 8 anchor_left = 0.5 diff --git a/addons/dialogue_nodes/icons/CharacterList.svg.import b/addons/dialogue_nodes/icons/CharacterList.svg.import index 0a9e9dd..e054f8f 100644 --- a/addons/dialogue_nodes/icons/CharacterList.svg.import +++ b/addons/dialogue_nodes/icons/CharacterList.svg.import @@ -5,6 +5,7 @@ type="CompressedTexture2D" uid="uid://b5wgoe1rpbf31" path="res://.godot/imported/CharacterList.svg-83222511b7ebf193c7042c4f541d1914.ctex" metadata={ +"has_editor_variant": true, "vram_texture": false } @@ -33,5 +34,5 @@ process/hdr_clamp_exposure=false process/size_limit=0 detect_3d/compress_to=1 svg/scale=1.0 -editor/scale_with_editor_scale=false -editor/convert_colors_with_editor_theme=false +editor/scale_with_editor_scale=true +editor/convert_colors_with_editor_theme=true diff --git a/addons/dialogue_nodes/icons/DialogueBox.svg b/addons/dialogue_nodes/icons/DialogueBox.svg new file mode 100644 index 0000000..af2338a --- /dev/null +++ b/addons/dialogue_nodes/icons/DialogueBox.svg @@ -0,0 +1,42 @@ + + + + + + diff --git a/addons/dialogue_nodes/icons/DialogueBox.svg.import b/addons/dialogue_nodes/icons/DialogueBox.svg.import new file mode 100644 index 0000000..e58fc58 --- /dev/null +++ b/addons/dialogue_nodes/icons/DialogueBox.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c6dtwwunb63rm" +path="res://.godot/imported/DialogueBox.svg-90fca4f90a37756503d256c204e7ef83.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/dialogue_nodes/icons/DialogueBox.svg" +dest_files=["res://.godot/imported/DialogueBox.svg-90fca4f90a37756503d256c204e7ef83.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 +svg/scale=1.0 +editor/scale_with_editor_scale=true +editor/convert_colors_with_editor_theme=true diff --git a/addons/dialogue_nodes/icons/DialogueBubble.svg b/addons/dialogue_nodes/icons/DialogueBubble.svg new file mode 100644 index 0000000..3d14dfd --- /dev/null +++ b/addons/dialogue_nodes/icons/DialogueBubble.svg @@ -0,0 +1,42 @@ + + + + + + diff --git a/addons/dialogue_nodes/icons/DialogueBubble.svg.import b/addons/dialogue_nodes/icons/DialogueBubble.svg.import new file mode 100644 index 0000000..3759c7f --- /dev/null +++ b/addons/dialogue_nodes/icons/DialogueBubble.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://fqpf7kdjqa6m" +path="res://.godot/imported/DialogueBubble.svg-459bd1b1f9c5c0fab5c392594cf078e0.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/dialogue_nodes/icons/DialogueBubble.svg" +dest_files=["res://.godot/imported/DialogueBubble.svg-459bd1b1f9c5c0fab5c392594cf078e0.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 +svg/scale=1.0 +editor/scale_with_editor_scale=true +editor/convert_colors_with_editor_theme=true diff --git a/addons/dialogue_nodes/icons/DialogueParser.svg b/addons/dialogue_nodes/icons/DialogueParser.svg new file mode 100644 index 0000000..68b7719 --- /dev/null +++ b/addons/dialogue_nodes/icons/DialogueParser.svg @@ -0,0 +1,42 @@ + + + + + + diff --git a/addons/dialogue_nodes/icons/DialogueParser.svg.import b/addons/dialogue_nodes/icons/DialogueParser.svg.import new file mode 100644 index 0000000..be542be --- /dev/null +++ b/addons/dialogue_nodes/icons/DialogueParser.svg.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dr0i7ng6lymhm" +path="res://.godot/imported/DialogueParser.svg-d0149a02a1ec195e3bd77e339994df1d.ctex" +metadata={ +"has_editor_variant": true, +"vram_texture": false +} + +[deps] + +source_file="res://addons/dialogue_nodes/icons/DialogueParser.svg" +dest_files=["res://.godot/imported/DialogueParser.svg-d0149a02a1ec195e3bd77e339994df1d.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 +svg/scale=1.0 +editor/scale_with_editor_scale=true +editor/convert_colors_with_editor_theme=true diff --git a/addons/dialogue_nodes/objects/Character.gd b/addons/dialogue_nodes/objects/Character.gd index ee347cf..a88c3af 100644 --- a/addons/dialogue_nodes/objects/Character.gd +++ b/addons/dialogue_nodes/objects/Character.gd @@ -1,6 +1,7 @@ -@icon("res://addons/dialogue_nodes/icons/Character.svg") +@icon('res://addons/dialogue_nodes/icons/Character.svg') ## The data for a speaker in a dialogue. -class_name Character extends Resource +class_name Character +extends Resource @export var name : String = '' @export var image : Texture2D diff --git a/addons/dialogue_nodes/objects/CharacterList.gd b/addons/dialogue_nodes/objects/CharacterList.gd index c536fab..658187c 100644 --- a/addons/dialogue_nodes/objects/CharacterList.gd +++ b/addons/dialogue_nodes/objects/CharacterList.gd @@ -1,5 +1,6 @@ -@icon("res://addons/dialogue_nodes/icons/CharacterList.svg") +@icon('res://addons/dialogue_nodes/icons/CharacterList.svg') ## An array containing multiple [param Character]s. -class_name CharacterList extends Resource +class_name CharacterList +extends Resource @export var characters : Array[Character] diff --git a/addons/dialogue_nodes/objects/DialogueBox.gd b/addons/dialogue_nodes/objects/DialogueBox.gd index a3c0590..b2ca160 100644 --- a/addons/dialogue_nodes/objects/DialogueBox.gd +++ b/addons/dialogue_nodes/objects/DialogueBox.gd @@ -1,6 +1,7 @@ @tool ## A node for displaying branching dialogues, primarily created using the Dialogue Nodes editor. -class_name DialogueBox extends Panel +class_name DialogueBox +extends Panel ## Triggered when a dialogue has started. Passes [param id] of the dialogue tree as defined in the StartNode. diff --git a/addons/dialogue_nodes/objects/DialogueBubble.gd b/addons/dialogue_nodes/objects/DialogueBubble.gd index 31b51ca..8a16905 100644 --- a/addons/dialogue_nodes/objects/DialogueBubble.gd +++ b/addons/dialogue_nodes/objects/DialogueBubble.gd @@ -2,7 +2,8 @@ ## A node for displaying branching dialogues, primarily created using the Dialogue Nodes editor.[br] ## NOTE: This node is not good at handling long paragraphs of text. It is recommended to use [DialogueBox] instead, or create your custom implementation using [DialogueParser]. ## @experimental -class_name DialogueBubble extends RichTextLabel +class_name DialogueBubble +extends RichTextLabel ## Triggered when a dialogue has started. Passes [param id] of the dialogue tree as defined in the StartNode. diff --git a/addons/dialogue_nodes/objects/DialogueData.gd b/addons/dialogue_nodes/objects/DialogueData.gd index 9c524f0..00536aa 100644 --- a/addons/dialogue_nodes/objects/DialogueData.gd +++ b/addons/dialogue_nodes/objects/DialogueData.gd @@ -1,6 +1,7 @@ ## Data for processing dialogue through a [param DialogueParser]. -@icon("res://addons/dialogue_nodes/icons/Dialogue.svg") -class_name DialogueData extends Resource +@icon('res://addons/dialogue_nodes/icons/Dialogue.svg') +class_name DialogueData +extends Resource ## Contains the start IDs as keys and their respective node name as values. ## Example: { "START": "0_1" } diff --git a/addons/dialogue_nodes/objects/DialogueParser.gd b/addons/dialogue_nodes/objects/DialogueParser.gd index 9b1469c..f242e3d 100644 --- a/addons/dialogue_nodes/objects/DialogueParser.gd +++ b/addons/dialogue_nodes/objects/DialogueParser.gd @@ -1,6 +1,8 @@ @tool ## A parser for reading and processing [param DialogueData] files -class_name DialogueParser extends Node +@icon('res://addons/dialogue_nodes/icons/DialogueParser.svg') +class_name DialogueParser +extends Node # TODO : Fix [wait] bbcode ## Triggered when a dialogue has started. Passes [param id] of the dialogue tree as defined in the StartNode. @@ -285,7 +287,7 @@ func _update_wait_tags(node : RichTextLabel, value : String): # find the actual position of the last character sans bbcode value = value.replace('\n', ' ').replace('[br]', '\n') node.text = value - print('# parsed text: ', node.get_parsed_text()) # + var text_length := node.get_parsed_text().length() - value.count('\n') # update [wait] with last attribute for showing options diff --git a/addons/dialogue_nodes/plugin.cfg b/addons/dialogue_nodes/plugin.cfg index 513e73d..b1074de 100644 --- a/addons/dialogue_nodes/plugin.cfg +++ b/addons/dialogue_nodes/plugin.cfg @@ -3,5 +3,5 @@ name="Dialogue Nodes" description="A plugin to create dialogue trees using graph nodes, save them as resource files and use them in your games." author="Nagi" -version="1.1.0" +version="1.2.0" script="plugin.gd" diff --git a/addons/dialogue_nodes/plugin.gd b/addons/dialogue_nodes/plugin.gd index efa7447..0d7de07 100644 --- a/addons/dialogue_nodes/plugin.gd +++ b/addons/dialogue_nodes/plugin.gd @@ -5,7 +5,8 @@ extends EditorPlugin const EditorScene = preload('res://addons/dialogue_nodes/Editor.tscn') const DialogueBoxScene = preload('res://addons/dialogue_nodes/objects/DialogueBox.gd') const DialogueBubbleScene = preload('res://addons/dialogue_nodes/objects/DialogueBubble.gd') -const DialogueBoxIcon = preload('res://addons/dialogue_nodes/icons/Dialogue.svg') +const DialogueBoxIcon = preload('res://addons/dialogue_nodes/icons/DialogueBox.svg') +const DialogueBubbleIcon = preload('res://addons/dialogue_nodes/icons/DialogueBubble.svg') var editor @@ -31,7 +32,7 @@ func _enter_tree(): 'DialogueBubble', 'RichTextLabel', DialogueBubbleScene, - DialogueBoxIcon + DialogueBubbleIcon ) print_debug('Plugin Enabled') diff --git a/examples/Demo.tscn b/examples/Demo1.tscn similarity index 80% rename from examples/Demo.tscn rename to examples/Demo1.tscn index 3e90f97..2462abb 100644 --- a/examples/Demo.tscn +++ b/examples/Demo1.tscn @@ -1,17 +1,17 @@ [gd_scene load_steps=18 format=3 uid="uid://bwk7tjlhnu23j"] -[ext_resource type="Script" path="res://examples/demo.gd" id="2"] -[ext_resource type="Resource" uid="uid://dj818hys8f3u8" path="res://examples/ExampleBasic.tres" id="3_r2hw0"] -[ext_resource type="Theme" uid="uid://dc6c1peo4pfyr" path="res://addons/dialogue_nodes/themes/bubbly.theme" id="4"] -[ext_resource type="Resource" uid="uid://btriowhsx04c2" path="res://examples/ExampleBBCodes.tres" id="4_hv77k"] -[ext_resource type="Resource" uid="uid://bjme2drtas671" path="res://examples/ExampleBranching.tres" id="5_quhw6"] -[ext_resource type="Resource" uid="uid://c303qivlsn30t" path="res://examples/ExampleCharacters.tres" id="6_ncvoa"] -[ext_resource type="Resource" uid="uid://b4os1qum2hx0x" path="res://examples/ExampleSignals.tres" id="7_sjqsf"] -[ext_resource type="Resource" uid="uid://cbu4k4hs8fk5s" path="res://examples/ExampleVariables.tres" id="8_872se"] -[ext_resource type="Script" path="res://addons/dialogue_nodes/objects/bbcodeWait.gd" id="9_4rd6n"] -[ext_resource type="Script" path="res://addons/dialogue_nodes/objects/DialogueBox.gd" id="9_chp3k"] -[ext_resource type="Script" path="res://addons/dialogue_nodes/objects/bbcodeGhost.gd" id="12_mrg0x"] -[ext_resource type="Script" path="res://addons/dialogue_nodes/objects/bbcodeMatrix.gd" id="13_583e8"] +[ext_resource type="Theme" uid="uid://dc6c1peo4pfyr" path="res://addons/dialogue_nodes/themes/bubbly.theme" id="1_qerq3"] +[ext_resource type="Script" path="res://examples/demo.gd" id="2_5ddyy"] +[ext_resource type="Resource" uid="uid://dj818hys8f3u8" path="res://examples/ExampleBasic.tres" id="3_yex7d"] +[ext_resource type="Resource" uid="uid://btriowhsx04c2" path="res://examples/ExampleBBCodes.tres" id="4_ay03t"] +[ext_resource type="Resource" uid="uid://bjme2drtas671" path="res://examples/ExampleBranching.tres" id="5_ifbb7"] +[ext_resource type="Resource" uid="uid://c303qivlsn30t" path="res://examples/ExampleCharacters.tres" id="6_arg21"] +[ext_resource type="Resource" uid="uid://b4os1qum2hx0x" path="res://examples/ExampleSignals.tres" id="7_18syg"] +[ext_resource type="Resource" uid="uid://cbu4k4hs8fk5s" path="res://examples/ExampleVariables.tres" id="8_4fu3f"] +[ext_resource type="Script" path="res://addons/dialogue_nodes/objects/DialogueBox.gd" id="9_s4y1y"] +[ext_resource type="Script" path="res://addons/dialogue_nodes/objects/bbcodeWait.gd" id="10_wwm1y"] +[ext_resource type="Script" path="res://addons/dialogue_nodes/objects/bbcodeGhost.gd" id="11_iuh66"] +[ext_resource type="Script" path="res://addons/dialogue_nodes/objects/bbcodeMatrix.gd" id="12_cnev0"] [sub_resource type="Curve" id="1"] _data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), -1.67805, 0.0, 0, 0] @@ -22,13 +22,13 @@ offsets = PackedFloat32Array(0, 0.332268, 1) colors = PackedColorArray(1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1) [sub_resource type="RichTextEffect" id="RichTextEffect_wmns8"] -script = ExtResource("9_4rd6n") +script = ExtResource("10_wwm1y") [sub_resource type="RichTextEffect" id="RichTextEffect_jqe1g"] -script = ExtResource("12_mrg0x") +script = ExtResource("11_iuh66") [sub_resource type="RichTextEffect" id="RichTextEffect_j1cit"] -script = ExtResource("13_583e8") +script = ExtResource("12_cnev0") [node name="Demo" type="Control"] texture_filter = 1 @@ -38,9 +38,9 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -theme = ExtResource("4") -script = ExtResource("2") -demos = Array[Resource("res://addons/dialogue_nodes/objects/DialogueData.gd")]([ExtResource("3_r2hw0"), ExtResource("4_hv77k"), ExtResource("5_quhw6"), ExtResource("6_ncvoa"), ExtResource("7_sjqsf"), ExtResource("8_872se")]) +theme = ExtResource("1_qerq3") +script = ExtResource("2_5ddyy") +demos = Array[Resource("res://addons/dialogue_nodes/objects/DialogueData.gd")]([ExtResource("3_yex7d"), ExtResource("4_ay03t"), ExtResource("5_ifbb7"), ExtResource("6_arg21"), ExtResource("7_18syg"), ExtResource("8_4fu3f")]) [node name="DemoSelector" type="OptionButton" parent="."] layout_mode = 1 @@ -122,7 +122,7 @@ offset_right = 500.0 offset_bottom = -16.0 grow_horizontal = 2 grow_vertical = 0 -script = ExtResource("9_chp3k") +script = ExtResource("9_s4y1y") start_id = "START" custom_effects = Array[RichTextEffect]([SubResource("RichTextEffect_wmns8"), SubResource("RichTextEffect_jqe1g"), SubResource("RichTextEffect_j1cit")]) diff --git a/examples/Demo3.tscn b/examples/Demo3.tscn new file mode 100644 index 0000000..f997205 --- /dev/null +++ b/examples/Demo3.tscn @@ -0,0 +1,114 @@ +[gd_scene load_steps=23 format=3 uid="uid://dhwoh3ay4mp3c"] + +[ext_resource type="Script" path="res://examples/demo3.gd" id="1_2a8yf"] +[ext_resource type="AudioStream" uid="uid://bin1ei6yesmjv" path="res://examples/voice.ogg" id="2_bjs48"] +[ext_resource type="Theme" uid="uid://b4f152moh4ayu" path="res://addons/dialogue_nodes/themes/bubblyClean.theme" id="3_xmmjy"] +[ext_resource type="Script" path="res://addons/dialogue_nodes/objects/bbcodeWait.gd" id="4_tmfyu"] +[ext_resource type="Script" path="res://addons/dialogue_nodes/objects/bbcodeGhost.gd" id="5_vs72k"] +[ext_resource type="Script" path="res://addons/dialogue_nodes/objects/bbcodeMatrix.gd" id="6_pkic0"] +[ext_resource type="Script" path="res://addons/dialogue_nodes/objects/DialogueBubble.gd" id="7_wf6dy"] +[ext_resource type="Resource" uid="uid://cwtdfv6yke8ri" path="res://examples/ExampleBubble.tres" id="8_qbppo"] + +[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_xk202"] +sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1) +ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1) + +[sub_resource type="Sky" id="Sky_7mdvo"] +sky_material = SubResource("ProceduralSkyMaterial_xk202") + +[sub_resource type="Environment" id="Environment_80dc1"] +background_mode = 2 +sky = SubResource("Sky_7mdvo") +tonemap_mode = 3 +ssao_enabled = true +sdfgi_enabled = true +glow_enabled = true + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_wc4o7"] +albedo_color = Color(0.278431, 0.231373, 0.470588, 1) + +[sub_resource type="BoxMesh" id="BoxMesh_s62kf"] +material = SubResource("StandardMaterial3D_wc4o7") +size = Vector3(100, 1, 100) + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_wtg46"] +albedo_color = Color(0.560784, 0.870588, 0.364706, 1) + +[sub_resource type="SphereMesh" id="SphereMesh_ck5hd"] +material = SubResource("StandardMaterial3D_wtg46") + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_42irw"] +albedo_color = Color(1, 0.54902, 0.639216, 1) + +[sub_resource type="SphereMesh" id="SphereMesh_ruvw0"] +material = SubResource("StandardMaterial3D_42irw") + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_m8p2i"] +albedo_color = Color(1, 1, 0.513726, 1) + +[sub_resource type="PrismMesh" id="PrismMesh_jeho0"] +material = SubResource("StandardMaterial3D_m8p2i") + +[sub_resource type="RichTextEffect" id="RichTextEffect_akgkw"] +script = ExtResource("4_tmfyu") + +[sub_resource type="RichTextEffect" id="RichTextEffect_el6u0"] +script = ExtResource("5_vs72k") + +[sub_resource type="RichTextEffect" id="RichTextEffect_oo7i8"] +script = ExtResource("6_pkic0") + +[node name="Main" type="Node3D"] +script = ExtResource("1_2a8yf") + +[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] +transform = Transform3D(-0.970995, 0.126469, 0.202912, 0.148113, 0.984374, 0.0952352, -0.187697, 0.122527, -0.974555, 0, 0, 0) +light_color = Color(1, 0.878551, 0.784915, 1) +shadow_enabled = true + +[node name="WorldEnvironment" type="WorldEnvironment" parent="."] +environment = SubResource("Environment_80dc1") + +[node name="Floor" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.06069, 0) +mesh = SubResource("BoxMesh_s62kf") + +[node name="Greg" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.59386, 0, -2.1098) +mesh = SubResource("SphereMesh_ck5hd") + +[node name="Clara" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.3228, 1.21788, -1.67157) +mesh = SubResource("SphereMesh_ruvw0") + +[node name="Binkle" type="MeshInstance3D" parent="."] +transform = Transform3D(0.958628, -0.264975, 0.104022, 0.180335, 0.848039, 0.498306, -0.220253, -0.458932, 0.860738, -0.716, -2, -4.783) +mesh = SubResource("PrismMesh_jeho0") + +[node name="Camera3D" type="Camera3D" parent="."] +transform = Transform3D(0.993087, 0.0320453, -0.112922, 0, 0.962013, 0.273002, 0.117381, -0.271115, 0.955363, 0.157186, 1.15744, 1.00156) + +[node name="FocusPoint" type="Node3D" parent="."] + +[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="FocusPoint"] +stream = ExtResource("2_bjs48") +panning_strength = 5.0 + +[node name="DialogueBubble" type="RichTextLabel" parent="."] +clip_contents = false +offset_left = 493.0 +offset_top = 338.0 +offset_right = 633.0 +offset_bottom = 361.0 +theme = ExtResource("3_xmmjy") +bbcode_enabled = true +text = "Sample dialogue." +fit_content = true +autowrap_mode = 0 +custom_effects = [SubResource("RichTextEffect_akgkw"), SubResource("RichTextEffect_el6u0"), SubResource("RichTextEffect_oo7i8")] +script = ExtResource("7_wf6dy") +data = ExtResource("8_qbppo") +dialogue_custom_effects = [SubResource("RichTextEffect_akgkw"), SubResource("RichTextEffect_el6u0"), SubResource("RichTextEffect_oo7i8")] + +[connection signal="dialogue_processed" from="DialogueBubble" to="." method="_on_dialogue_processed"] +[connection signal="dialogue_signal" from="DialogueBubble" to="." method="_on_dialogue_signal"] diff --git a/examples/ExampleBubble.tres b/examples/ExampleBubble.tres new file mode 100644 index 0000000..bb569b2 --- /dev/null +++ b/examples/ExampleBubble.tres @@ -0,0 +1,224 @@ +[gd_resource type="Resource" script_class="DialogueData" load_steps=2 format=3 uid="uid://cwtdfv6yke8ri"] + +[ext_resource type="Script" path="res://addons/dialogue_nodes/objects/DialogueData.gd" id="1_lj414"] + +[resource] +script = ExtResource("1_lj414") +starts = { +"START": &"0_1" +} +nodes = { +"0_1": { +"link": &"1_1", +"offset": Vector2(0, 200), +"start_id": "START" +}, +"1_1": { +"dialogue": "Hey Clara!", +"offset": Vector2(220, 200), +"options": { +0: { +"condition": {}, +"link": &"1_2", +"text": "" +} +}, +"size": Vector2(300.001, 240.001), +"speaker": 0 +}, +"1_10": { +"dialogue": "[wait speed=5]Uhh...[/wait]", +"offset": Vector2(3540, 200), +"options": { +0: { +"condition": {}, +"link": &"1_7", +"text": "" +} +}, +"size": Vector2(300.001, 240.001), +"speaker": 0 +}, +"1_11": { +"dialogue": "What the f--", +"offset": Vector2(4800, 200), +"options": { +0: { +"condition": {}, +"link": &"1_12", +"text": "" +} +}, +"size": Vector2(300, 240.001), +"speaker": 0 +}, +"1_12": { +"dialogue": "...and it just went away like that.", +"offset": Vector2(5140, 200), +"options": { +0: { +"condition": {}, +"link": &"1_13", +"text": "" +} +}, +"size": Vector2(300, 240), +"speaker": 1 +}, +"1_13": { +"dialogue": "So weird...", +"offset": Vector2(5480, 200), +"options": { +0: { +"condition": {}, +"link": "END", +"text": "" +} +}, +"size": Vector2(300, 240), +"speaker": 0 +}, +"1_14": { +"dialogue": "[wait speed=5]Wha...[/wait]", +"offset": Vector2(2860, 200), +"options": { +0: { +"condition": {}, +"link": &"1_9", +"text": "" +} +}, +"size": Vector2(300.001, 240.001), +"speaker": 0 +}, +"1_15": { +"dialogue": "Yeah, I mea--", +"offset": Vector2(2520, 200), +"options": { +0: { +"condition": {}, +"link": &"1_14", +"text": "" +} +}, +"size": Vector2(300.001, 240.001), +"speaker": 0 +}, +"1_2": { +"dialogue": "Hey Greg.", +"offset": Vector2(580, 200), +"options": { +0: { +"condition": {}, +"link": &"1_3", +"text": "" +} +}, +"size": Vector2(300, 240.001), +"speaker": 1 +}, +"1_3": { +"dialogue": "What's up?", +"offset": Vector2(920, 200), +"options": { +0: { +"condition": {}, +"link": &"1_4", +"text": "" +} +}, +"size": Vector2(300, 240.001), +"speaker": 1 +}, +"1_4": { +"dialogue": "What a peaceful day, right?", +"offset": Vector2(1260, 200), +"options": { +0: { +"condition": {}, +"link": &"1_5", +"text": "" +} +}, +"size": Vector2(300, 240.001), +"speaker": 0 +}, +"1_5": { +"dialogue": "I know, right?!", +"offset": Vector2(1600, 200), +"options": { +0: { +"condition": {}, +"link": &"1_6", +"text": "" +} +}, +"size": Vector2(300, 240.001), +"speaker": 1 +}, +"1_6": { +"dialogue": "I sure hope nothing weird happens...", +"offset": Vector2(1940, 200), +"options": { +0: { +"condition": {}, +"link": &"3_1", +"text": "" +} +}, +"size": Vector2(300, 240.001), +"speaker": 1 +}, +"1_7": { +"dialogue": "[shake]What is that?![/shake]", +"offset": Vector2(3880, 200), +"options": { +0: { +"condition": {}, +"link": &"1_8", +"text": "" +} +}, +"size": Vector2(300, 240.001), +"speaker": 1 +}, +"1_8": { +"dialogue": "[wave]waponka dooby lum lum![/wave]", +"offset": Vector2(4220, 200), +"options": { +0: { +"condition": {}, +"link": &"3_2", +"text": "" +} +}, +"size": Vector2(300.001, 240.001), +"speaker": 2 +}, +"1_9": { +"dialogue": "bunga cowa!", +"offset": Vector2(3200, 200), +"options": { +0: { +"condition": {}, +"link": &"1_10", +"text": "" +} +}, +"size": Vector2(300.001, 240.001), +"speaker": 2 +}, +"3_1": { +"link": &"1_15", +"offset": Vector2(2280, 200), +"signalValue": "doodle_in" +}, +"3_2": { +"link": &"1_11", +"offset": Vector2(4560, 200), +"signalValue": "doodle_out" +} +} +variables = {} +strays = Array[String]([]) +characters = "res://examples/Characters.tres" diff --git a/examples/demo3.gd b/examples/demo3.gd new file mode 100644 index 0000000..d723c4f --- /dev/null +++ b/examples/demo3.gd @@ -0,0 +1,49 @@ +extends Node3D + + +@onready var camera = $Camera3D +@onready var focus = $FocusPoint +@onready var greg = $Greg +@onready var clara = $Clara +@onready var binkle = $Binkle +@onready var bubble = $DialogueBubble +@onready var audio_player = $FocusPoint/AudioStreamPlayer3D + +var tween : Tween + + +func _ready(): + bubble.custom_effects[0].char_displayed.connect(_on_char_displayed) + + +func _physics_process(_delta): + camera.look_at(focus.global_position * 0.6 + Vector3(0, 1, 0)) + # press TAB to start the dialogue + if Input.is_action_just_released('ui_focus_next') and not bubble.is_running(): + bubble.start('START') + + +func _on_dialogue_processed(speaker, _dialogue, _options): + if (speaker is String and speaker == 'Greg') or (speaker is Character and speaker.name == 'Greg'): + bubble.follow_node = greg + elif speaker is Character and speaker.name == 'Clara': + bubble.follow_node = clara + elif speaker is Character and speaker.name == 'Binkle Doodle': + bubble.follow_node = binkle + + if tween: tween.kill() + tween = create_tween().set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_CUBIC) + tween.tween_property(focus, 'position', bubble.follow_node.position, 1.0) + + +func _on_dialogue_signal(value): + if value == 'doodle_in': + var doodle_tween = create_tween() + doodle_tween.tween_property(binkle, 'position', Vector3(binkle.position.x, 0, binkle.position.z), 3.0) + if value == 'doodle_out': + var doodle_tween = create_tween() + doodle_tween.tween_property(binkle, 'position', Vector3(binkle.position.x, -2, binkle.position.z), 3.0) + + +func _on_char_displayed(_idx): + audio_player.play() diff --git a/icon.svg b/icon.svg index e25ba23..a788a18 100644 --- a/icon.svg +++ b/icon.svg @@ -43,57 +43,58 @@ inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" showgrid="false" - inkscape:zoom="2.8284272" - inkscape:cx="83.438598" - inkscape:cy="72.831997" + inkscape:zoom="5.6568544" + inkscape:cx="71.417783" + inkscape:cy="64.169939" inkscape:window-width="1920" inkscape:window-height="1011" inkscape:window-x="0" inkscape:window-y="32" inkscape:window-maximized="1" - inkscape:current-layer="svg26" - inkscape:pageshadow="0" /> + style="font-size:59.9226px;font-family:'Fira Sans Condensed';-inkscape-font-specification:'Fira Sans Condensed, ';fill:#ffffff;stroke-width:0.936291" /> diff --git a/project.godot b/project.godot index 88bf485..d468189 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="DialogueNodes" -run/main_scene="res://examples/Demo.tscn" +run/main_scene="res://examples/Demo1.tscn" config/features=PackedStringArray("4.2") config/icon="res://icon.svg"