Update
This commit is contained in:
@@ -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)
|
||||
27
demos/3. different branch goto/different_branch_goto_log.gd
Normal file
27
demos/3. different branch goto/different_branch_goto_log.gd
Normal 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()
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user