This commit is contained in:
2024-09-07 15:01:45 -07:00
parent fbaf698852
commit b470a9d2fe
116 changed files with 15968 additions and 24 deletions

View File

@@ -0,0 +1,7 @@
extends DialogueEngine
func _setup() -> void:
# Use DialogueEntry.set_metadata for data that must be available through DialogueEngine.dialogue_continued signal.
# The metadata handling per DialogueEntry must be implemented by the user.
add_text_entry("[i]We won! Let's goooo!![/i]").set_metadata("author", "Gary")
add_text_entry("Press <Enter> or <Space> to exit.")

View File

@@ -0,0 +1,43 @@
extends VBoxContainer
@export var dialogue_gdscript : GDScript = null
var dialogue_engine : DialogueEngine = null
func _ready() -> void:
dialogue_engine = dialogue_gdscript.new()
dialogue_engine.dialogue_started.connect(__on_dialogue_started)
dialogue_engine.dialogue_continued.connect(__on_dialogue_continued)
dialogue_engine.dialogue_finished.connect(__on_dialogue_finished)
dialogue_engine.dialogue_cancelled.connect(__on_dialogue_cancelled)
func _input(p_input_event : InputEvent) -> void:
if p_input_event.is_action_pressed(&"ui_accept"):
dialogue_engine.advance()
func __on_dialogue_started() -> void:
print("Dialogue Started!")
func __on_dialogue_continued(p_dialogue_entry : DialogueEntry) -> void:
var label : RichTextLabel = RichTextLabel.new()
label.set_use_bbcode(true)
label.set_fit_content(true)
if p_dialogue_entry.has_metadata("author"):
var author : String = p_dialogue_entry.get_metadata("author")
label.set_text(" > " + author + ": " + p_dialogue_entry.get_text())
else:
label.set_text(" > " + p_dialogue_entry.get_text())
add_child(label)
func __on_dialogue_finished() -> void:
print("Dialogue Finished! Exiting...")
get_tree().quit()
func __on_dialogue_cancelled() -> void:
print("Dialogue Cancelled! Exiting...")
get_tree().quit()

View File

@@ -0,0 +1,26 @@
[gd_scene load_steps=3 format=3 uid="uid://jeupskd3oea8"]
[ext_resource type="Script" path="res://demos/6. handling metadata/handling_metadata_log.gd" id="1_0ot0q"]
[ext_resource type="Script" path="res://demos/6. handling metadata/handling_metadata_dialogue.gd" id="2_tq44t"]
[node name="DialogueEngineDemoVBoxContainer" type="VBoxContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_0ot0q")
dialogue_gdscript = ExtResource("2_tq44t")
[node name="DialogueEngineDemoQuickStartPanelContainer" type="PanelContainer" parent="."]
layout_mode = 2
[node name="DialogueEngineDemoQuickStartLabel" type="Label" parent="DialogueEngineDemoQuickStartPanelContainer"]
layout_mode = 2
text = "Press <Enter> or <Space> to progress the dialogue."
horizontal_alignment = 1
[node name="LogRichTextLabel" type="RichTextLabel" parent="."]
layout_mode = 2
text = "Log:"
fit_content = true