diff --git a/addons/dialogic/Modules/CallNode/event_call_node.gd b/addons/dialogic/Modules/CallNode/event_call_node.gd index dfbb37cdf..4bbfad039 100644 --- a/addons/dialogic/Modules/CallNode/event_call_node.gd +++ b/addons/dialogic/Modules/CallNode/event_call_node.gd @@ -44,7 +44,9 @@ func _execute() -> void: if inline: dialogic.text_signal.connect(_call_on_signal, CONNECT_PERSIST) elif wait: + dialogic.current_state = dialogic.States.WAITING await n.callv(method, arguments) + dialogic.current_state = dialogic.States.IDLE else: n.callv(method, arguments) else: diff --git a/addons/dialogic/Modules/DefaultLayouts/Default/DialogicDefaultLayout.gd b/addons/dialogic/Modules/DefaultLayouts/Default/DialogicDefaultLayout.gd index cd43f0192..99f7710c2 100644 --- a/addons/dialogic/Modules/DefaultLayouts/Default/DialogicDefaultLayout.gd +++ b/addons/dialogic/Modules/DefaultLayouts/Default/DialogicDefaultLayout.gd @@ -3,6 +3,12 @@ extends CanvasLayer enum Alignments {LEFT, CENTER, RIGHT} +# Careful: Sync these with the ones in the %Animation script! +enum AnimationsIn {NONE, POP_IN, FADE_UP} +enum AnimationsOut {NONE, POP_OUT, FADE_DOWN} +enum AnimationsNewText {NONE, WIGGLE} + + @export_group("Main") @export_subgroup("Text") @export var text_alignment :Alignments= Alignments.LEFT @@ -16,6 +22,9 @@ enum Alignments {LEFT, CENTER, RIGHT} @export_subgroup("Box") @export var box_modulate : Color = Color(0.00784313771874, 0.00784313771874, 0.00784313771874, 0.84313726425171) @export var box_size : Vector2 = Vector2(550, 110) +@export var box_animation_in := AnimationsIn.FADE_UP +@export var box_animation_out := AnimationsOut.FADE_DOWN +@export var box_animation_new_text := AnimationsNewText.NONE @export_subgroup("Name Label") @export var name_label_alignment := Alignments.LEFT @@ -39,6 +48,9 @@ enum Alignments {LEFT, CENTER, RIGHT} @export_subgroup('Portraits') @export var portrait_size_mode := DialogicNode_PortraitContainer.SizeModes.FIT_SCALE_HEIGHT +@export_subgroup("Indicators") +@export var autoadvance_progressbar := true + ## Called by dialogic whenever export overrides might change func _apply_export_overrides(): @@ -69,6 +81,12 @@ func _apply_export_overrides(): %DialogTextPanel.custom_minimum_size = box_size %TextInputPanel.self_modulate = box_modulate + ## BOX ANIMATIONS + %Animations.animation_in = box_animation_in + %Animations.animation_out = box_animation_out + %Animations.animation_new_text = box_animation_new_text + + ## NAME LABEL SETTINGS %DialogicNode_NameLabel.add_theme_font_size_override("font_size", name_label_font_size) @@ -99,3 +117,6 @@ func _apply_export_overrides(): ## PORTRAIT SETTINGS for child in %Portraits.get_children(): child.size_mode = portrait_size_mode + + ## OTHER + %AutoAdvanceProgressbar.enabled = autoadvance_progressbar diff --git a/addons/dialogic/Modules/DefaultLayouts/Default/DialogicDefaultLayout.tscn b/addons/dialogic/Modules/DefaultLayouts/Default/DialogicDefaultLayout.tscn index 9e1b12c1b..e2220c8e4 100644 --- a/addons/dialogic/Modules/DefaultLayouts/Default/DialogicDefaultLayout.tscn +++ b/addons/dialogic/Modules/DefaultLayouts/Default/DialogicDefaultLayout.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=30 format=3 uid="uid://uan2wdyuprb6"] +[gd_scene load_steps=31 format=3 uid="uid://uan2wdyuprb6"] [ext_resource type="Script" path="res://addons/dialogic/Modules/DefaultLayouts/Default/DialogicDefaultLayout.gd" id="1"] [ext_resource type="Script" path="res://addons/dialogic/Modules/Text/node_dialog_text.gd" id="2"] @@ -27,19 +27,19 @@ length = 0.001 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("DialogTextAnimationParent:position") +tracks/0/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:position") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { "times": PackedFloat32Array(0), "transitions": PackedFloat32Array(1), "update": 0, -"values": [Vector2(576, 648)] +"values": [Vector2(0, 0)] } tracks/1/type = "value" tracks/1/imported = false tracks/1/enabled = true -tracks/1/path = NodePath("DialogTextAnimationParent:rotation") +tracks/1/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:rotation") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/keys = { @@ -51,7 +51,7 @@ tracks/1/keys = { tracks/2/type = "value" tracks/2/imported = false tracks/2/enabled = true -tracks/2/path = NodePath("DialogTextAnimationParent:scale") +tracks/2/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:scale") tracks/2/interp = 1 tracks/2/loop_wrap = true tracks/2/keys = { @@ -63,7 +63,7 @@ tracks/2/keys = { tracks/3/type = "value" tracks/3/imported = false tracks/3/enabled = true -tracks/3/path = NodePath("DialogTextAnimationParent:modulate") +tracks/3/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:modulate") tracks/3/interp = 1 tracks/3/loop_wrap = true tracks/3/keys = { @@ -75,7 +75,7 @@ tracks/3/keys = { tracks/4/type = "bezier" tracks/4/imported = false tracks/4/enabled = true -tracks/4/path = NodePath("%DialogTextPanel:rotation") +tracks/4/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent/DialogTextPanel:rotation") tracks/4/interp = 1 tracks/4/loop_wrap = true tracks/4/keys = { @@ -90,7 +90,7 @@ length = 0.4 tracks/0/type = "method" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("%DialogicNode_DialogText") +tracks/0/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent/DialogTextPanel/DialogicNode_DialogText") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { @@ -104,7 +104,7 @@ tracks/0/keys = { tracks/1/type = "bezier" tracks/1/imported = false tracks/1/enabled = true -tracks/1/path = NodePath("%DialogTextPanel:rotation") +tracks/1/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent/DialogTextPanel:rotation") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/keys = { @@ -113,25 +113,77 @@ tracks/1/keys = { "times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4) } +[sub_resource type="Animation" id="Animation_g6k55"] +resource_name = "textbox_fade_up" +length = 0.7 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:position") +tracks/0/interp = 2 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.3, 0.7), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 0, +"values": [Vector2(0, 50), Vector2(0, 19.6793), Vector2(0, 0)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:modulate") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0.1, 0.6), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:rotation") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [0.0] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:scale") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(1, 1)] +} + [sub_resource type="Animation" id="Animation_htbgc"] -resource_name = "text_box_reveal" +resource_name = "textbox_pop" length = 0.3 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("DialogTextAnimationParent:position") +tracks/0/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:position") tracks/0/interp = 2 tracks/0/loop_wrap = true tracks/0/keys = { -"times": PackedFloat32Array(0, 0.2, 0.3), -"transitions": PackedFloat32Array(1, 1, 1), +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), "update": 0, -"values": [Vector2(577, 700), Vector2(582, 647), Vector2(576, 648)] +"values": [Vector2(0, 0)] } tracks/1/type = "value" tracks/1/imported = false tracks/1/enabled = true -tracks/1/path = NodePath("DialogTextAnimationParent:rotation") +tracks/1/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:rotation") tracks/1/interp = 2 tracks/1/loop_wrap = true tracks/1/keys = { @@ -143,7 +195,7 @@ tracks/1/keys = { tracks/2/type = "value" tracks/2/imported = false tracks/2/enabled = true -tracks/2/path = NodePath("DialogTextAnimationParent:scale") +tracks/2/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:scale") tracks/2/interp = 2 tracks/2/loop_wrap = true tracks/2/keys = { @@ -155,7 +207,7 @@ tracks/2/keys = { tracks/3/type = "value" tracks/3/imported = false tracks/3/enabled = true -tracks/3/path = NodePath("DialogTextAnimationParent:modulate") +tracks/3/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:modulate") tracks/3/interp = 1 tracks/3/loop_wrap = true tracks/3/keys = { @@ -169,7 +221,8 @@ tracks/3/keys = { _data = { "RESET": SubResource("Animation_au0a2"), "new_text": SubResource("Animation_6kbwc"), -"text_box_reveal": SubResource("Animation_htbgc") +"textbox_fade_up": SubResource("Animation_g6k55"), +"textbox_pop": SubResource("Animation_htbgc") } [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_q3vpc"] @@ -213,7 +266,11 @@ expand_margin_bottom = 5.0 [node name="DefaultDialogNode" type="CanvasLayer"] script = ExtResource("1") +box_animation_in = 1 +box_animation_out = 1 +box_animation_new_text = 1 name_label_box_modulate = Color(0.00784314, 0.00784314, 0.00784314, 0.843137) +autoadvance_progressbar = null [node name="DialogicNode_BackgroundHolder" type="CanvasLayer" parent="."] layer = -1 @@ -275,7 +332,6 @@ grow_vertical = 2 mouse_filter = 2 script = ExtResource("3_dbhei") position_index = 3 -mirrored = true metadata/_edit_use_anchors_ = true [node name="DialogicNode_PortraitContainer5" type="Control" parent="Portraits/Portraits"] @@ -289,7 +345,6 @@ grow_vertical = 2 mouse_filter = 2 script = ExtResource("3_dbhei") position_index = 4 -mirrored = true metadata/_edit_use_anchors_ = true [node name="DefaultStyle" type="Control" parent="."] @@ -302,6 +357,7 @@ grow_vertical = 2 mouse_filter = 2 [node name="Animations" type="AnimationPlayer" parent="DefaultStyle"] +unique_name_in_owner = true autoplay = "RESET" libraries = { "": SubResource("AnimationLibrary_c14kh") @@ -360,7 +416,17 @@ sound_pressed = ExtResource("14") sound_hover = ExtResource("11") sound_focus = ExtResource("13") -[node name="DialogTextAnimationParent" type="Control" parent="DefaultStyle"] +[node name="DialogicTextAnchor" type="Control" parent="DefaultStyle"] +layout_mode = 1 +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 0 + +[node name="DialogTextAnimationParent" type="Control" parent="DefaultStyle/DialogicTextAnchor"] layout_mode = 1 anchors_preset = 7 anchor_left = 0.5 @@ -370,7 +436,7 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 0 -[node name="DialogTextPanel" type="PanelContainer" parent="DefaultStyle/DialogTextAnimationParent"] +[node name="DialogTextPanel" type="PanelContainer" parent="DefaultStyle/DialogicTextAnchor/DialogTextAnimationParent"] unique_name_in_owner = true self_modulate = Color(0.00784314, 0.00784314, 0.00784314, 0.843137) custom_minimum_size = Vector2(500, 110) @@ -390,7 +456,7 @@ pivot_offset = Vector2(275, 60) theme_override_styles/panel = SubResource("StyleBoxFlat_q3vpc") metadata/_edit_layout_mode = 1 -[node name="DialogicNode_DialogText" type="RichTextLabel" parent="DefaultStyle/DialogTextAnimationParent/DialogTextPanel" node_paths=PackedStringArray("textbox_root")] +[node name="DialogicNode_DialogText" type="RichTextLabel" parent="DefaultStyle/DialogicTextAnchor/DialogTextAnimationParent/DialogTextPanel" node_paths=PackedStringArray("textbox_root")] unique_name_in_owner = true layout_mode = 2 theme_override_colors/default_color = Color(1, 1, 1, 1) @@ -404,11 +470,11 @@ visible_characters_behavior = 1 script = ExtResource("2") textbox_root = NodePath("..") -[node name="DialogicNode_TypeSounds" type="AudioStreamPlayer" parent="DefaultStyle/DialogTextAnimationParent/DialogTextPanel/DialogicNode_DialogText"] +[node name="DialogicNode_TypeSounds" type="AudioStreamPlayer" parent="DefaultStyle/DialogicTextAnchor/DialogTextAnimationParent/DialogTextPanel/DialogicNode_DialogText"] script = ExtResource("10") play_every_character = 0 -[node name="NextIndicator" type="Control" parent="DefaultStyle/DialogTextAnimationParent/DialogTextPanel"] +[node name="NextIndicator" type="Control" parent="DefaultStyle/DialogicTextAnchor/DialogTextAnimationParent/DialogTextPanel"] unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 8 @@ -417,7 +483,8 @@ script = ExtResource("20_ljcq2") show_on_questions = true metadata/_edit_layout_mode = 1 -[node name="AutoAdvanceProgressbar" type="ProgressBar" parent="DefaultStyle/DialogTextAnimationParent/DialogTextPanel"] +[node name="AutoAdvanceProgressbar" type="ProgressBar" parent="DefaultStyle/DialogicTextAnchor/DialogTextAnimationParent/DialogTextPanel"] +unique_name_in_owner = true modulate = Color(1, 1, 1, 0.188235) custom_minimum_size = Vector2(0, 10) layout_mode = 2 @@ -428,11 +495,11 @@ value = 0.5 show_percentage = false script = ExtResource("15_ptoy3") -[node name="NameLabelHolder" type="Control" parent="DefaultStyle/DialogTextAnimationParent/DialogTextPanel"] +[node name="NameLabelHolder" type="Control" parent="DefaultStyle/DialogicTextAnchor/DialogTextAnimationParent/DialogTextPanel"] layout_mode = 2 mouse_filter = 2 -[node name="NameLabelPanel" type="PanelContainer" parent="DefaultStyle/DialogTextAnimationParent/DialogTextPanel/NameLabelHolder"] +[node name="NameLabelPanel" type="PanelContainer" parent="DefaultStyle/DialogicTextAnchor/DialogTextAnimationParent/DialogTextPanel/NameLabelHolder"] unique_name_in_owner = true self_modulate = Color(0.00784314, 0.00784314, 0.00784314, 0.843137) layout_mode = 1 @@ -446,7 +513,7 @@ metadata/_edit_layout_mode = 1 metadata/_edit_use_custom_anchors = true metadata/_edit_group_ = true -[node name="DialogicNode_NameLabel" type="Label" parent="DefaultStyle/DialogTextAnimationParent/DialogTextPanel/NameLabelHolder/NameLabelPanel"] +[node name="DialogicNode_NameLabel" type="Label" parent="DefaultStyle/DialogicTextAnchor/DialogTextAnimationParent/DialogTextPanel/NameLabelHolder/NameLabelPanel"] unique_name_in_owner = true layout_mode = 2 theme_override_colors/font_color = Color(1, 1, 1, 1) @@ -476,7 +543,7 @@ metadata/_edit_layout_mode = 1 [node name="TextInputPanel" type="PanelContainer" parent="DefaultStyle/DialogicNode_TextInput"] unique_name_in_owner = true -self_modulate = Color(0.360784, 0.0941176, 0.168627, 1) +self_modulate = Color(0, 0, 0, 0.780392) layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -571,5 +638,5 @@ history_font_bold = ExtResource("24_aa4pl") history_font_italics = ExtResource("25_wt3bc") metadata/_edit_lock_ = true -[connection signal="meta_hover_ended" from="DefaultStyle/DialogTextAnimationParent/DialogTextPanel/DialogicNode_DialogText" to="DefaultStyle/Glossary" method="_on_dialogic_display_dialog_text_meta_hover_ended"] -[connection signal="meta_hover_started" from="DefaultStyle/DialogTextAnimationParent/DialogTextPanel/DialogicNode_DialogText" to="DefaultStyle/Glossary" method="_on_dialogic_display_dialog_text_meta_hover_started"] +[connection signal="meta_hover_ended" from="DefaultStyle/DialogicTextAnchor/DialogTextAnimationParent/DialogTextPanel/DialogicNode_DialogText" to="DefaultStyle/Glossary" method="_on_dialogic_display_dialog_text_meta_hover_ended"] +[connection signal="meta_hover_started" from="DefaultStyle/DialogicTextAnchor/DialogTextAnimationParent/DialogTextPanel/DialogicNode_DialogText" to="DefaultStyle/Glossary" method="_on_dialogic_display_dialog_text_meta_hover_started"] diff --git a/addons/dialogic/Modules/DefaultLayouts/Default/ExampleGlossaryPopup.gd b/addons/dialogic/Modules/DefaultLayouts/Default/ExampleGlossaryPopup.gd index 03f256c6d..4a26b0cda 100644 --- a/addons/dialogic/Modules/DefaultLayouts/Default/ExampleGlossaryPopup.gd +++ b/addons/dialogic/Modules/DefaultLayouts/Default/ExampleGlossaryPopup.gd @@ -2,6 +2,7 @@ extends Control func _ready() -> void: hide() + Dialogic.Text.animation_textbox_hide.connect(hide) func _process(delta) -> void: if visible: diff --git a/addons/dialogic/Modules/DefaultLayouts/Default/animations.gd b/addons/dialogic/Modules/DefaultLayouts/Default/animations.gd index 1c4a2986f..727d032ec 100644 --- a/addons/dialogic/Modules/DefaultLayouts/Default/animations.gd +++ b/addons/dialogic/Modules/DefaultLayouts/Default/animations.gd @@ -2,6 +2,16 @@ extends AnimationPlayer # A custom script/node that adds some animations to the textbox. +# Careful: Sync these with the ones in the root script! +enum AnimationsIn {NONE, POP_IN, FADE_UP} +enum AnimationsOut {NONE, POP_OUT, FADE_DOWN} +enum AnimationsNewText {NONE, WIGGLE} + +var animation_in : AnimationsIn +var animation_out : AnimationsOut +var animation_new_text : AnimationsNewText + + func _ready(): Dialogic.Text.animation_textbox_hide.connect(_on_textbox_hide) Dialogic.Text.animation_textbox_show.connect(_on_textbox_show) @@ -9,24 +19,45 @@ func _ready(): func _on_textbox_show(): + if animation_in == AnimationsIn.NONE: + return + play('RESET') Dialogic.Animation.start_animating() + %DialogTextPanel.get_parent().modulate = Color.TRANSPARENT %DialogicNode_DialogText.text = "" - get_node("../DialogTextAnimationParent").modulate = Color.TRANSPARENT - play("text_box_reveal") + match animation_in: + AnimationsIn.POP_IN: + play("textbox_pop") + AnimationsIn.FADE_UP: + play("textbox_fade_up") if not animation_finished.is_connected(Dialogic.Animation.animation_finished): animation_finished.connect(Dialogic.Animation.animation_finished, CONNECT_ONE_SHOT) func _on_textbox_hide(): + if animation_out == AnimationsOut.NONE: + return + play('RESET') Dialogic.Animation.start_animating() - play_backwards("text_box_reveal") + match animation_out: + AnimationsOut.POP_OUT: + play_backwards("textbox_pop") + AnimationsOut.FADE_DOWN: + play_backwards("textbox_fade_up") + if not animation_finished.is_connected(Dialogic.Animation.animation_finished): animation_finished.connect(Dialogic.Animation.animation_finished, CONNECT_ONE_SHOT) func _on_textbox_new_text(): + if animation_new_text == AnimationsNewText.NONE: + return + Dialogic.Animation.start_animating() %DialogicNode_DialogText.text = "" - play("new_text") + match animation_new_text: + AnimationsNewText.WIGGLE: + play("new_text") + if not animation_finished.is_connected(Dialogic.Animation.animation_finished): animation_finished.connect(Dialogic.Animation.animation_finished, CONNECT_ONE_SHOT) diff --git a/addons/dialogic/Modules/DefaultLayouts/Default/autoadvance_indicator.gd b/addons/dialogic/Modules/DefaultLayouts/Default/autoadvance_indicator.gd index 7ee13ba54..efab8a3c6 100644 --- a/addons/dialogic/Modules/DefaultLayouts/Default/autoadvance_indicator.gd +++ b/addons/dialogic/Modules/DefaultLayouts/Default/autoadvance_indicator.gd @@ -1,6 +1,11 @@ extends Range +var enabled := true + func _process(delta): + if !enabled: + hide() + return if Dialogic.Text.get_autoadvance_progress() < 0: hide() else: diff --git a/addons/dialogic/Modules/Text/subsystem_text.gd b/addons/dialogic/Modules/Text/subsystem_text.gd index ddfcecd4c..97145717e 100644 --- a/addons/dialogic/Modules/Text/subsystem_text.gd +++ b/addons/dialogic/Modules/Text/subsystem_text.gd @@ -181,7 +181,7 @@ func hide_text_boxes(instant:=false) -> void: if text_node.textbox_root.visible and !emitted: textbox_visibility_changed.emit(false) emitted = true - text_node.textbox_root.visible = false + text_node.textbox_root.hide() func is_textbox_visible() -> bool: @@ -194,13 +194,13 @@ func show_text_boxes(instant:=false) -> void: for text_node in get_tree().get_nodes_in_group('dialogic_dialog_text'): if !text_node.textbox_root.visible and !emitted: animation_textbox_show.emit() - text_node.textbox_root.set_deferred('visible', true) + text_node.textbox_root.show() if Dialogic.Animation.is_animating(): await Dialogic.Animation.finished textbox_visibility_changed.emit(true) emitted = true else: - text_node.textbox_root.visible = true + text_node.textbox_root.show() func show_next_indicators(question=false, autoadvance=false) -> void: