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,16 @@
extends DialogueEngine
enum { DEFAULT_BRANCH = 0, DIFFERENT_BRANCH_ONE, DIFFERENT_BRANCH_TWO, DIFFERENT_BRANCH_THREE }
func _setup() -> void:
var first_entry : DialogueEntry = add_text_entry("This is an example of...", DEFAULT_BRANCH)
first_entry.set_goto_id(add_text_entry("how gotos work against different branch IDs", DIFFERENT_BRANCH_TWO).get_id())
add_text_entry("Once you jump to a different branch ID, the DialogueEngine will only consider entries in that branch ID unless you jump to a different one.", DIFFERENT_BRANCH_TWO)
add_text_entry("If, for example, you add another text entry to a branch ID that is empty, it will show up in Debugger/DialogueEngine as such.", DIFFERENT_BRANCH_TWO)
add_text_entry("For example, this text will be shown on branch ID %d in the debugger and not connected to anything. It won't show up in the interaction either." % DIFFERENT_BRANCH_ONE, DIFFERENT_BRANCH_ONE)
add_text_entry("You can also create full branches in a different branch ID", DIFFERENT_BRANCH_THREE)
add_text_entry("But since there's no jump to this branch (i.e. no goto set to this branch ID)", DIFFERENT_BRANCH_THREE)
add_text_entry("It won't show up in the interaction", DIFFERENT_BRANCH_THREE)
add_text_entry("See the auto-generated graph in Debugger/DialogueEngine.", DIFFERENT_BRANCH_TWO)
add_text_entry("Press <Enter> or <Space> to exit.", DIFFERENT_BRANCH_TWO)

View File

@@ -0,0 +1,27 @@
extends VBoxContainer
@export var dialogue_gdscript : GDScript = null
var dialogue_engine : DialogueEngine = null
func _ready() -> void:
dialogue_engine = dialogue_gdscript.new()
dialogue_engine.dialogue_continued.connect(__on_dialogue_continued)
dialogue_engine.dialogue_finished.connect(__on_dialogue_finished)
func _input(p_input_event : InputEvent) -> void:
if p_input_event.is_action_pressed(&"ui_accept"):
dialogue_engine.advance()
var enabled_buttons : Array[Button] = []
func __on_dialogue_continued(p_dialogue_entry : DialogueEntry) -> void:
var label : RichTextLabel = RichTextLabel.new()
label.set_use_bbcode(true)
label.set_fit_content(true)
label.set_text(" > " + p_dialogue_entry.get_text())
add_child(label)
func __on_dialogue_finished() -> void:
get_tree().quit()

View File

@@ -0,0 +1,26 @@
[gd_scene load_steps=3 format=3 uid="uid://clxd85by8v506"]
[ext_resource type="Script" path="res://demos/3. different branch goto/different_branch_goto_log.gd" id="1_et54s"]
[ext_resource type="Script" path="res://demos/3. different branch goto/different_branch_goto_dialogue.gd" id="2_x1mbj"]
[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_et54s")
dialogue_gdscript = ExtResource("2_x1mbj")
[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