Update
This commit is contained in:
10
demos/2. same branch goto/same_branch_goto_dialogue.gd
Normal file
10
demos/2. same branch goto/same_branch_goto_dialogue.gd
Normal file
@@ -0,0 +1,10 @@
|
||||
extends DialogueEngine
|
||||
|
||||
|
||||
func _setup() -> void:
|
||||
var first_entry : DialogueEntry = add_text_entry("This is an example of...")
|
||||
add_text_entry("This text will be shown on the debugger connected to branch ID 0")
|
||||
add_text_entry("This text will be shown on the debugger as a separate graph node not connected to branch id 0", 1)
|
||||
var first_entry_goto : DialogueEntry = add_text_entry("a skipped dialogue! Check the debugger out!")
|
||||
first_entry.set_goto_id(first_entry_goto.get_id())
|
||||
add_text_entry("Press <Enter> or <Space> to exit.")
|
||||
27
demos/2. same branch goto/same_branch_goto_log.gd
Normal file
27
demos/2. same branch goto/same_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()
|
||||
26
demos/2. same branch goto/same_branch_goto_log.tscn
Normal file
26
demos/2. same branch goto/same_branch_goto_log.tscn
Normal file
@@ -0,0 +1,26 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://dkfjywgk5gykn"]
|
||||
|
||||
[ext_resource type="Script" path="res://demos/2. same branch goto/same_branch_goto_log.gd" id="1_biw57"]
|
||||
[ext_resource type="Script" path="res://demos/2. same branch goto/same_branch_goto_dialogue.gd" id="2_bn40h"]
|
||||
|
||||
[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_biw57")
|
||||
dialogue_gdscript = ExtResource("2_bn40h")
|
||||
|
||||
[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