update dialogic
This commit is contained in:
parent
e14eb9eb1d
commit
91fa0160d2
68 changed files with 851 additions and 976 deletions
|
@ -1,60 +1,18 @@
|
||||||
[gd_scene load_steps=14 format=2]
|
[gd_scene load_steps=8 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Example Assets/next-indicator/next-indicator.png" type="Texture" id=1]
|
[ext_resource path="res://addons/dialogic/Nodes/TextBubble.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Example Assets/backgrounds/background-2.png" type="Texture" id=2]
|
|
||||||
[ext_resource path="res://addons/dialogic/Example Assets/Fonts/DefaultFont.tres" type="DynamicFont" id=3]
|
|
||||||
[ext_resource path="res://addons/dialogic/Example Assets/Fonts/GlossaryFont.tres" type="DynamicFont" id=4]
|
[ext_resource path="res://addons/dialogic/Example Assets/Fonts/GlossaryFont.tres" type="DynamicFont" id=4]
|
||||||
[ext_resource path="res://addons/dialogic/Nodes/glossary_info.gd" type="Script" id=5]
|
[ext_resource path="res://addons/dialogic/Nodes/glossary_info.gd" type="Script" id=5]
|
||||||
[ext_resource path="res://addons/dialogic/Nodes/dialog_node.gd" type="Script" id=6]
|
[ext_resource path="res://addons/dialogic/Nodes/dialog_node.gd" type="Script" id=6]
|
||||||
[ext_resource path="res://addons/dialogic/Nodes/BackgroundMusic.tscn" type="PackedScene" id=7]
|
[ext_resource path="res://addons/dialogic/Nodes/BackgroundMusic.tscn" type="PackedScene" id=7]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id=2]
|
||||||
|
bg_color = Color( 0.196078, 0.196078, 0.196078, 0 )
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id=1]
|
[sub_resource type="StyleBoxFlat" id=1]
|
||||||
bg_color = Color( 1, 1, 1, 0 )
|
bg_color = Color( 1, 1, 1, 0 )
|
||||||
expand_margin_left = 10.0
|
expand_margin_left = 10.0
|
||||||
|
|
||||||
[sub_resource type="Animation" id=2]
|
|
||||||
resource_name = "Pulse"
|
|
||||||
loop = true
|
|
||||||
tracks/0/type = "value"
|
|
||||||
tracks/0/path = NodePath(".:self_modulate")
|
|
||||||
tracks/0/interp = 2
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PoolRealArray( 0, 0.5 ),
|
|
||||||
"transitions": PoolRealArray( 1, 1 ),
|
|
||||||
"update": 0,
|
|
||||||
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id=3]
|
|
||||||
resource_name = "Static"
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id=4]
|
|
||||||
loop = true
|
|
||||||
tracks/0/type = "value"
|
|
||||||
tracks/0/path = NodePath(".:margin_bottom")
|
|
||||||
tracks/0/interp = 2
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PoolRealArray( 0, 0.5 ),
|
|
||||||
"transitions": PoolRealArray( 1, 1 ),
|
|
||||||
"update": 0,
|
|
||||||
"values": [ 12.0, 55.0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id=5]
|
|
||||||
content_margin_left = 10.0
|
|
||||||
content_margin_right = 10.0
|
|
||||||
bg_color = Color( 1, 1, 1, 0 )
|
|
||||||
expand_margin_left = 10.0
|
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id=6]
|
|
||||||
bg_color = Color( 0.196078, 0.196078, 0.196078, 0 )
|
|
||||||
|
|
||||||
[node name="DialogNode" type="Control"]
|
[node name="DialogNode" type="Control"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
|
@ -63,16 +21,6 @@ __meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Background" type="TextureRect" parent="."]
|
|
||||||
visible = false
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
expand = true
|
|
||||||
stretch_mode = 1
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="Portraits" type="Control" parent="."]
|
[node name="Portraits" type="Control" parent="."]
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_top = 1.0
|
anchor_top = 1.0
|
||||||
|
@ -82,174 +30,20 @@ __meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="TextBubble" type="Control" parent="."]
|
[node name="TextBubble" parent="." instance=ExtResource( 1 )]
|
||||||
anchor_left = 0.5
|
|
||||||
anchor_top = 1.0
|
|
||||||
anchor_right = 0.5
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
margin_left = -455.0
|
|
||||||
margin_top = -207.0
|
|
||||||
margin_right = 455.0
|
|
||||||
margin_bottom = -40.0
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="ColorRect" type="ColorRect" parent="TextBubble"]
|
|
||||||
visible = false
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
color = Color( 0, 0, 0, 1 )
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="TextBubble"]
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
texture = ExtResource( 2 )
|
|
||||||
expand = true
|
|
||||||
stretch_mode = 1
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="RichTextLabel" type="RichTextLabel" parent="TextBubble"]
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
margin_left = 20.0
|
|
||||||
margin_top = 10.0
|
|
||||||
margin_right = -20.0
|
|
||||||
margin_bottom = -10.0
|
|
||||||
rect_clip_content = false
|
|
||||||
custom_styles/normal = SubResource( 1 )
|
|
||||||
custom_fonts/normal_font = ExtResource( 3 )
|
|
||||||
custom_colors/default_color = Color( 1, 1, 1, 1 )
|
|
||||||
custom_colors/font_color_shadow = Color( 1, 1, 1, 0 )
|
|
||||||
custom_constants/shadow_offset_x = 2
|
|
||||||
custom_constants/shadow_offset_y = 2
|
|
||||||
bbcode_enabled = true
|
|
||||||
bbcode_text = "Placeholder text for testing and formatting."
|
|
||||||
meta_underlined = false
|
|
||||||
text = "Placeholder text for testing and formatting."
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="NextIndicator" type="TextureRect" parent="TextBubble"]
|
|
||||||
visible = false
|
|
||||||
anchor_left = 1.0
|
|
||||||
anchor_top = 1.0
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
margin_left = -36.4279
|
|
||||||
margin_top = -35.9016
|
|
||||||
margin_right = 14.5721
|
|
||||||
margin_bottom = 25.4599
|
|
||||||
rect_scale = Vector2( 0.4, 0.4 )
|
|
||||||
texture = ExtResource( 1 )
|
|
||||||
stretch_mode = 4
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="TextBubble/NextIndicator"]
|
|
||||||
autoplay = "Up and down"
|
|
||||||
anims/Pulse = SubResource( 2 )
|
|
||||||
anims/Static = SubResource( 3 )
|
|
||||||
"anims/Up and down" = SubResource( 4 )
|
|
||||||
|
|
||||||
[node name="NameLabel" type="Label" parent="TextBubble"]
|
|
||||||
margin_top = -48.0
|
|
||||||
margin_right = 58.0
|
|
||||||
margin_bottom = -8.0
|
|
||||||
size_flags_vertical = 1
|
|
||||||
custom_styles/normal = SubResource( 5 )
|
|
||||||
custom_fonts/font = ExtResource( 3 )
|
|
||||||
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
|
||||||
custom_colors/font_color_shadow = Color( 0, 0, 0, 0.619608 )
|
|
||||||
custom_constants/shadow_offset_x = 2
|
|
||||||
custom_constants/shadow_offset_y = 2
|
|
||||||
align = 1
|
|
||||||
valign = 1
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="ColorRect" type="ColorRect" parent="TextBubble/NameLabel"]
|
|
||||||
visible = false
|
|
||||||
show_behind_parent = true
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
size_flags_horizontal = 15
|
|
||||||
size_flags_vertical = 15
|
|
||||||
color = Color( 0.156863, 0.156863, 0.156863, 1 )
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="TextBubble/NameLabel"]
|
|
||||||
show_behind_parent = true
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
size_flags_vertical = 3
|
|
||||||
texture = ExtResource( 2 )
|
|
||||||
expand = true
|
|
||||||
stretch_mode = 1
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="Tween" type="Tween" parent="TextBubble"]
|
|
||||||
|
|
||||||
[node name="CloseDialog" type="Control" parent="TextBubble"]
|
|
||||||
margin_right = 40.0
|
|
||||||
margin_bottom = 40.0
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="Tween" type="Tween" parent="TextBubble/CloseDialog"]
|
|
||||||
|
|
||||||
[node name="Timer" type="Timer" parent="TextBubble/CloseDialog"]
|
|
||||||
|
|
||||||
[node name="Options" type="VBoxContainer" parent="."]
|
[node name="Options" type="VBoxContainer" parent="."]
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.5
|
||||||
margin_left = -20.0
|
|
||||||
margin_top = -19.9999
|
|
||||||
margin_right = 20.0
|
|
||||||
margin_bottom = 19.9999
|
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
alignment = 1
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="TextInputDialog" type="AcceptDialog" parent="."]
|
|
||||||
anchor_left = 0.5
|
|
||||||
anchor_top = 0.5
|
|
||||||
anchor_right = 0.5
|
|
||||||
anchor_bottom = 0.5
|
|
||||||
margin_left = -192.0
|
|
||||||
margin_top = -57.0
|
|
||||||
margin_right = 192.0
|
|
||||||
margin_bottom = 57.0
|
|
||||||
popup_exclusive = true
|
|
||||||
dialog_hide_on_ok = false
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="LineEdit" type="LineEdit" parent="TextInputDialog"]
|
|
||||||
margin_left = 8.0
|
|
||||||
margin_top = 8.0
|
|
||||||
margin_right = 376.0
|
|
||||||
margin_bottom = 78.0
|
|
||||||
|
|
||||||
[node name="FX" type="Control" parent="."]
|
[node name="FX" type="Control" parent="."]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
|
@ -260,20 +54,6 @@ __meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="FadeInNode" type="ColorRect" parent="FX"]
|
|
||||||
modulate = Color( 1, 1, 1, 0 )
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
mouse_filter = 2
|
|
||||||
color = Color( 0, 0, 0, 1 )
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="Tween" type="Tween" parent="FX/FadeInNode"]
|
|
||||||
|
|
||||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="FX"]
|
|
||||||
|
|
||||||
[node name="BackgroundMusic" parent="FX" instance=ExtResource( 7 )]
|
[node name="BackgroundMusic" parent="FX" instance=ExtResource( 7 )]
|
||||||
|
|
||||||
[node name="DefinitionInfo" type="PanelContainer" parent="."]
|
[node name="DefinitionInfo" type="PanelContainer" parent="."]
|
||||||
|
@ -282,7 +62,7 @@ margin_right = 208.0
|
||||||
mouse_filter = 1
|
mouse_filter = 1
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
custom_styles/panel = SubResource( 6 )
|
custom_styles/panel = SubResource( 2 )
|
||||||
script = ExtResource( 5 )
|
script = ExtResource( 5 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_group_": true,
|
"_edit_group_": true,
|
||||||
|
@ -349,9 +129,4 @@ __meta__ = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Timer" type="Timer" parent="DefinitionInfo"]
|
[node name="Timer" type="Timer" parent="DefinitionInfo"]
|
||||||
|
|
||||||
[node name="WaitSeconds" type="Timer" parent="."]
|
|
||||||
[connection signal="meta_hover_ended" from="TextBubble/RichTextLabel" to="." method="_on_RichTextLabel_meta_hover_ended"]
|
|
||||||
[connection signal="meta_hover_started" from="TextBubble/RichTextLabel" to="." method="_on_RichTextLabel_meta_hover_started"]
|
|
||||||
[connection signal="timeout" from="DefinitionInfo/Timer" to="." method="_on_Definition_Timer_timeout"]
|
[connection signal="timeout" from="DefinitionInfo/Timer" to="." method="_on_Definition_Timer_timeout"]
|
||||||
[connection signal="timeout" from="WaitSeconds" to="." method="_on_WaitSeconds_timeout"]
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ onready var settings_editor = $MainPanel/SettingsEditor
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
# Adding file dialog to get used by pieces
|
# Adding file dialog to get used by Events
|
||||||
editor_file_dialog = EditorFileDialog.new()
|
editor_file_dialog = EditorFileDialog.new()
|
||||||
add_child(editor_file_dialog)
|
add_child(editor_file_dialog)
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
[gd_scene load_steps=6 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/AudioBlock.gd" type="Script" id=1]
|
[ext_resource path="res://addons/dialogic/Editor/Events/AudioBlock.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/audio-event.svg" type="Texture" id=3]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/audio-event.svg" type="Texture" id=3]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
||||||
|
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id=1]
|
[sub_resource type="StyleBoxFlat" id=1]
|
||||||
content_margin_left = 16.0
|
content_margin_left = 16.0
|
|
@ -1,9 +1,10 @@
|
||||||
[gd_scene load_steps=6 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/BackgroundMusic.gd" type="Script" id=1]
|
[ext_resource path="res://addons/dialogic/Editor/Events/BackgroundMusic.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/background-music.svg" type="Texture" id=3]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/background-music.svg" type="Texture" id=3]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
||||||
|
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id=1]
|
[sub_resource type="StyleBoxFlat" id=1]
|
||||||
content_margin_left = 16.0
|
content_margin_left = 16.0
|
|
@ -1,9 +1,10 @@
|
||||||
[gd_scene load_steps=6 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/call-node.svg" type="Texture" id=1]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/call-node.svg" type="Texture" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/CallNode.gd" type="Script" id=2]
|
[ext_resource path="res://addons/dialogic/Editor/Events/CallNode.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
[gd_scene load_steps=6 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/ChangeScene.gd" type="Script" id=1]
|
[ext_resource path="res://addons/dialogic/Editor/Events/ChangeScene.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/change-scene.svg" type="Texture" id=3]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/change-scene.svg" type="Texture" id=3]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
[gd_scene load_steps=6 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/ChangeTimeline.gd" type="Script" id=1]
|
[ext_resource path="res://addons/dialogic/Editor/Events/ChangeTimeline.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/change-timeline.svg" type="Texture" id=3]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/change-timeline.svg" type="Texture" id=3]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
[gd_scene load_steps=9 format=2]
|
[gd_scene load_steps=9 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/CharacterJoinBlock.gd" type="Script" id=3]
|
[ext_resource path="res://addons/dialogic/Editor/Events/CharacterJoinBlock.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/character-join.svg" type="Texture" id=4]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/character-join.svg" type="Texture" id=4]
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/character.svg" type="Texture" id=5]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/character.svg" type="Texture" id=5]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PortraitPicker.tscn" type="PackedScene" id=7]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PortraitPicker.tscn" type="PackedScene" id=7]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/CharacterPicker.tscn" type="PackedScene" id=8]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/CharacterPicker.tscn" type="PackedScene" id=8]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
[gd_scene load_steps=6 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/CharacterLeaveBlock.gd" type="Script" id=1]
|
[ext_resource path="res://addons/dialogic/Editor/Events/CharacterLeaveBlock.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/character-leave.svg" type="Texture" id=3]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/character-leave.svg" type="Texture" id=3]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
[gd_scene load_steps=8 format=2]
|
[gd_scene load_steps=8 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/choice.svg" type="Texture" id=1]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/choice.svg" type="Texture" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Choice.gd" type="Script" id=2]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Choice.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/warning.svg" type="Texture" id=6]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/warning.svg" type="Texture" id=6]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/CustomLineEdit.tscn" type="PackedScene" id=7]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/CustomLineEdit.tscn" type="PackedScene" id=7]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
[gd_scene load_steps=6 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/close-dialog.svg" type="Texture" id=2]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/close-dialog.svg" type="Texture" id=2]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/CloseDialog.gd" type="Script" id=4]
|
[ext_resource path="res://addons/dialogic/Editor/Events/CloseDialog.gd" type="Script" id=4]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=5]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=5]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/character.svg" type="Texture" id=1]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/character.svg" type="Texture" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/CharacterPicker.gd" type="Script" id=2]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/CharacterPicker.gd" type="Script" id=2]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
[gd_scene load_steps=2 format=2]
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/ConditionPicker.gd" type="Script" id=1]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/ConditionPicker.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
|
||||||
[node name="ConditionPicker" type="MenuButton"]
|
[node name="ConditionPicker" type="MenuButton"]
|
||||||
margin_left = 173.0
|
margin_left = 173.0
|
|
@ -1,6 +1,7 @@
|
||||||
[gd_scene load_steps=2 format=2]
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DefinitionPicker.gd" type="Script" id=1]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/DefinitionPicker.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
|
||||||
[node name="DefinitionPicker" type="MenuButton"]
|
[node name="DefinitionPicker" type="MenuButton"]
|
||||||
margin_right = 157.0
|
margin_right = 157.0
|
|
@ -1,6 +1,7 @@
|
||||||
[gd_scene load_steps=2 format=2]
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/OperationPicker.gd" type="Script" id=1]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/OperationPicker.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
|
||||||
[node name="OperationPicker" type="MenuButton"]
|
[node name="OperationPicker" type="MenuButton"]
|
||||||
margin_left = 284.0
|
margin_left = 284.0
|
|
@ -1,7 +1,8 @@
|
||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Images/Pieces/expand-icon.svg" type="Texture" id=1]
|
[ext_resource path="res://addons/dialogic/Images/Pieces/expand-icon.svg" type="Texture" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.gd" type="Script" id=2]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.gd" type="Script" id=2]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[node name="OptionButton" type="MenuButton"]
|
[node name="OptionButton" type="MenuButton"]
|
|
@ -1,7 +1,8 @@
|
||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/Portrait.svg" type="Texture" id=1]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/Portrait.svg" type="Texture" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PortraitPicker.gd" type="Script" id=2]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PortraitPicker.gd" type="Script" id=2]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,10 @@ func disabled():
|
||||||
is_disabled = true
|
is_disabled = true
|
||||||
|
|
||||||
|
|
||||||
func _on_VisibleToggle_toggled(button_pressed):
|
func set_visible(visible: bool):
|
||||||
if is_disabled:
|
pressed = visible
|
||||||
return
|
|
||||||
var current_rect_size = current_piece.get("rect_size")
|
var current_rect_size = current_piece.get("rect_size")
|
||||||
if button_pressed:
|
if visible:
|
||||||
current_piece.get_node("PanelContainer/VBoxContainer/Header/Preview").hide()
|
current_piece.get_node("PanelContainer/VBoxContainer/Header/Preview").hide()
|
||||||
|
|
||||||
var index = 0
|
var index = 0
|
||||||
|
@ -42,3 +41,9 @@ func _on_VisibleToggle_toggled(button_pressed):
|
||||||
current_piece.get_node("PanelContainer/VBoxContainer/Header/Preview").text = current_piece.preview
|
current_piece.get_node("PanelContainer/VBoxContainer/Header/Preview").text = current_piece.preview
|
||||||
current_piece.set("rect_size", Vector2(current_rect_size.x,0))
|
current_piece.set("rect_size", Vector2(current_rect_size.x,0))
|
||||||
release_focus()
|
release_focus()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_VisibleToggle_toggled(button_pressed):
|
||||||
|
if is_disabled:
|
||||||
|
return
|
||||||
|
set_visible(button_pressed)
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Images/Pieces/open-icon.svg" type="Texture" id=1]
|
[ext_resource path="res://addons/dialogic/Images/Pieces/open-icon.svg" type="Texture" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Images/Pieces/closed-icon.svg" type="Texture" id=2]
|
[ext_resource path="res://addons/dialogic/Images/Pieces/closed-icon.svg" type="Texture" id=2]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/VisibleToggle.gd" type="Script" id=3]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/VisibleToggle.gd" type="Script" id=3]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[node name="VisibleToggle" type="CheckBox"]
|
[node name="VisibleToggle" type="CheckBox"]
|
|
@ -1,9 +1,10 @@
|
||||||
[gd_scene load_steps=7 format=2]
|
[gd_scene load_steps=7 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/emit-signal.svg" type="Texture" id=1]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/emit-signal.svg" type="Texture" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/EmitSignal.gd" type="Script" id=2]
|
[ext_resource path="res://addons/dialogic/Editor/Events/EmitSignal.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
[gd_scene load_steps=6 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/EndBranch.gd" type="Script" id=4]
|
[ext_resource path="res://addons/dialogic/Editor/Events/EndBranch.gd" type="Script" id=4]
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/end-branch.svg" type="Texture" id=5]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/end-branch.svg" type="Texture" id=5]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id=1]
|
[sub_resource type="StyleBoxFlat" id=1]
|
||||||
content_margin_left = 16.0
|
content_margin_left = 16.0
|
||||||
content_margin_right = 6.0
|
content_margin_right = 6.0
|
|
@ -1,12 +1,13 @@
|
||||||
[gd_scene load_steps=9 format=2]
|
[gd_scene load_steps=9 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/condition.svg" type="Texture" id=1]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/condition.svg" type="Texture" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/IfCondition.gd" type="Script" id=2]
|
[ext_resource path="res://addons/dialogic/Editor/Events/IfCondition.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/ConditionPicker.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/ConditionPicker.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/CustomLineEdit.tscn" type="PackedScene" id=6]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/CustomLineEdit.tscn" type="PackedScene" id=6]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DefinitionPicker.tscn" type="PackedScene" id=7]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/DefinitionPicker.tscn" type="PackedScene" id=7]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=8]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=8]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
[gd_scene load_steps=6 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/question.svg" type="Texture" id=1]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/question.svg" type="Texture" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Question.gd" type="Script" id=2]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Question.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,39 @@ var event_data = {
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
connect("gui_input", self, '_on_gui_input')
|
connect("gui_input", self, '_on_gui_input')
|
||||||
|
|
||||||
|
|
||||||
|
func load_data(data):
|
||||||
|
event_data = data
|
||||||
|
print("loading")
|
||||||
|
print(data)
|
||||||
load_image(event_data['background'])
|
load_image(event_data['background'])
|
||||||
|
|
||||||
|
|
||||||
|
func load_image(img_src: String):
|
||||||
|
event_data['background'] = img_src
|
||||||
|
if not img_src.empty() and not img_src.ends_with('.tscn'):
|
||||||
|
$PanelContainer/VBoxContainer/Header/Name.text = img_src
|
||||||
|
$PanelContainer/VBoxContainer/TextureRect.texture = load(img_src)
|
||||||
|
$PanelContainer/VBoxContainer/TextureRect.rect_min_size = Vector2(200,200)
|
||||||
|
$PanelContainer/VBoxContainer/Header/ClearButton.disabled = false
|
||||||
|
preview = "..."
|
||||||
|
toggler.show()
|
||||||
|
toggler.set_visible(true)
|
||||||
|
else:
|
||||||
|
$PanelContainer/VBoxContainer/Header/Name.text = 'No image (will clear previous scene event)'
|
||||||
|
$PanelContainer/VBoxContainer/TextureRect.rect_min_size = Vector2(0,0)
|
||||||
|
$PanelContainer/VBoxContainer/Header/ClearButton.disabled = true
|
||||||
|
preview = ""
|
||||||
|
toggler.hide()
|
||||||
|
toggler.set_visible(false)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_gui_input(event):
|
||||||
|
if event is InputEventMouseButton and event.is_pressed() and event.doubleclick and event.button_index == 1 and toggler.visible:
|
||||||
|
toggler.set_visible(not toggler.pressed)
|
||||||
|
|
||||||
|
|
||||||
func _on_ImageButton_pressed():
|
func _on_ImageButton_pressed():
|
||||||
editor_reference.godot_dialog("*.png, *.jpg, *.jpeg, *.tga, *.svg, *.svgz, *.bmp, *.webp, *.tscn")
|
editor_reference.godot_dialog("*.png, *.jpg, *.jpeg, *.tga, *.svg, *.svgz, *.bmp, *.webp, *.tscn")
|
||||||
editor_reference.godot_dialog_connect(self, "_on_file_selected")
|
editor_reference.godot_dialog_connect(self, "_on_file_selected")
|
||||||
|
@ -26,26 +56,5 @@ func _on_file_selected(path, target):
|
||||||
target.load_image(path)
|
target.load_image(path)
|
||||||
|
|
||||||
|
|
||||||
func load_data(data):
|
func _on_ClearButton_pressed():
|
||||||
event_data = data
|
load_image('')
|
||||||
load_image(event_data['background'])
|
|
||||||
|
|
||||||
|
|
||||||
func load_image(img_src):
|
|
||||||
event_data['background'] = img_src
|
|
||||||
$PanelContainer/VBoxContainer/HBoxContainer/LineEdit.text = event_data['background']
|
|
||||||
if event_data['background'] != '' and not event_data['background'].ends_with('.tscn'):
|
|
||||||
$PanelContainer/VBoxContainer/TextureRect.texture = load(event_data['background'])
|
|
||||||
$PanelContainer/VBoxContainer/TextureRect.rect_min_size = Vector2(200,200)
|
|
||||||
preview = event_data['background']
|
|
||||||
else:
|
|
||||||
$PanelContainer/VBoxContainer/TextureRect.rect_min_size = Vector2(0,0)
|
|
||||||
|
|
||||||
|
|
||||||
func _on_gui_input(event):
|
|
||||||
if event is InputEventMouseButton and event.is_pressed() and event.doubleclick:
|
|
||||||
if event.button_index == 1:
|
|
||||||
if toggler.pressed:
|
|
||||||
toggler.pressed = false
|
|
||||||
else:
|
|
||||||
toggler.pressed = true
|
|
|
@ -1,11 +1,11 @@
|
||||||
[gd_scene load_steps=7 format=2]
|
[gd_scene load_steps=8 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/scene event.svg" type="Texture" id=1]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/scene event.svg" type="Texture" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/VisibleToggle.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://addons/dialogic/Images/Context Menus/Remove.svg" type="Texture" id=3]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/SceneEvent.gd" type="Script" id=5]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/VisibleToggle.tscn" type="PackedScene" id=4]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=6]
|
[ext_resource path="res://addons/dialogic/Editor/Events/SceneEvent.gd" type="Script" id=5]
|
||||||
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=6]
|
||||||
|
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id=1]
|
[sub_resource type="StyleBoxFlat" id=1]
|
||||||
|
@ -26,6 +26,7 @@ corner_radius_bottom_left = 6
|
||||||
|
|
||||||
[node name="SceneBlock" type="HBoxContainer"]
|
[node name="SceneBlock" type="HBoxContainer"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
|
margin_bottom = 44.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 9
|
size_flags_vertical = 9
|
||||||
script = ExtResource( 5 )
|
script = ExtResource( 5 )
|
||||||
|
@ -35,11 +36,11 @@ __meta__ = {
|
||||||
|
|
||||||
[node name="Indent" type="Control" parent="."]
|
[node name="Indent" type="Control" parent="."]
|
||||||
visible = false
|
visible = false
|
||||||
margin_bottom = 74.0
|
margin_bottom = 46.0
|
||||||
|
|
||||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||||
margin_right = 1024.0
|
margin_right = 1024.0
|
||||||
margin_bottom = 74.0
|
margin_bottom = 44.0
|
||||||
mouse_filter = 1
|
mouse_filter = 1
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
|
@ -49,86 +50,78 @@ custom_styles/panel = SubResource( 1 )
|
||||||
margin_left = 16.0
|
margin_left = 16.0
|
||||||
margin_top = 6.0
|
margin_top = 6.0
|
||||||
margin_right = 1018.0
|
margin_right = 1018.0
|
||||||
margin_bottom = 68.0
|
margin_bottom = 38.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
[node name="Header" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
|
[node name="Header" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
|
||||||
margin_right = 1002.0
|
margin_right = 1002.0
|
||||||
margin_bottom = 30.0
|
margin_bottom = 28.0
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/Header"]
|
[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/Header"]
|
||||||
margin_right = 22.0
|
margin_right = 22.0
|
||||||
margin_bottom = 30.0
|
margin_bottom = 28.0
|
||||||
texture = ExtResource( 1 )
|
texture = ExtResource( 1 )
|
||||||
stretch_mode = 6
|
stretch_mode = 6
|
||||||
|
|
||||||
[node name="Title" type="Label" parent="PanelContainer/VBoxContainer/Header"]
|
[node name="Title" type="Label" parent="PanelContainer/VBoxContainer/Header"]
|
||||||
margin_left = 26.0
|
margin_left = 26.0
|
||||||
margin_top = 8.0
|
margin_top = 7.0
|
||||||
margin_right = 131.0
|
margin_right = 139.0
|
||||||
margin_bottom = 22.0
|
margin_bottom = 21.0
|
||||||
text = " Scene settings "
|
text = " Scene settings "
|
||||||
|
|
||||||
|
[node name="Name" type="Label" parent="PanelContainer/VBoxContainer/Header"]
|
||||||
|
margin_left = 143.0
|
||||||
|
margin_top = 7.0
|
||||||
|
margin_right = 414.0
|
||||||
|
margin_bottom = 21.0
|
||||||
|
text = "No image (will clear previous scene event)"
|
||||||
|
|
||||||
|
[node name="ImageButton" type="Button" parent="PanelContainer/VBoxContainer/Header"]
|
||||||
|
margin_left = 418.0
|
||||||
|
margin_right = 442.0
|
||||||
|
margin_bottom = 28.0
|
||||||
|
text = "..."
|
||||||
|
|
||||||
|
[node name="ClearButton" type="Button" parent="PanelContainer/VBoxContainer/Header"]
|
||||||
|
margin_left = 446.0
|
||||||
|
margin_right = 474.0
|
||||||
|
margin_bottom = 28.0
|
||||||
|
disabled = true
|
||||||
|
icon = ExtResource( 3 )
|
||||||
|
|
||||||
[node name="VisibleToggle" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
|
[node name="VisibleToggle" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
|
||||||
margin_left = 135.0
|
visible = false
|
||||||
margin_right = 165.0
|
margin_left = 478.0
|
||||||
|
margin_right = 508.0
|
||||||
|
|
||||||
[node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"]
|
[node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"]
|
||||||
visible = false
|
visible = false
|
||||||
margin_left = 103.0
|
margin_left = 512.0
|
||||||
margin_top = 8.0
|
margin_top = 8.0
|
||||||
margin_right = 131.0
|
margin_right = 540.0
|
||||||
margin_bottom = 22.0
|
margin_bottom = 22.0
|
||||||
custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
|
custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
|
||||||
text = " ..."
|
text = " ..."
|
||||||
|
|
||||||
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 6 )]
|
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 6 )]
|
||||||
margin_left = 169.0
|
margin_left = 478.0
|
||||||
margin_right = 961.0
|
margin_right = 961.0
|
||||||
margin_bottom = 30.0
|
margin_bottom = 28.0
|
||||||
|
|
||||||
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
|
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
|
||||||
margin_left = 965.0
|
margin_left = 965.0
|
||||||
margin_right = 1002.0
|
margin_right = 1002.0
|
||||||
|
margin_bottom = 28.0
|
||||||
items = [ "Move Up", null, 0, false, false, 0, 0, null, "", false, "Move Down", null, 0, false, false, 1, 0, null, "", false, "", null, 0, false, false, 2, 0, null, "", true, "Remove", null, 0, false, false, 3, 0, null, "", false ]
|
items = [ "Move Up", null, 0, false, false, 0, 0, null, "", false, "Move Down", null, 0, false, false, 1, 0, null, "", false, "", null, 0, false, false, 2, 0, null, "", true, "Remove", null, 0, false, false, 3, 0, null, "", false ]
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
|
|
||||||
margin_top = 34.0
|
|
||||||
margin_right = 1002.0
|
|
||||||
margin_bottom = 58.0
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HBoxContainer"]
|
|
||||||
margin_top = 5.0
|
|
||||||
margin_right = 131.0
|
|
||||||
margin_bottom = 19.0
|
|
||||||
text = "Change background: "
|
|
||||||
|
|
||||||
[node name="LineEdit" type="LineEdit" parent="PanelContainer/VBoxContainer/HBoxContainer"]
|
|
||||||
margin_left = 135.0
|
|
||||||
margin_right = 435.0
|
|
||||||
margin_bottom = 24.0
|
|
||||||
rect_min_size = Vector2( 300, 0 )
|
|
||||||
caret_blink = true
|
|
||||||
caret_blink_speed = 0.5
|
|
||||||
|
|
||||||
[node name="ImageButton" type="Button" parent="PanelContainer/VBoxContainer/HBoxContainer"]
|
|
||||||
margin_left = 439.0
|
|
||||||
margin_right = 463.0
|
|
||||||
margin_bottom = 24.0
|
|
||||||
text = "..."
|
|
||||||
|
|
||||||
[node name="Control" type="Control" parent="PanelContainer/VBoxContainer/HBoxContainer"]
|
|
||||||
margin_left = 467.0
|
|
||||||
margin_right = 1002.0
|
|
||||||
margin_bottom = 24.0
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer"]
|
[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer"]
|
||||||
margin_top = 62.0
|
margin_top = 32.0
|
||||||
margin_right = 1002.0
|
margin_right = 1002.0
|
||||||
margin_bottom = 62.0
|
margin_bottom = 32.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
expand = true
|
expand = true
|
||||||
stretch_mode = 5
|
stretch_mode = 5
|
||||||
[connection signal="pressed" from="PanelContainer/VBoxContainer/HBoxContainer/ImageButton" to="." method="_on_ImageButton_pressed"]
|
[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ImageButton" to="." method="_on_ImageButton_pressed"]
|
||||||
|
[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ClearButton" to="." method="_on_ClearButton_pressed"]
|
|
@ -1,9 +1,10 @@
|
||||||
[gd_scene load_steps=6 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/SetTheme.gd" type="Script" id=1]
|
[ext_resource path="res://addons/dialogic/Editor/Events/SetTheme.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/set-theme.svg" type="Texture" id=3]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/set-theme.svg" type="Texture" id=3]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
[gd_scene load_steps=9 format=2]
|
[gd_scene load_steps=9 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/SetValue.gd" type="Script" id=1]
|
[ext_resource path="res://addons/dialogic/Editor/Events/SetValue.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/set-value.svg" type="Texture" id=2]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/set-value.svg" type="Texture" id=2]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DefinitionPicker.tscn" type="PackedScene" id=6]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/DefinitionPicker.tscn" type="PackedScene" id=6]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/OperationPicker.tscn" type="PackedScene" id=7]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/OperationPicker.tscn" type="PackedScene" id=7]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id=1]
|
[sub_resource type="StyleBoxFlat" id=1]
|
|
@ -3,7 +3,7 @@ extends Control
|
||||||
|
|
||||||
var text_height = 21
|
var text_height = 21
|
||||||
var editor_reference
|
var editor_reference
|
||||||
var preview = ''
|
var preview: String = ''
|
||||||
onready var toggler = get_node("PanelContainer/VBoxContainer/Header/VisibleToggle")
|
onready var toggler = get_node("PanelContainer/VBoxContainer/Header/VisibleToggle")
|
||||||
|
|
||||||
# This is the information of this event and it will get parsed and saved to the JSON file.
|
# This is the information of this event and it will get parsed and saved to the JSON file.
|
||||||
|
@ -14,14 +14,17 @@ var event_data = {
|
||||||
}
|
}
|
||||||
|
|
||||||
onready var portrait_picker = $PanelContainer/VBoxContainer/Header/PortraitPicker
|
onready var portrait_picker = $PanelContainer/VBoxContainer/Header/PortraitPicker
|
||||||
|
onready var text_editor = $PanelContainer/VBoxContainer/TextEdit
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
|
text_editor.syntax_highlighting = true
|
||||||
|
text_editor.add_color_region('[', ']', get_color("axis_z_color", "Editor"))
|
||||||
var _scale = get_constant("inspector_margin", "Editor")
|
var _scale = get_constant("inspector_margin", "Editor")
|
||||||
_scale = _scale * 0.125
|
_scale = _scale * 0.125
|
||||||
text_height = text_height * _scale
|
text_height = text_height * _scale
|
||||||
connect("gui_input", self, '_on_gui_input')
|
connect("gui_input", self, '_on_gui_input')
|
||||||
$PanelContainer/VBoxContainer/TextEdit.connect("focus_entered", self, "_on_TextEdit_focus_entered")
|
text_editor.connect("focus_entered", self, "_on_TextEdit_focus_entered")
|
||||||
$PanelContainer/VBoxContainer/TextEdit.set("rect_min_size", Vector2(0, 80))
|
text_editor.set("rect_min_size", Vector2(0, 80))
|
||||||
$PanelContainer/VBoxContainer/Header/CharacterPicker.connect('character_selected', self , '_on_character_selected')
|
$PanelContainer/VBoxContainer/Header/CharacterPicker.connect('character_selected', self , '_on_character_selected')
|
||||||
portrait_picker.get_popup().connect("index_pressed", self, '_on_portrait_selected')
|
portrait_picker.get_popup().connect("index_pressed", self, '_on_portrait_selected')
|
||||||
|
|
||||||
|
@ -35,12 +38,12 @@ func _ready():
|
||||||
event_data['character'] = c['file']
|
event_data['character'] = c['file']
|
||||||
|
|
||||||
|
|
||||||
func _on_character_selected(data):
|
func _on_character_selected(data) -> void:
|
||||||
event_data['character'] = data['file']
|
event_data['character'] = data['file']
|
||||||
update_preview()
|
update_preview()
|
||||||
|
|
||||||
|
|
||||||
func _on_portrait_selected(index):
|
func _on_portrait_selected(index) -> void:
|
||||||
var text = portrait_picker.get_popup().get_item_text(index)
|
var text = portrait_picker.get_popup().get_item_text(index)
|
||||||
if text == "[Don't change]":
|
if text == "[Don't change]":
|
||||||
text = ''
|
text = ''
|
||||||
|
@ -49,28 +52,28 @@ func _on_portrait_selected(index):
|
||||||
update_preview()
|
update_preview()
|
||||||
|
|
||||||
|
|
||||||
func _on_TextEdit_text_changed():
|
func _on_TextEdit_text_changed() -> void:
|
||||||
var text = $PanelContainer/VBoxContainer/TextEdit.text
|
var text = text_editor.text
|
||||||
event_data['text'] = text
|
event_data['text'] = text
|
||||||
update_preview()
|
update_preview()
|
||||||
|
|
||||||
|
|
||||||
func load_text(text):
|
func load_text(text) -> void:
|
||||||
get_node("VBoxContainer/TextEdit").text = text
|
get_node("VBoxContainer/TextEdit").text = text
|
||||||
event_data['text'] = text
|
event_data['text'] = text
|
||||||
update_preview()
|
update_preview()
|
||||||
|
|
||||||
|
|
||||||
func load_data(data):
|
func load_data(data) -> void:
|
||||||
event_data = data
|
event_data = data
|
||||||
$PanelContainer/VBoxContainer/TextEdit.text = event_data['text']
|
text_editor.text = event_data['text']
|
||||||
update_preview()
|
update_preview()
|
||||||
|
|
||||||
|
|
||||||
func update_preview() -> String:
|
func update_preview() -> String:
|
||||||
portrait_picker.set_character(event_data['character'], event_data['portrait'])
|
portrait_picker.set_character(event_data['character'], event_data['portrait'])
|
||||||
var t = $PanelContainer/VBoxContainer/TextEdit.text
|
var t = text_editor.text
|
||||||
$PanelContainer/VBoxContainer/TextEdit.rect_min_size.y = text_height * (2 + t.count('\n'))
|
text_editor.rect_min_size.y = text_height * (2 + t.count('\n'))
|
||||||
|
|
||||||
for c in DialogicUtil.get_character_list():
|
for c in DialogicUtil.get_character_list():
|
||||||
if c['file'] == event_data['character']:
|
if c['file'] == event_data['character']:
|
||||||
|
@ -91,7 +94,7 @@ func update_preview() -> String:
|
||||||
return preview
|
return preview
|
||||||
|
|
||||||
|
|
||||||
func _on_gui_input(event):
|
func _on_gui_input(event) -> void:
|
||||||
if event is InputEventMouseButton and event.is_pressed() and event.doubleclick:
|
if event is InputEventMouseButton and event.is_pressed() and event.doubleclick:
|
||||||
if event.button_index == 1:
|
if event.button_index == 1:
|
||||||
if toggler.pressed:
|
if toggler.pressed:
|
||||||
|
@ -100,7 +103,7 @@ func _on_gui_input(event):
|
||||||
toggler.pressed = true
|
toggler.pressed = true
|
||||||
|
|
||||||
|
|
||||||
func _on_TextEdit_focus_entered():
|
func _on_TextEdit_focus_entered() -> void:
|
||||||
# propagate to timeline to make this text event as active selected
|
# propagate to timeline to make this text event as active selected
|
||||||
# to help improve keyboard shortcut workflows
|
# to help improve keyboard shortcut workflows
|
||||||
# only maybe only do this on left click since mouse wheel and
|
# only maybe only do this on left click since mouse wheel and
|
||||||
|
@ -112,14 +115,12 @@ func _on_TextEdit_focus_entered():
|
||||||
# consider to make it "public" or add a public helper function
|
# consider to make it "public" or add a public helper function
|
||||||
timeline_editor._clear_selection()
|
timeline_editor._clear_selection()
|
||||||
timeline_editor._select_item(self)
|
timeline_editor._select_item(self)
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
func _on_saver_timer_timeout():
|
func _on_saver_timer_timeout() -> void:
|
||||||
update_preview()
|
update_preview()
|
||||||
|
|
||||||
|
|
||||||
# gets called when the user selects this node in the timeline
|
# gets called when the user selects this node in the timeline
|
||||||
func on_timeline_selected():
|
func on_timeline_selected() -> void:
|
||||||
$PanelContainer/VBoxContainer/TextEdit.grab_focus()
|
text_editor.grab_focus()
|
||||||
pass
|
|
|
@ -1,12 +1,13 @@
|
||||||
[gd_scene load_steps=9 format=2]
|
[gd_scene load_steps=9 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/TextBlock.gd" type="Script" id=1]
|
[ext_resource path="res://addons/dialogic/Editor/Events/TextBlock.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/VisibleToggle.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/VisibleToggle.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/text-event.svg" type="Texture" id=3]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/text-event.svg" type="Texture" id=3]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/CharacterPicker.tscn" type="PackedScene" id=6]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/CharacterPicker.tscn" type="PackedScene" id=6]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PortraitPicker.tscn" type="PackedScene" id=7]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PortraitPicker.tscn" type="PackedScene" id=7]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=8]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=8]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
[gd_scene load_steps=8 format=2]
|
[gd_scene load_steps=8 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/wait-seconds.svg" type="Texture" id=1]
|
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/wait-seconds.svg" type="Texture" id=1]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/WaitSeconds.gd" type="Script" id=2]
|
[ext_resource path="res://addons/dialogic/Editor/Events/WaitSeconds.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
|
||||||
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/SpinBoxPreventDnD.gd" type="Script" id=6]
|
[ext_resource path="res://addons/dialogic/Editor/Events/Common/SpinBoxPreventDnD.gd" type="Script" id=6]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -284,47 +284,22 @@ func _on_ShadowOffset_value_changed(_value) -> void:
|
||||||
func _on_PreviewButton_pressed() -> void:
|
func _on_PreviewButton_pressed() -> void:
|
||||||
for i in $VBoxContainer/Panel.get_children():
|
for i in $VBoxContainer/Panel.get_children():
|
||||||
i.free()
|
i.free()
|
||||||
var dialogic_node = load("res://addons/dialogic/Dialog.tscn")
|
var characters : Array = DialogicUtil.get_character_list()
|
||||||
var preview_dialog: DialogicNode = dialogic_node.instance()
|
var character_file : String = ''
|
||||||
preview_dialog.timeline = ''
|
var preview_dialog = Dialogic.start('')
|
||||||
preview_dialog.preview = true
|
preview_dialog.preview = true
|
||||||
preview_dialog.debug_mode = false
|
|
||||||
preview_dialog.get_node('DefinitionInfo').in_theme_editor = true
|
|
||||||
|
|
||||||
# Random character preview if there are any
|
|
||||||
var characters = DialogicUtil.get_character_list()
|
|
||||||
var character_file = ''
|
|
||||||
if characters.size():
|
if characters.size():
|
||||||
characters.shuffle()
|
characters.shuffle()
|
||||||
character_file = characters[0]['file']
|
character_file = characters[0]['file']
|
||||||
|
preview_dialog.dialog_script = {
|
||||||
# Loading the theme here because I need it for the parse_alignment
|
"events":[
|
||||||
preview_dialog.current_theme = preview_dialog._load_theme(current_theme)
|
{ "set_theme": current_theme },
|
||||||
|
{ "character": character_file, "portrait":"", "text":n['text_preview'].text }
|
||||||
# Creating the one event timeline for the dialog
|
]
|
||||||
var text = preview_dialog._parse_definitions(n['text_preview'].text)
|
}
|
||||||
preview_dialog.dialog_script['events'] = [{
|
preview_dialog.parse_characters(preview_dialog.dialog_script)
|
||||||
"character": character_file,
|
|
||||||
"portrait":'',
|
|
||||||
"text": text
|
|
||||||
}]
|
|
||||||
preview_dialog._parse_characters(preview_dialog.dialog_script)
|
|
||||||
preview_dialog.settings = DialogicResources.get_settings_config()
|
|
||||||
|
|
||||||
# Alignment
|
|
||||||
$VBoxContainer/Panel.add_child(preview_dialog)
|
$VBoxContainer/Panel.add_child(preview_dialog)
|
||||||
|
|
||||||
preview_dialog._init_dialog()
|
|
||||||
# Reloading the theme
|
|
||||||
preview_dialog.current_theme = preview_dialog._load_theme(current_theme)
|
|
||||||
|
|
||||||
|
|
||||||
# When not performing this step, the dialog name doesn't update the color for some reason
|
|
||||||
# I should probably refactor the preview dialog to stop making everything manually.
|
|
||||||
if n['name_auto_color'].pressed:
|
|
||||||
if characters.size():
|
|
||||||
preview_dialog.get_node('TextBubble/NameLabel').set('custom_colors/font_color', characters[0]['color'])
|
|
||||||
|
|
||||||
# maintaining the preview panel big enough for the dialog box
|
# maintaining the preview panel big enough for the dialog box
|
||||||
$VBoxContainer/Panel.rect_min_size.y = preview_dialog.current_theme.get_value('box', 'size', Vector2(910, 167)).y + 90 + preview_dialog.current_theme.get_value('box', 'bottom_gap', 40)
|
$VBoxContainer/Panel.rect_min_size.y = preview_dialog.current_theme.get_value('box', 'size', Vector2(910, 167)).y + 90 + preview_dialog.current_theme.get_value('box', 'bottom_gap', 40)
|
||||||
$VBoxContainer/Panel.rect_size.y = 0
|
$VBoxContainer/Panel.rect_size.y = 0
|
||||||
|
|
|
@ -11,8 +11,8 @@ onready var timeline = $TimelineArea/TimeLine
|
||||||
onready var events_warning = $ScrollContainer/EventContainer/EventsWarning
|
onready var events_warning = $ScrollContainer/EventContainer/EventsWarning
|
||||||
|
|
||||||
var hovered_item = null
|
var hovered_item = null
|
||||||
var selected_style : StyleBoxFlat = load("res://addons/dialogic/Editor/Pieces/selected_styleboxflat.tres")
|
var selected_style : StyleBoxFlat = load("res://addons/dialogic/Editor/Events/selected_styleboxflat.tres")
|
||||||
var selected_style_text : StyleBoxFlat = load("res://addons/dialogic/Editor/Pieces/selected_styleboxflat_text_event.tres")
|
var selected_style_text : StyleBoxFlat = load("res://addons/dialogic/Editor/Events/selected_styleboxflat_text_event.tres")
|
||||||
var saved_style : StyleBoxFlat
|
var saved_style : StyleBoxFlat
|
||||||
var selected_item : Node
|
var selected_item : Node
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ func _on_ButtonCondition_pressed() -> void:
|
||||||
# Adding an event to the timeline
|
# Adding an event to the timeline
|
||||||
func create_event(scene: String, data: Dictionary = {'no-data': true} , indent: bool = false):
|
func create_event(scene: String, data: Dictionary = {'no-data': true} , indent: bool = false):
|
||||||
# This function will create an event in the timeline.
|
# This function will create an event in the timeline.
|
||||||
var piece = load("res://addons/dialogic/Editor/Pieces/" + scene + ".tscn").instance()
|
var piece = load("res://addons/dialogic/Editor/Events/" + scene + ".tscn").instance()
|
||||||
piece.editor_reference = editor_reference
|
piece.editor_reference = editor_reference
|
||||||
if selected_item != null:
|
if selected_item != null:
|
||||||
timeline.add_child_below_node(selected_item, piece)
|
timeline.add_child_below_node(selected_item, piece)
|
||||||
|
|
|
@ -88,10 +88,18 @@ func fade_out(node = self, time = 0.5):
|
||||||
|
|
||||||
func focus():
|
func focus():
|
||||||
tween_modulate(modulate, Color(1,1,1,1))
|
tween_modulate(modulate, Color(1,1,1,1))
|
||||||
|
var _parent = get_parent()
|
||||||
|
if _parent:
|
||||||
|
# Make sure that this portrait is the last to be _draw -ed
|
||||||
|
_parent.move_child(self, _parent.get_child_count())
|
||||||
|
|
||||||
|
|
||||||
func focusout():
|
func focusout():
|
||||||
tween_modulate(modulate, Color(0.5,0.5,0.5,1))
|
tween_modulate(modulate, Color(0.5,0.5,0.5,1))
|
||||||
|
var _parent = get_parent()
|
||||||
|
if _parent:
|
||||||
|
# Render this portrait first
|
||||||
|
_parent.move_child(self, 0)
|
||||||
|
|
||||||
|
|
||||||
func tween_modulate(from_value, to_value, time = 0.5):
|
func tween_modulate(from_value, to_value, time = 0.5):
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/dialogic/Example Assets/portraits/df-1.png" type="Texture" id=1]
|
|
||||||
[ext_resource path="res://addons/dialogic/Nodes/Portrait.gd" type="Script" id=2]
|
[ext_resource path="res://addons/dialogic/Nodes/Portrait.gd" type="Script" id=2]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[node name="Portrait" type="Control"]
|
[node name="Portrait" type="Control"]
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
|
@ -12,9 +9,6 @@ __meta__ = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="."]
|
[node name="TextureRect" type="TextureRect" parent="."]
|
||||||
margin_right = 357.0
|
|
||||||
margin_bottom = 686.0
|
|
||||||
texture = ExtResource( 1 )
|
|
||||||
stretch_mode = 6
|
stretch_mode = 6
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
|
|
157
addons/dialogic/Nodes/TextBubble.gd
Normal file
157
addons/dialogic/Nodes/TextBubble.gd
Normal file
|
@ -0,0 +1,157 @@
|
||||||
|
tool
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
var text_speed := 0.02 # Higher = lower speed
|
||||||
|
|
||||||
|
onready var text_label = $RichTextLabel
|
||||||
|
onready var name_label = $NameLabel
|
||||||
|
onready var tween = $Tween
|
||||||
|
|
||||||
|
var _finished := false
|
||||||
|
|
||||||
|
signal text_completed()
|
||||||
|
|
||||||
|
|
||||||
|
## *****************************************************************************
|
||||||
|
## PUBLIC METHODS
|
||||||
|
## *****************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
func update_name(name: String, color: Color = Color.white, autocolor: bool=false) -> void:
|
||||||
|
if not name.empty():
|
||||||
|
name_label.visible = true
|
||||||
|
# Hack to reset the size
|
||||||
|
name_label.rect_min_size = Vector2(0, 0)
|
||||||
|
name_label.rect_size = Vector2(-1, 40)
|
||||||
|
# Setting the color and text
|
||||||
|
name_label.text = name
|
||||||
|
if autocolor:
|
||||||
|
name_label.set('custom_colors/font_color', color)
|
||||||
|
else:
|
||||||
|
name_label.visible = false
|
||||||
|
|
||||||
|
|
||||||
|
func update_text(text):
|
||||||
|
# Updating the text and starting the animation from 0
|
||||||
|
text_label.bbcode_text = text
|
||||||
|
text_label.percent_visible = 0
|
||||||
|
|
||||||
|
# The call to this function needs to be deferred.
|
||||||
|
# More info: https://github.com/godotengine/godot/issues/36381
|
||||||
|
call_deferred("_start_text_tween")
|
||||||
|
return true
|
||||||
|
|
||||||
|
|
||||||
|
func is_finished():
|
||||||
|
return _finished
|
||||||
|
|
||||||
|
|
||||||
|
func skip():
|
||||||
|
tween.seek(999)
|
||||||
|
_on_Tween_tween_completed(null, null)
|
||||||
|
|
||||||
|
|
||||||
|
func reset():
|
||||||
|
name_label.text = ''
|
||||||
|
name_label.visible = false
|
||||||
|
|
||||||
|
|
||||||
|
func load_theme(theme: ConfigFile):
|
||||||
|
# Text
|
||||||
|
var theme_font = DialogicUtil.path_fixer_load(theme.get_value('text', 'font', 'res://addons/dialogic/Example Assets/Fonts/DefaultFont.tres'))
|
||||||
|
text_label.set('custom_fonts/normal_font', theme_font)
|
||||||
|
name_label.set('custom_fonts/font', theme_font)
|
||||||
|
|
||||||
|
var text_color = Color(theme.get_value('text', 'color', '#ffffffff'))
|
||||||
|
text_label.set('custom_colors/default_color', text_color)
|
||||||
|
name_label.set('custom_colors/font_color', text_color)
|
||||||
|
|
||||||
|
text_label.set('custom_colors/font_color_shadow', Color('#00ffffff'))
|
||||||
|
name_label.set('custom_colors/font_color_shadow', Color('#00ffffff'))
|
||||||
|
|
||||||
|
if theme.get_value('text', 'shadow', false):
|
||||||
|
var text_shadow_color = Color(theme.get_value('text', 'shadow_color', '#9e000000'))
|
||||||
|
text_label.set('custom_colors/font_color_shadow', text_shadow_color)
|
||||||
|
|
||||||
|
var shadow_offset = theme.get_value('text', 'shadow_offset', Vector2(2,2))
|
||||||
|
text_label.set('custom_constants/shadow_offset_x', shadow_offset.x)
|
||||||
|
text_label.set('custom_constants/shadow_offset_y', shadow_offset.y)
|
||||||
|
|
||||||
|
|
||||||
|
# Text speed
|
||||||
|
text_speed = theme.get_value('text','speed', 2) * 0.01
|
||||||
|
|
||||||
|
# Margin
|
||||||
|
var text_margin = theme.get_value('text', 'margin', Vector2(20, 10))
|
||||||
|
text_label.set('margin_left', text_margin.x)
|
||||||
|
text_label.set('margin_right', text_margin.x * -1)
|
||||||
|
text_label.set('margin_top', text_margin.y)
|
||||||
|
text_label.set('margin_bottom', text_margin.y * -1)
|
||||||
|
|
||||||
|
# Backgrounds
|
||||||
|
$TextureRect.texture = DialogicUtil.path_fixer_load(theme.get_value('background','image', "res://addons/dialogic/Example Assets/backgrounds/background-2.png"))
|
||||||
|
$ColorRect.color = Color(theme.get_value('background','color', "#ff000000"))
|
||||||
|
|
||||||
|
if theme.get_value('background', 'modulation', false) == true:
|
||||||
|
$TextureRect.modulate = Color(theme.get_value('background', 'modulation_color', '#ffffffff'))
|
||||||
|
else:
|
||||||
|
$TextureRect.modulate = Color('#ffffffff')
|
||||||
|
|
||||||
|
$ColorRect.visible = theme.get_value('background', 'use_color', false)
|
||||||
|
$TextureRect.visible = theme.get_value('background', 'use_image', true)
|
||||||
|
|
||||||
|
# Next image
|
||||||
|
$NextIndicator.texture = DialogicUtil.path_fixer_load(theme.get_value('next_indicator', 'image', 'res://addons/dialogic/Example Assets/next-indicator/next-indicator.png'))
|
||||||
|
|
||||||
|
# Character Name
|
||||||
|
$NameLabel/ColorRect.visible = theme.get_value('name', 'background_visible', false)
|
||||||
|
$NameLabel/ColorRect.color = Color(theme.get_value('name', 'background', '#282828'))
|
||||||
|
$NameLabel/TextureRect.visible = theme.get_value('name', 'image_visible', false)
|
||||||
|
$NameLabel/TextureRect.texture = DialogicUtil.path_fixer_load(theme.get_value('name','image', "res://addons/dialogic/Example Assets/backgrounds/background-2.png"))
|
||||||
|
var name_shadow_offset = theme.get_value('name', 'shadow_offset', Vector2(2,2))
|
||||||
|
if theme.get_value('name', 'shadow_visible', true):
|
||||||
|
name_label.set('custom_colors/font_color_shadow', Color(theme.get_value('name', 'shadow', '#9e000000')))
|
||||||
|
name_label.set('custom_constants/shadow_offset_x', name_shadow_offset.x)
|
||||||
|
name_label.set('custom_constants/shadow_offset_y', name_shadow_offset.y)
|
||||||
|
name_label.rect_position.y = theme.get_value('name', 'bottom_gap', 48) * -1
|
||||||
|
if theme.get_value('name', 'modulation', false) == true:
|
||||||
|
$NameLabel/TextureRect.modulate = Color(theme.get_value('name', 'modulation_color', '#ffffffff'))
|
||||||
|
else:
|
||||||
|
$NameLabel/TextureRect.modulate = Color('#ffffffff')
|
||||||
|
|
||||||
|
# Setting next indicator animation
|
||||||
|
$NextIndicator.self_modulate = Color('#ffffff')
|
||||||
|
$NextIndicator/AnimationPlayer.play(
|
||||||
|
theme.get_value('next_indicator', 'animation', 'Up and down')
|
||||||
|
)
|
||||||
|
|
||||||
|
## *****************************************************************************
|
||||||
|
## PRIVATE METHODS
|
||||||
|
## *****************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Tween_tween_completed(object, key):
|
||||||
|
_finished = true
|
||||||
|
emit_signal("text_completed")
|
||||||
|
|
||||||
|
|
||||||
|
func _start_text_tween():
|
||||||
|
# This will start the animation that makes the text appear letter by letter
|
||||||
|
var tween_duration = text_speed * text_label.get_total_character_count()
|
||||||
|
tween.interpolate_property(
|
||||||
|
text_label, "percent_visible", 0, 1, tween_duration,
|
||||||
|
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT
|
||||||
|
)
|
||||||
|
_finished = false
|
||||||
|
tween.start()
|
||||||
|
|
||||||
|
|
||||||
|
## *****************************************************************************
|
||||||
|
## OVERRIDES
|
||||||
|
## *****************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
reset()
|
||||||
|
tween.connect("tween_completed", self, '_on_Tween_tween_completed')
|
||||||
|
text_label.meta_underlined = false
|
173
addons/dialogic/Nodes/TextBubble.tscn
Normal file
173
addons/dialogic/Nodes/TextBubble.tscn
Normal file
|
@ -0,0 +1,173 @@
|
||||||
|
[gd_scene load_steps=10 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://addons/dialogic/Example Assets/Fonts/DefaultFont.tres" type="DynamicFont" id=1]
|
||||||
|
[ext_resource path="res://addons/dialogic/Example Assets/backgrounds/background-2.png" type="Texture" id=2]
|
||||||
|
[ext_resource path="res://addons/dialogic/Example Assets/next-indicator/next-indicator.png" type="Texture" id=3]
|
||||||
|
[ext_resource path="res://addons/dialogic/Nodes/TextBubble.gd" type="Script" id=4]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id=1]
|
||||||
|
bg_color = Color( 1, 1, 1, 0 )
|
||||||
|
expand_margin_left = 10.0
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=2]
|
||||||
|
resource_name = "Pulse"
|
||||||
|
loop = true
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath(".:self_modulate")
|
||||||
|
tracks/0/interp = 2
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0, 0.5 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=3]
|
||||||
|
resource_name = "Static"
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=4]
|
||||||
|
loop = true
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath(".:margin_bottom")
|
||||||
|
tracks/0/interp = 2
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0, 0.5 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ 12.0, 55.0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id=5]
|
||||||
|
content_margin_left = 10.0
|
||||||
|
content_margin_right = 10.0
|
||||||
|
bg_color = Color( 1, 1, 1, 0 )
|
||||||
|
expand_margin_left = 10.0
|
||||||
|
|
||||||
|
[node name="TextBubble" type="Control"]
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
margin_left = -455.0
|
||||||
|
margin_top = 393.0
|
||||||
|
margin_right = 455.0
|
||||||
|
margin_bottom = 560.0
|
||||||
|
script = ExtResource( 4 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="ColorRect" type="ColorRect" parent="."]
|
||||||
|
visible = false
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
color = Color( 0, 0, 0, 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="TextureRect" type="TextureRect" parent="."]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
texture = ExtResource( 2 )
|
||||||
|
expand = true
|
||||||
|
stretch_mode = 1
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="."]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
margin_left = 20.0
|
||||||
|
margin_top = 10.0
|
||||||
|
margin_right = -20.0
|
||||||
|
margin_bottom = -10.0
|
||||||
|
rect_clip_content = false
|
||||||
|
custom_styles/normal = SubResource( 1 )
|
||||||
|
custom_fonts/normal_font = ExtResource( 1 )
|
||||||
|
custom_colors/default_color = Color( 0.423529, 0.580392, 0.74902, 1 )
|
||||||
|
custom_colors/font_color_shadow = Color( 1, 1, 1, 0 )
|
||||||
|
custom_constants/shadow_offset_x = 2
|
||||||
|
custom_constants/shadow_offset_y = 2
|
||||||
|
bbcode_enabled = true
|
||||||
|
bbcode_text = "Placeholder text for testing and formatting."
|
||||||
|
meta_underlined = false
|
||||||
|
text = "Placeholder text for testing and formatting."
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="NextIndicator" type="TextureRect" parent="."]
|
||||||
|
visible = false
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
margin_left = -36.4279
|
||||||
|
margin_top = -35.9016
|
||||||
|
margin_right = 14.5721
|
||||||
|
margin_bottom = 44.8652
|
||||||
|
rect_scale = Vector2( 0.4, 0.4 )
|
||||||
|
texture = ExtResource( 3 )
|
||||||
|
stretch_mode = 4
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="NextIndicator"]
|
||||||
|
autoplay = "Up and down"
|
||||||
|
anims/Pulse = SubResource( 2 )
|
||||||
|
anims/Static = SubResource( 3 )
|
||||||
|
"anims/Up and down" = SubResource( 4 )
|
||||||
|
|
||||||
|
[node name="NameLabel" type="Label" parent="."]
|
||||||
|
margin_top = -48.0
|
||||||
|
margin_right = 58.0
|
||||||
|
margin_bottom = -8.0
|
||||||
|
size_flags_vertical = 1
|
||||||
|
custom_styles/normal = SubResource( 5 )
|
||||||
|
custom_fonts/font = ExtResource( 1 )
|
||||||
|
custom_colors/font_color = Color( 0.423529, 0.580392, 0.74902, 1 )
|
||||||
|
custom_colors/font_color_shadow = Color( 0, 0, 0, 0.619608 )
|
||||||
|
custom_constants/shadow_offset_x = 2
|
||||||
|
custom_constants/shadow_offset_y = 2
|
||||||
|
align = 1
|
||||||
|
valign = 1
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="ColorRect" type="ColorRect" parent="NameLabel"]
|
||||||
|
visible = false
|
||||||
|
show_behind_parent = true
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
size_flags_horizontal = 15
|
||||||
|
size_flags_vertical = 15
|
||||||
|
color = Color( 0.156863, 0.156863, 0.156863, 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="TextureRect" type="TextureRect" parent="NameLabel"]
|
||||||
|
visible = false
|
||||||
|
show_behind_parent = true
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
texture = ExtResource( 2 )
|
||||||
|
expand = true
|
||||||
|
stretch_mode = 1
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Tween" type="Tween" parent="."]
|
|
@ -1,22 +1,20 @@
|
||||||
tool
|
tool
|
||||||
extends Control
|
extends Control
|
||||||
class_name DialogicNode
|
|
||||||
|
|
||||||
var last_mouse_mode = null
|
var last_mouse_mode = null
|
||||||
var input_next: String = 'ui_accept'
|
var input_next: String = 'ui_accept'
|
||||||
var dialog_index: int = 0
|
var dialog_index: int = 0
|
||||||
var finished: bool = false
|
var finished: bool = false
|
||||||
var text_speed = 0.02 # Higher = lower speed
|
|
||||||
var waiting_for_answer: bool = false
|
var waiting_for_answer: bool = false
|
||||||
var waiting_for_input: bool = false
|
var waiting_for_input: bool = false
|
||||||
var waiting = false
|
var waiting: bool = false
|
||||||
var preview = false
|
var preview: bool = false
|
||||||
var definitions = {}
|
var definitions: Dictionary = {}
|
||||||
var definition_visible = false
|
var definition_visible: bool = false
|
||||||
|
|
||||||
var settings
|
var settings: ConfigFile
|
||||||
var current_theme
|
var current_theme: ConfigFile
|
||||||
var current_timeline := ''
|
var current_timeline: String = ''
|
||||||
|
|
||||||
## The timeline to load when starting the scene
|
## The timeline to load when starting the scene
|
||||||
export(String, "TimelineDropdown") var timeline: String
|
export(String, "TimelineDropdown") var timeline: String
|
||||||
|
@ -34,110 +32,69 @@ var characters
|
||||||
|
|
||||||
onready var ChoiceButton = load("res://addons/dialogic/Nodes/ChoiceButton.tscn")
|
onready var ChoiceButton = load("res://addons/dialogic/Nodes/ChoiceButton.tscn")
|
||||||
onready var Portrait = load("res://addons/dialogic/Nodes/Portrait.tscn")
|
onready var Portrait = load("res://addons/dialogic/Nodes/Portrait.tscn")
|
||||||
var dialog_script = {}
|
var dialog_script: Dictionary = {}
|
||||||
var questions #for keeping track of the questions answered
|
var questions #for keeping track of the questions answered
|
||||||
|
|
||||||
onready var tween_node = $TextBubble/Tween
|
|
||||||
|
|
||||||
# Used to detect timeline change
|
func _ready():
|
||||||
var runtime_id
|
# Loading the config files
|
||||||
|
load_config_files()
|
||||||
|
|
||||||
## *****************************************************************************
|
# Checking if the dialog should read the code from a external file
|
||||||
## PUBLIC METHODS
|
if not timeline.empty():
|
||||||
## *****************************************************************************
|
dialog_script = set_current_dialog(timeline)
|
||||||
|
|
||||||
## Starts the dialog for the given timeline.
|
|
||||||
##
|
|
||||||
## This is exactly the same as using the editor:
|
|
||||||
## you can drag and drop the scene located at /addons/dialogic/Dialog.tscn
|
|
||||||
## and set the current timeline via the inspector.
|
|
||||||
##
|
|
||||||
## @param given_timeline The timeline to load. You can provide the timeline name or the filename.
|
|
||||||
## @param reset True to reset dialogic saved data such as definitions.
|
|
||||||
## @param debug Debug is disabled by default but can be enabled if needed.
|
|
||||||
func start(given_timeline: String, reset: bool=true, debug: bool=false):
|
|
||||||
show()
|
|
||||||
reset_saves = reset
|
|
||||||
debug_mode = debug
|
|
||||||
runtime_id = DialogicUtil.generate_random_id()
|
|
||||||
_load_definitions()
|
|
||||||
_stop_close_dialog()
|
|
||||||
if not given_timeline.empty():
|
|
||||||
dialog_script = null
|
|
||||||
for t in DialogicUtil.get_timeline_list():
|
|
||||||
if t['name'] == given_timeline or t['file'] == given_timeline:
|
|
||||||
dialog_script = _set_current_dialog(t['file'])
|
|
||||||
if dialog_script == null:
|
|
||||||
dialog_script = {
|
|
||||||
"events":[{
|
|
||||||
"character":"",
|
|
||||||
"portrait":"",
|
|
||||||
"text":"[color=red][Dialogic Error][/color] Could not load dialog '[color=red]" + given_timeline + "[/color]'. It seems like the timeline doesn't exists. Maybe the name is wrong?"
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
elif dialog_script.keys().size() == 0:
|
elif dialog_script.keys().size() == 0:
|
||||||
dialog_script = {
|
dialog_script = {
|
||||||
"events":[{
|
"events":[{"character":"","portrait":"",
|
||||||
"character":"",
|
"text":"[Dialogic Error] No timeline specified."}]
|
||||||
"portrait":"",
|
|
||||||
"text":"[color=red][Dialogic Error][/color] No timeline specified."
|
|
||||||
}]
|
|
||||||
}
|
}
|
||||||
if not Engine.is_editor_hint():
|
|
||||||
_init_dialog()
|
# Connecting resize signal
|
||||||
|
get_viewport().connect("size_changed", self, "resize_main")
|
||||||
|
resize_main()
|
||||||
|
|
||||||
|
# Setting everything up for the node to be default
|
||||||
|
$DefinitionInfo.visible = false
|
||||||
|
$TextBubble.connect("text_completed", self, "_on_text_completed")
|
||||||
|
|
||||||
|
# Getting the character information
|
||||||
|
characters = DialogicUtil.get_character_list()
|
||||||
|
|
||||||
|
if Engine.is_editor_hint():
|
||||||
|
if preview:
|
||||||
|
load_dialog()
|
||||||
|
else:
|
||||||
|
load_dialog()
|
||||||
|
|
||||||
|
|
||||||
## Same as the start method, but using the last timeline saved.
|
func load_config_files():
|
||||||
##
|
|
||||||
## @param fallback The timeline to load in case no save is found.
|
|
||||||
## @param debug Debug is disabled by default but can be enabled if needed.
|
|
||||||
func start_from_save(fallback: String, debug: bool=false):
|
|
||||||
var last = DialogicSingleton.get_current_timeline()
|
|
||||||
if last.empty():
|
|
||||||
last = fallback
|
|
||||||
start(last, false, debug)
|
|
||||||
|
|
||||||
|
|
||||||
func load_preview(theme: String):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
## *****************************************************************************
|
|
||||||
## PRIVATE METHODS
|
|
||||||
## *****************************************************************************
|
|
||||||
|
|
||||||
func _load_definitions():
|
|
||||||
if not Engine.is_editor_hint():
|
if not Engine.is_editor_hint():
|
||||||
if reset_saves:
|
if reset_saves:
|
||||||
DialogicSingleton.init(reset_saves)
|
DialogicSingleton.init(reset_saves)
|
||||||
definitions = DialogicSingleton.get_definitions()
|
definitions = DialogicSingleton.get_definitions()
|
||||||
else:
|
else:
|
||||||
definitions = DialogicResources.get_default_definitions()
|
definitions = DialogicResources.get_default_definitions()
|
||||||
|
|
||||||
|
|
||||||
func _load_config_files():
|
|
||||||
settings = DialogicResources.get_settings_config()
|
settings = DialogicResources.get_settings_config()
|
||||||
var theme_file = 'res://addons/dialogic/Editor/ThemeEditor/default-theme.cfg'
|
var theme_file = 'res://addons/dialogic/Editor/ThemeEditor/default-theme.cfg'
|
||||||
if settings.has_section('theme'):
|
if settings.has_section('theme'):
|
||||||
theme_file = settings.get_value('theme', 'default')
|
theme_file = settings.get_value('theme', 'default')
|
||||||
current_theme = _load_theme(theme_file)
|
current_theme = load_theme(theme_file)
|
||||||
|
|
||||||
|
|
||||||
func _resize_main():
|
func resize_main():
|
||||||
# This function makes sure that the dialog is displayed at the correct
|
# This function makes sure that the dialog is displayed at the correct
|
||||||
# size and position in the screen.
|
# size and position in the screen.
|
||||||
if Engine.is_editor_hint() == false:
|
if Engine.is_editor_hint() == false:
|
||||||
set_global_position(Vector2(0,0))
|
set_global_position(Vector2(0,0))
|
||||||
if ProjectSettings.get_setting("display/window/stretch/mode") != '2d':
|
if ProjectSettings.get_setting("display/window/stretch/mode") != '2d':
|
||||||
set_deferred('rect_size', get_viewport().size)
|
set_deferred('rect_size', get_viewport().size)
|
||||||
_dprint("Viewport", get_viewport().size)
|
dprint("Viewport", get_viewport().size)
|
||||||
$TextBubble.rect_position.x = (rect_size.x / 2) - ($TextBubble.rect_size.x / 2)
|
$TextBubble.rect_position.x = (rect_size.x / 2) - ($TextBubble.rect_size.x / 2)
|
||||||
if current_theme != null:
|
if current_theme != null:
|
||||||
$TextBubble.rect_position.y = (rect_size.y) - ($TextBubble.rect_size.y) - current_theme.get_value('box', 'bottom_gap', 40)
|
$TextBubble.rect_position.y = (rect_size.y) - ($TextBubble.rect_size.y) - current_theme.get_value('box', 'bottom_gap', 40)
|
||||||
|
|
||||||
|
|
||||||
func _set_current_dialog(dialog_path: String):
|
func set_current_dialog(dialog_path: String):
|
||||||
current_timeline = dialog_path
|
current_timeline = dialog_path
|
||||||
var dialog_script = DialogicResources.get_timeline_json(dialog_path)
|
var dialog_script = DialogicResources.get_timeline_json(dialog_path)
|
||||||
# All this parse events should be happening in the same loop ideally
|
# All this parse events should be happening in the same loop ideally
|
||||||
|
@ -145,16 +102,16 @@ func _set_current_dialog(dialog_path: String):
|
||||||
# And keep adding different functions for each parsing operation.
|
# And keep adding different functions for each parsing operation.
|
||||||
if settings.has_section_key('dialog', 'auto_color_names'):
|
if settings.has_section_key('dialog', 'auto_color_names'):
|
||||||
if settings.get_value('dialog', 'auto_color_names'):
|
if settings.get_value('dialog', 'auto_color_names'):
|
||||||
dialog_script = _parse_characters(dialog_script)
|
dialog_script = parse_characters(dialog_script)
|
||||||
else:
|
else:
|
||||||
dialog_script = _parse_characters(dialog_script)
|
dialog_script = parse_characters(dialog_script)
|
||||||
|
|
||||||
dialog_script = _parse_text_lines(dialog_script)
|
dialog_script = parse_text_lines(dialog_script)
|
||||||
dialog_script = _parse_branches(dialog_script)
|
dialog_script = parse_branches(dialog_script)
|
||||||
return dialog_script
|
return dialog_script
|
||||||
|
|
||||||
|
|
||||||
func _parse_characters(dialog_script):
|
func parse_characters(dialog_script):
|
||||||
var names = DialogicUtil.get_character_list()
|
var names = DialogicUtil.get_character_list()
|
||||||
# I should use regex here, but this is way easier :)
|
# I should use regex here, but this is way easier :)
|
||||||
if names.size() > 0:
|
if names.size() > 0:
|
||||||
|
@ -170,7 +127,7 @@ func _parse_characters(dialog_script):
|
||||||
return dialog_script
|
return dialog_script
|
||||||
|
|
||||||
|
|
||||||
func _parse_text_lines(unparsed_dialog_script: Dictionary) -> Dictionary:
|
func parse_text_lines(unparsed_dialog_script: Dictionary) -> Dictionary:
|
||||||
var parsed_dialog: Dictionary = unparsed_dialog_script
|
var parsed_dialog: Dictionary = unparsed_dialog_script
|
||||||
var new_events: Array = []
|
var new_events: Array = []
|
||||||
var split_new_lines = true
|
var split_new_lines = true
|
||||||
|
@ -212,7 +169,7 @@ func _parse_text_lines(unparsed_dialog_script: Dictionary) -> Dictionary:
|
||||||
return parsed_dialog
|
return parsed_dialog
|
||||||
|
|
||||||
|
|
||||||
func _parse_alignment(text):
|
func parse_alignment(text):
|
||||||
var alignment = current_theme.get_value('text', 'alignment', 'Left')
|
var alignment = current_theme.get_value('text', 'alignment', 'Left')
|
||||||
var fname = current_theme.get_value('settings', 'name', 'none')
|
var fname = current_theme.get_value('settings', 'name', 'none')
|
||||||
if alignment == 'Center':
|
if alignment == 'Center':
|
||||||
|
@ -222,7 +179,7 @@ func _parse_alignment(text):
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
func _parse_branches(dialog_script: Dictionary) -> Dictionary:
|
func parse_branches(dialog_script: Dictionary) -> Dictionary:
|
||||||
questions = [] # Resetting the questions
|
questions = [] # Resetting the questions
|
||||||
|
|
||||||
# Return the same thing if it doesn't have events
|
# Return the same thing if it doesn't have events
|
||||||
|
@ -268,12 +225,7 @@ func _parse_branches(dialog_script: Dictionary) -> Dictionary:
|
||||||
return dialog_script
|
return dialog_script
|
||||||
|
|
||||||
|
|
||||||
func _parse_definitions(text: String, variables: bool = true, glossary: bool = true):
|
func parse_definitions(text: String, variables: bool = true, glossary: bool = true):
|
||||||
if Engine.is_editor_hint():
|
|
||||||
# Loading variables again to avoid issues in the preview dialog
|
|
||||||
_load_definitions()
|
|
||||||
_load_config_files()
|
|
||||||
|
|
||||||
var final_text: String = text
|
var final_text: String = text
|
||||||
if variables:
|
if variables:
|
||||||
final_text = _insert_variable_definitions(text)
|
final_text = _insert_variable_definitions(text)
|
||||||
|
@ -302,240 +254,248 @@ func _insert_glossary_definitions(text: String):
|
||||||
)
|
)
|
||||||
return final_text;
|
return final_text;
|
||||||
|
|
||||||
func _show_dialog():
|
|
||||||
|
func _process(delta):
|
||||||
|
$TextBubble/NextIndicator.visible = finished
|
||||||
|
if waiting_for_answer and Input.is_action_just_released(input_next):
|
||||||
|
if $Options.get_child_count() > 0:
|
||||||
|
$Options.get_child(0).grab_focus()
|
||||||
|
|
||||||
|
|
||||||
|
func _input(event: InputEvent) -> void:
|
||||||
|
if not Engine.is_editor_hint() and event.is_action_pressed(input_next) and not waiting:
|
||||||
|
if not $TextBubble.is_finished():
|
||||||
|
# Skip to end if key is pressed during the text animation
|
||||||
|
$TextBubble.skip()
|
||||||
|
else:
|
||||||
|
if waiting_for_answer == false and waiting_for_input == false:
|
||||||
|
load_dialog()
|
||||||
|
if settings.has_section_key('dialog', 'propagate_input'):
|
||||||
|
var propagate_input: bool = settings.get_value('dialog', 'propagate_input')
|
||||||
|
if not propagate_input:
|
||||||
|
get_tree().set_input_as_handled()
|
||||||
|
|
||||||
|
|
||||||
|
func show_dialog():
|
||||||
visible = true
|
visible = true
|
||||||
|
|
||||||
|
|
||||||
func _on_Tween_tween_completed(object, key):
|
func update_name(character) -> void:
|
||||||
finished = true
|
|
||||||
|
|
||||||
|
|
||||||
func _update_name(character, color: Color = Color.white) -> void:
|
|
||||||
if character.has('name'):
|
if character.has('name'):
|
||||||
var parsed_name = character['name']
|
var parsed_name = character['name']
|
||||||
|
var color = Color.white
|
||||||
if character.has('display_name'):
|
if character.has('display_name'):
|
||||||
if character['display_name'] != '':
|
if character['display_name'] != '':
|
||||||
parsed_name = character['display_name']
|
parsed_name = character['display_name']
|
||||||
if character.has('color'):
|
if character.has('color'):
|
||||||
color = character['color']
|
color = character['color']
|
||||||
parsed_name = _parse_definitions(parsed_name, true, false)
|
parsed_name = parse_definitions(parsed_name, true, false)
|
||||||
$TextBubble/NameLabel.visible = true
|
$TextBubble.update_name(parsed_name, color, current_theme.get_value('name', 'auto_color', true))
|
||||||
# Hack to reset the size
|
|
||||||
$TextBubble/NameLabel.rect_min_size = Vector2(0, 0)
|
|
||||||
$TextBubble/NameLabel.rect_size = Vector2(-1, 40)
|
|
||||||
# Setting the color and text
|
|
||||||
$TextBubble/NameLabel.text = parsed_name
|
|
||||||
if current_theme.get_value('name', 'auto_color', true):
|
|
||||||
$TextBubble/NameLabel.set('custom_colors/font_color', color)
|
|
||||||
else:
|
else:
|
||||||
$TextBubble/NameLabel.visible = false
|
$TextBubble.update_name('')
|
||||||
|
|
||||||
|
|
||||||
func _update_text(text):
|
func update_text(text: String) -> String:
|
||||||
# Updating the text and starting the animation from 0
|
var final_text = parse_definitions(parse_alignment(text))
|
||||||
text = _parse_alignment(text)
|
final_text = final_text.replace('[br]', '\n')
|
||||||
$TextBubble/RichTextLabel.bbcode_text = _parse_definitions(text)
|
$TextBubble.update_text(final_text)
|
||||||
$TextBubble/RichTextLabel.percent_visible = 0
|
return final_text
|
||||||
|
|
||||||
# The call to this function needs to be deferred.
|
|
||||||
# More info: https://github.com/godotengine/godot/issues/36381
|
|
||||||
call_deferred("_start_text_tween")
|
|
||||||
return true
|
|
||||||
|
|
||||||
|
|
||||||
func _start_text_tween():
|
func _on_text_completed():
|
||||||
# This will start the animation that makes the text appear letter by letter
|
finished = true
|
||||||
var tween_duration = text_speed * $TextBubble/RichTextLabel.get_total_character_count()
|
|
||||||
tween_node.interpolate_property(
|
|
||||||
$TextBubble/RichTextLabel, "percent_visible", 0, 1, tween_duration,
|
|
||||||
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT
|
|
||||||
)
|
|
||||||
tween_node.start()
|
|
||||||
|
|
||||||
|
func on_timeline_start():
|
||||||
func _on_timeline_start():
|
|
||||||
if not Engine.is_editor_hint():
|
if not Engine.is_editor_hint():
|
||||||
DialogicSingleton.save_definitions()
|
DialogicSingleton.save_definitions()
|
||||||
DialogicSingleton.set_current_timeline(current_timeline)
|
DialogicSingleton.set_current_timeline(current_timeline)
|
||||||
emit_signal("event_start", "timeline", current_timeline)
|
emit_signal("event_start", "timeline", current_timeline)
|
||||||
|
|
||||||
|
|
||||||
func _on_timeline_end():
|
func on_timeline_end():
|
||||||
if not Engine.is_editor_hint():
|
if not Engine.is_editor_hint():
|
||||||
DialogicSingleton.save_definitions()
|
DialogicSingleton.save_definitions()
|
||||||
DialogicSingleton.set_current_timeline('')
|
DialogicSingleton.set_current_timeline('')
|
||||||
emit_signal("event_end", "timeline")
|
emit_signal("event_end", "timeline")
|
||||||
|
|
||||||
|
|
||||||
func _init_dialog():
|
func load_dialog(skip_add = false):
|
||||||
dialog_index = 0
|
|
||||||
_load_event()
|
|
||||||
|
|
||||||
|
|
||||||
func _load_event_at_index(index: int, current_runtime_id: String):
|
|
||||||
if current_runtime_id == runtime_id:
|
|
||||||
dialog_index = index
|
|
||||||
_load_event()
|
|
||||||
|
|
||||||
|
|
||||||
func _load_next_event(current_runtime_id: String):
|
|
||||||
# The entire event reading system should be refactored... but not today!
|
|
||||||
if current_runtime_id == runtime_id:
|
|
||||||
dialog_index += 1
|
|
||||||
_load_event()
|
|
||||||
|
|
||||||
|
|
||||||
func _load_event():
|
|
||||||
# Emitting signals
|
# Emitting signals
|
||||||
if dialog_script.has('events'):
|
if dialog_script.has('events'):
|
||||||
if dialog_index == 0:
|
if dialog_index == 0:
|
||||||
_on_timeline_start()
|
on_timeline_start()
|
||||||
elif dialog_index == dialog_script['events'].size():
|
elif dialog_index == dialog_script['events'].size():
|
||||||
_on_timeline_end()
|
on_timeline_end()
|
||||||
|
|
||||||
# Hiding definitions popup
|
# Hiding definitions popup
|
||||||
definition_visible = false
|
definition_visible = false
|
||||||
$DefinitionInfo.visible = definition_visible
|
$DefinitionInfo.visible = definition_visible
|
||||||
|
|
||||||
# This will load the next entry in the dialog_script array.
|
# This will load the next entry in the dialog_script array.
|
||||||
if dialog_script.has('events') and dialog_index < dialog_script['events'].size():
|
if dialog_script.has('events'):
|
||||||
var func_state = _event_handler(dialog_script['events'][dialog_index])
|
if dialog_index < dialog_script['events'].size():
|
||||||
if (func_state is GDScriptFunctionState):
|
var func_state = event_handler(dialog_script['events'][dialog_index])
|
||||||
yield(func_state, "completed")
|
if (func_state is GDScriptFunctionState):
|
||||||
else:
|
yield(func_state, "completed")
|
||||||
_close_dialog_event()
|
else:
|
||||||
|
if Engine.is_editor_hint() == false:
|
||||||
|
queue_free()
|
||||||
|
if skip_add == false:
|
||||||
|
dialog_index += 1
|
||||||
|
|
||||||
|
|
||||||
func _event_handler(event: Dictionary):
|
func reset_dialog_extras():
|
||||||
|
$TextBubble/NameLabel.text = ''
|
||||||
|
$TextBubble/NameLabel.visible = false
|
||||||
|
|
||||||
|
|
||||||
|
func get_character(character_id):
|
||||||
|
for c in characters:
|
||||||
|
if c['file'] == character_id:
|
||||||
|
return c
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
func event_handler(event: Dictionary):
|
||||||
# Handling an event and updating the available nodes accordingly.
|
# Handling an event and updating the available nodes accordingly.
|
||||||
_reset_dialog_extras()
|
$TextBubble.reset()
|
||||||
_reset_options()
|
reset_options()
|
||||||
|
|
||||||
var current_runtime_id = runtime_id
|
dprint('[D] Current Event: ', event)
|
||||||
|
|
||||||
_dprint('[D] Current Event: ', event)
|
|
||||||
match event:
|
match event:
|
||||||
{'text', 'character', 'portrait'}:
|
{'text', 'character', 'portrait'}:
|
||||||
emit_signal("event_start", "text", event)
|
emit_signal("event_start", "text", event)
|
||||||
_show_dialog()
|
show_dialog()
|
||||||
finished = false
|
finished = false
|
||||||
var character_data = _get_character(event['character'])
|
var character_data = get_character(event['character'])
|
||||||
_update_name(character_data)
|
update_name(character_data)
|
||||||
_grab_portrait_focus(character_data, event)
|
grab_portrait_focus(character_data, event)
|
||||||
_update_text(event['text'])
|
update_text(event['text'])
|
||||||
{'question', 'question_id', 'options', ..}:
|
{'question', 'question_id', 'options', ..}:
|
||||||
emit_signal("event_start", "question", event)
|
emit_signal("event_start", "question", event)
|
||||||
_show_dialog()
|
show_dialog()
|
||||||
finished = false
|
finished = false
|
||||||
waiting_for_answer = true
|
waiting_for_answer = true
|
||||||
if event.has('name'):
|
if event.has('name'):
|
||||||
_update_name(event['name'])
|
update_name(event['name'])
|
||||||
_update_text(event['question'])
|
update_text(event['question'])
|
||||||
if event.has('options'):
|
if event.has('options'):
|
||||||
for o in event['options']:
|
for o in event['options']:
|
||||||
_add_choice_button(o)
|
add_choice_button(o)
|
||||||
{'choice', 'question_id'}:
|
{'choice', 'question_id'}:
|
||||||
emit_signal("event_start", "choice", event)
|
emit_signal("event_start", "choice", event)
|
||||||
for q in questions:
|
for q in questions:
|
||||||
if q['question_id'] == event['question_id']:
|
if q['question_id'] == event['question_id']:
|
||||||
if q['answered']:
|
if q['answered']:
|
||||||
# If the option is for an answered question, skip to the end of it.
|
# If the option is for an answered question, skip to the end of it.
|
||||||
_load_event_at_index(q['end_id'], current_runtime_id)
|
dialog_index = q['end_id']
|
||||||
{'input', ..}:
|
load_dialog(true)
|
||||||
emit_signal("event_start", "input", event)
|
|
||||||
_show_dialog()
|
|
||||||
finished = false
|
|
||||||
waiting_for_input = true
|
|
||||||
_update_text(event['input'])
|
|
||||||
$TextInputDialog.window_title = event['window_title']
|
|
||||||
$TextInputDialog.popup_centered()
|
|
||||||
$TextInputDialog.connect("confirmed", self, "_on_input_set", [event['variable']])
|
|
||||||
{'action', ..}:
|
{'action', ..}:
|
||||||
emit_signal("event_start", "action", event)
|
emit_signal("event_start", "action", event)
|
||||||
if event['action'] == 'leaveall':
|
if event['action'] == 'leaveall':
|
||||||
if event['character'] == '[All]':
|
if event['character'] == '[All]':
|
||||||
_characters_leave_all()
|
characters_leave_all()
|
||||||
else:
|
else:
|
||||||
for p in $Portraits.get_children():
|
for p in $Portraits.get_children():
|
||||||
if p.character_data['file'] == event['character']:
|
if p.character_data['file'] == event['character']:
|
||||||
p.fade_out()
|
p.fade_out()
|
||||||
|
|
||||||
_load_next_event(current_runtime_id)
|
go_to_next_event()
|
||||||
elif event['action'] == 'join':
|
elif event['action'] == 'join':
|
||||||
if event['character'] == '':
|
if event['character'] == '':
|
||||||
_load_next_event(current_runtime_id)
|
go_to_next_event()
|
||||||
else:
|
else:
|
||||||
var character_data = _get_character(event['character'])
|
var character_data = get_character(event['character'])
|
||||||
var exists = _grab_portrait_focus(character_data)
|
var exists = grab_portrait_focus(character_data)
|
||||||
if exists == false:
|
if exists == false:
|
||||||
var p = Portrait.instance()
|
var p = Portrait.instance()
|
||||||
var char_portrait = event['portrait']
|
var char_portrait = event['portrait']
|
||||||
if char_portrait == '':
|
if char_portrait == '':
|
||||||
char_portrait = 'Default'
|
char_portrait = 'Default'
|
||||||
p.character_data = character_data
|
p.character_data = character_data
|
||||||
p.init(char_portrait, _get_character_position(event['position']))
|
p.init(char_portrait, get_character_position(event['position']))
|
||||||
$Portraits.add_child(p)
|
$Portraits.add_child(p)
|
||||||
p.fade_in()
|
p.fade_in()
|
||||||
_load_next_event(current_runtime_id)
|
go_to_next_event()
|
||||||
{'scene'}:
|
{'scene'}:
|
||||||
get_tree().change_scene(event['scene'])
|
get_tree().change_scene(event['scene'])
|
||||||
_load_next_event(current_runtime_id)
|
|
||||||
{'background'}:
|
{'background'}:
|
||||||
emit_signal("event_start", "background", event)
|
emit_signal("event_start", "background", event)
|
||||||
$Background.visible = true
|
var background = get_node_or_null('Background')
|
||||||
$Background.texture = null
|
if event['background'] == '' and background != null:
|
||||||
if ($Background.get_child_count() > 0):
|
background.queue_free()
|
||||||
for c in $Background.get_children():
|
else:
|
||||||
c.get_parent().remove_child(c)
|
if background == null:
|
||||||
c.queue_free()
|
background = TextureRect.new()
|
||||||
if (event['background'].ends_with('.tscn')):
|
background.expand = true
|
||||||
var bg_scene = load(event['background'])
|
background.name = 'Background'
|
||||||
if (bg_scene):
|
background.anchor_right = 1
|
||||||
bg_scene = bg_scene.instance()
|
background.anchor_bottom = 1
|
||||||
$Background.add_child(bg_scene)
|
background.stretch_mode = TextureRect.STRETCH_SCALE
|
||||||
elif (event['background'] != ''):
|
background.show_behind_parent = true
|
||||||
$Background.texture = load(event['background'])
|
add_child(background)
|
||||||
_load_next_event(current_runtime_id)
|
background.texture = null
|
||||||
|
if (background.get_child_count() > 0):
|
||||||
|
for c in background.get_children():
|
||||||
|
c.get_parent().remove_child(c)
|
||||||
|
c.queue_free()
|
||||||
|
if (event['background'].ends_with('.tscn')):
|
||||||
|
var bg_scene = load(event['background'])
|
||||||
|
if (bg_scene):
|
||||||
|
bg_scene = bg_scene.instance()
|
||||||
|
background.add_child(bg_scene)
|
||||||
|
elif (event['background'] != ''):
|
||||||
|
background.texture = load(event['background'])
|
||||||
|
go_to_next_event()
|
||||||
{'audio'}, {'audio', 'file'}:
|
{'audio'}, {'audio', 'file'}:
|
||||||
emit_signal("event_start", "audio", event)
|
emit_signal("event_start", "audio", event)
|
||||||
if event['audio'] == 'play' and 'file' in event.keys() and not event['file'].empty():
|
if event['audio'] == 'play' and 'file' in event.keys() and not event['file'].empty():
|
||||||
$FX/AudioStreamPlayer.stream = load(event['file'])
|
var audio = get_node_or_null('AudioEvent')
|
||||||
$FX/AudioStreamPlayer.play()
|
if audio == null:
|
||||||
|
audio = AudioStreamPlayer.new()
|
||||||
|
audio.name = 'AudioEvent'
|
||||||
|
add_child(audio)
|
||||||
|
audio.stream = load(event['file'])
|
||||||
|
audio.play()
|
||||||
|
print('play')
|
||||||
else:
|
else:
|
||||||
$FX/AudioStreamPlayer.stop()
|
var audio = get_node_or_null('AudioEvent')
|
||||||
_load_next_event(current_runtime_id)
|
if audio != null:
|
||||||
|
audio.stop()
|
||||||
|
audio.queue_free()
|
||||||
|
go_to_next_event()
|
||||||
{'background-music'}, {'background-music', 'file'}:
|
{'background-music'}, {'background-music', 'file'}:
|
||||||
emit_signal("event_start", "background-music", event)
|
emit_signal("event_start", "background-music", event)
|
||||||
if event['background-music'] == 'play' and 'file' in event.keys() and not event['file'].empty():
|
if event['background-music'] == 'play' and 'file' in event.keys() and not event['file'].empty():
|
||||||
$FX/BackgroundMusic.crossfade_to(event['file'])
|
$FX/BackgroundMusic.crossfade_to(event['file'])
|
||||||
else:
|
else:
|
||||||
$FX/BackgroundMusic.fade_out()
|
$FX/BackgroundMusic.fade_out()
|
||||||
_load_next_event(current_runtime_id)
|
go_to_next_event()
|
||||||
{'endbranch', ..}:
|
{'endbranch', ..}:
|
||||||
emit_signal("event_start", "endbranch", event)
|
emit_signal("event_start", "endbranch", event)
|
||||||
_load_next_event(current_runtime_id)
|
go_to_next_event()
|
||||||
{'change_scene'}:
|
{'change_scene'}:
|
||||||
get_tree().change_scene(event['change_scene'])
|
get_tree().change_scene(event['change_scene'])
|
||||||
_load_next_event(current_runtime_id)
|
|
||||||
{'emit_signal', ..}:
|
{'emit_signal', ..}:
|
||||||
_dprint('[!] Emitting signal: dialogic_signal(', event['emit_signal'], ')')
|
dprint('[!] Emitting signal: dialogic_signal(', event['emit_signal'], ')')
|
||||||
emit_signal("dialogic_signal", event['emit_signal'])
|
emit_signal("dialogic_signal", event['emit_signal'])
|
||||||
_load_next_event(current_runtime_id)
|
go_to_next_event()
|
||||||
{'close_dialog'}:
|
{'close_dialog'}:
|
||||||
emit_signal("event_start", "close_dialog", event)
|
emit_signal("event_start", "close_dialog", event)
|
||||||
_close_dialog_event()
|
close_dialog_event()
|
||||||
{'set_theme'}:
|
{'set_theme'}:
|
||||||
emit_signal("event_start", "set_theme", event)
|
emit_signal("event_start", "set_theme", event)
|
||||||
if event['set_theme'] != '':
|
if event['set_theme'] != '':
|
||||||
current_theme = _load_theme(event['set_theme'])
|
current_theme = load_theme(event['set_theme'])
|
||||||
_load_next_event(current_runtime_id)
|
go_to_next_event()
|
||||||
{'wait_seconds'}:
|
{'wait_seconds'}:
|
||||||
emit_signal("event_start", "wait", event)
|
emit_signal("event_start", "wait", event)
|
||||||
_wait_seconds(event['wait_seconds'])
|
wait_seconds(event['wait_seconds'])
|
||||||
waiting = true
|
waiting = true
|
||||||
{'change_timeline'}:
|
{'change_timeline'}:
|
||||||
dialog_script = _set_current_dialog(event['change_timeline'])
|
dialog_script = set_current_dialog(event['change_timeline'])
|
||||||
_init_dialog()
|
dialog_index = -1
|
||||||
|
go_to_next_event()
|
||||||
{'condition', 'definition', 'value', 'question_id', ..}:
|
{'condition', 'definition', 'value', 'question_id', ..}:
|
||||||
# Treating this conditional as an option on a regular question event
|
# Treating this conditional as an option on a regular question event
|
||||||
var def_value = null
|
var def_value = null
|
||||||
|
@ -550,19 +510,20 @@ func _event_handler(event: Dictionary):
|
||||||
current_question['answered'] = !condition_met
|
current_question['answered'] = !condition_met
|
||||||
if !condition_met:
|
if !condition_met:
|
||||||
# condition not met, skipping branch
|
# condition not met, skipping branch
|
||||||
_load_event_at_index(current_question['end_id'], current_runtime_id)
|
dialog_index = current_question['end_id']
|
||||||
|
load_dialog(true)
|
||||||
else:
|
else:
|
||||||
# condition met, entering branch
|
# condition met, entering branch
|
||||||
_load_next_event(current_runtime_id)
|
go_to_next_event()
|
||||||
{'set_value', 'definition', ..}:
|
{'set_value', 'definition', ..}:
|
||||||
emit_signal("event_start", "set_value", event)
|
emit_signal("event_start", "set_value", event)
|
||||||
var operation = '='
|
var operation = '='
|
||||||
if 'operation' in event and not event['operation'].empty():
|
if 'operation' in event and not event['operation'].empty():
|
||||||
operation = event["operation"]
|
operation = event["operation"]
|
||||||
DialogicSingleton.set_variable_from_id(event['definition'], event['set_value'], operation)
|
DialogicSingleton.set_variable_from_id(event['definition'], event['set_value'], operation)
|
||||||
_load_next_event(current_runtime_id)
|
go_to_next_event()
|
||||||
{'call_node', ..}:
|
{'call_node', ..}:
|
||||||
_dprint('[!] Call Node signal: dialogic_signal(call_node) ', var2str(event['call_node']))
|
dprint('[!] Call Node signal: dialogic_signal(call_node) ', var2str(event['call_node']))
|
||||||
emit_signal("event_start", "call_node", event)
|
emit_signal("event_start", "call_node", event)
|
||||||
$TextBubble.visible = false
|
$TextBubble.visible = false
|
||||||
waiting = true
|
waiting = true
|
||||||
|
@ -585,46 +546,21 @@ func _event_handler(event: Dictionary):
|
||||||
|
|
||||||
waiting = false
|
waiting = false
|
||||||
$TextBubble.visible = true
|
$TextBubble.visible = true
|
||||||
_load_next_event(current_runtime_id)
|
go_to_next_event()
|
||||||
_:
|
_:
|
||||||
visible = false
|
visible = false
|
||||||
_dprint('Other event. ', event)
|
dprint('Other event. ', event)
|
||||||
|
|
||||||
$Options.visible = waiting_for_answer
|
$Options.visible = waiting_for_answer
|
||||||
|
|
||||||
func _reset_dialog_extras():
|
|
||||||
$TextBubble/NameLabel.text = ''
|
|
||||||
$TextBubble/NameLabel.visible = false
|
|
||||||
|
|
||||||
|
func reset_options():
|
||||||
func _get_character(character_id):
|
|
||||||
for c in characters:
|
|
||||||
if c['file'] == character_id:
|
|
||||||
return c
|
|
||||||
return {}
|
|
||||||
|
|
||||||
|
|
||||||
func _on_input_set(variable):
|
|
||||||
var input_value = $TextInputDialog/LineEdit.text
|
|
||||||
if input_value == '':
|
|
||||||
$TextInputDialog.popup_centered()
|
|
||||||
else:
|
|
||||||
dialog_resource.custom_variables[variable] = input_value
|
|
||||||
waiting_for_input = false
|
|
||||||
$TextInputDialog/LineEdit.text = ''
|
|
||||||
$TextInputDialog.disconnect("confirmed", self, '_on_input_set')
|
|
||||||
$TextInputDialog.visible = false
|
|
||||||
_load_next_event(runtime_id)
|
|
||||||
_dprint('[!] Input selected: ', input_value)
|
|
||||||
_dprint('[!] dialog variables: ', dialog_resource.custom_variables)
|
|
||||||
|
|
||||||
|
|
||||||
func _reset_options():
|
|
||||||
# Clearing out the options after one was selected.
|
# Clearing out the options after one was selected.
|
||||||
for option in $Options.get_children():
|
for option in $Options.get_children():
|
||||||
option.queue_free()
|
option.queue_free()
|
||||||
|
|
||||||
|
|
||||||
func _add_choice_button(option):
|
func add_choice_button(option):
|
||||||
var theme = current_theme
|
var theme = current_theme
|
||||||
|
|
||||||
var button = ChoiceButton.instance()
|
var button = ChoiceButton.instance()
|
||||||
|
@ -673,7 +609,7 @@ func _add_choice_button(option):
|
||||||
|
|
||||||
$Options.set('custom_constants/separation', theme.get_value('buttons', 'gap', 20))
|
$Options.set('custom_constants/separation', theme.get_value('buttons', 'gap', 20))
|
||||||
|
|
||||||
button.connect("pressed", self, "_answer_question", [button, option['event_id'], option['question_id']])
|
button.connect("pressed", self, "answer_question", [button, option['event_id'], option['question_id']])
|
||||||
|
|
||||||
$Options.add_child(button)
|
$Options.add_child(button)
|
||||||
|
|
||||||
|
@ -682,15 +618,15 @@ func _add_choice_button(option):
|
||||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) # Make sure the cursor is visible for the options selection
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) # Make sure the cursor is visible for the options selection
|
||||||
|
|
||||||
|
|
||||||
func _answer_question(i, event_id, question_id):
|
func answer_question(i, event_id, question_id):
|
||||||
_dprint('[!] Going to ', event_id + 1, i, 'question_id:', question_id)
|
dprint('[!] Going to ', event_id + 1, i, 'question_id:', question_id)
|
||||||
_dprint('')
|
dprint('')
|
||||||
waiting_for_answer = false
|
waiting_for_answer = false
|
||||||
dialog_index = event_id
|
dialog_index = event_id + 1
|
||||||
questions[question_id]['answered'] = true
|
questions[question_id]['answered'] = true
|
||||||
_dprint(' dialog_index = ', dialog_index)
|
dprint(' dialog_index = ', dialog_index)
|
||||||
_reset_options()
|
reset_options()
|
||||||
_load_next_event(runtime_id)
|
load_dialog()
|
||||||
if last_mouse_mode != null:
|
if last_mouse_mode != null:
|
||||||
Input.set_mouse_mode(last_mouse_mode) # Revert to last mouse mode when selection is done
|
Input.set_mouse_mode(last_mouse_mode) # Revert to last mouse mode when selection is done
|
||||||
last_mouse_mode = null
|
last_mouse_mode = null
|
||||||
|
@ -699,16 +635,18 @@ func _answer_question(i, event_id, question_id):
|
||||||
func _on_option_selected(option, variable, value):
|
func _on_option_selected(option, variable, value):
|
||||||
dialog_resource.custom_variables[variable] = value
|
dialog_resource.custom_variables[variable] = value
|
||||||
waiting_for_answer = false
|
waiting_for_answer = false
|
||||||
_reset_options()
|
reset_options()
|
||||||
_load_next_event(runtime_id)
|
load_dialog()
|
||||||
_dprint('[!] Option selected: ', option.text, ' value= ' , value)
|
dprint('[!] Option selected: ', option.text, ' value= ' , value)
|
||||||
|
|
||||||
|
|
||||||
func _on_TextInputDialog_confirmed():
|
func go_to_next_event():
|
||||||
pass # Replace with function body.
|
# The entire event reading system should be refactored... but not today!
|
||||||
|
dialog_index += 1
|
||||||
|
load_dialog(true)
|
||||||
|
|
||||||
|
|
||||||
func _grab_portrait_focus(character_data, event: Dictionary = {}) -> bool:
|
func grab_portrait_focus(character_data, event: Dictionary = {}) -> bool:
|
||||||
var exists = false
|
var exists = false
|
||||||
var visually_focus = true
|
var visually_focus = true
|
||||||
if settings.has_section_key('dialog', 'dim_characters'):
|
if settings.has_section_key('dialog', 'dim_characters'):
|
||||||
|
@ -729,7 +667,7 @@ func _grab_portrait_focus(character_data, event: Dictionary = {}) -> bool:
|
||||||
return exists
|
return exists
|
||||||
|
|
||||||
|
|
||||||
func _get_character_position(positions) -> String:
|
func get_character_position(positions) -> String:
|
||||||
if positions['0']:
|
if positions['0']:
|
||||||
return 'left'
|
return 'left'
|
||||||
if positions['1']:
|
if positions['1']:
|
||||||
|
@ -743,64 +681,19 @@ func _get_character_position(positions) -> String:
|
||||||
return 'left'
|
return 'left'
|
||||||
|
|
||||||
|
|
||||||
func _deferred_resize(current_size, result):
|
func deferred_resize(current_size, result):
|
||||||
#var result = theme.get_value('box', 'size', Vector2(910, 167))
|
#var result = theme.get_value('box', 'size', Vector2(910, 167))
|
||||||
$TextBubble.rect_size = result
|
$TextBubble.rect_size = result
|
||||||
if current_size != $TextBubble.rect_size:
|
if current_size != $TextBubble.rect_size:
|
||||||
_resize_main()
|
resize_main()
|
||||||
|
|
||||||
|
|
||||||
func _load_theme(filename):
|
func load_theme(filename):
|
||||||
var theme = DialogicResources.get_theme_config(filename)
|
var theme = DialogicResources.get_theme_config(filename)
|
||||||
|
|
||||||
# Box size
|
# Box size
|
||||||
call_deferred('_deferred_resize', $TextBubble.rect_size, theme.get_value('box', 'size', Vector2(910, 167)))
|
call_deferred('deferred_resize', $TextBubble.rect_size, theme.get_value('box', 'size', Vector2(910, 167)))
|
||||||
|
|
||||||
# Text
|
|
||||||
var theme_font = DialogicUtil.path_fixer_load(theme.get_value('text', 'font', 'res://addons/dialogic/Example Assets/Fonts/DefaultFont.tres'))
|
|
||||||
$TextBubble/RichTextLabel.set('custom_fonts/normal_font', theme_font)
|
|
||||||
$TextBubble/NameLabel.set('custom_fonts/font', theme_font)
|
|
||||||
|
|
||||||
var text_color = Color(theme.get_value('text', 'color', '#ffffffff'))
|
|
||||||
$TextBubble/RichTextLabel.set('custom_colors/default_color', text_color)
|
|
||||||
$TextBubble/NameLabel.set('custom_colors/font_color', text_color)
|
|
||||||
|
|
||||||
$TextBubble/RichTextLabel.set('custom_colors/font_color_shadow', Color('#00ffffff'))
|
|
||||||
$TextBubble/NameLabel.set('custom_colors/font_color_shadow', Color('#00ffffff'))
|
|
||||||
|
|
||||||
if theme.get_value('text', 'shadow', false):
|
|
||||||
var text_shadow_color = Color(theme.get_value('text', 'shadow_color', '#9e000000'))
|
|
||||||
$TextBubble/RichTextLabel.set('custom_colors/font_color_shadow', text_shadow_color)
|
|
||||||
|
|
||||||
var shadow_offset = theme.get_value('text', 'shadow_offset', Vector2(2,2))
|
|
||||||
$TextBubble/RichTextLabel.set('custom_constants/shadow_offset_x', shadow_offset.x)
|
|
||||||
$TextBubble/RichTextLabel.set('custom_constants/shadow_offset_y', shadow_offset.y)
|
|
||||||
|
|
||||||
|
|
||||||
# Text speed
|
|
||||||
text_speed = theme.get_value('text','speed', 2) * 0.01
|
|
||||||
|
|
||||||
# Margin
|
|
||||||
var text_margin = theme.get_value('text', 'margin', Vector2(20, 10))
|
|
||||||
$TextBubble/RichTextLabel.set('margin_left', text_margin.x)
|
|
||||||
$TextBubble/RichTextLabel.set('margin_right', text_margin.x * -1)
|
|
||||||
$TextBubble/RichTextLabel.set('margin_top', text_margin.y)
|
|
||||||
$TextBubble/RichTextLabel.set('margin_bottom', text_margin.y * -1)
|
|
||||||
|
|
||||||
# Backgrounds
|
|
||||||
$TextBubble/TextureRect.texture = DialogicUtil.path_fixer_load(theme.get_value('background','image', "res://addons/dialogic/Example Assets/backgrounds/background-2.png"))
|
|
||||||
$TextBubble/ColorRect.color = Color(theme.get_value('background','color', "#ff000000"))
|
|
||||||
|
|
||||||
if theme.get_value('background', 'modulation', false) == true:
|
|
||||||
$TextBubble/TextureRect.modulate = Color(theme.get_value('background', 'modulation_color', '#ffffffff'))
|
|
||||||
else:
|
|
||||||
$TextBubble/TextureRect.modulate = Color('#ffffffff')
|
|
||||||
|
|
||||||
$TextBubble/ColorRect.visible = theme.get_value('background', 'use_color', false)
|
|
||||||
$TextBubble/TextureRect.visible = theme.get_value('background', 'use_image', true)
|
|
||||||
|
|
||||||
# Next image
|
|
||||||
$TextBubble/NextIndicator.texture = DialogicUtil.path_fixer_load(theme.get_value('next_indicator', 'image', 'res://addons/dialogic/Example Assets/next-indicator/next-indicator.png'))
|
|
||||||
input_next = theme.get_value('settings', 'action_key', 'ui_accept')
|
input_next = theme.get_value('settings', 'action_key', 'ui_accept')
|
||||||
|
|
||||||
# Definitions
|
# Definitions
|
||||||
|
@ -809,27 +702,7 @@ func _load_theme(filename):
|
||||||
$DefinitionInfo/VBoxContainer/Content.set('custom_fonts/normal_font', definitions_font)
|
$DefinitionInfo/VBoxContainer/Content.set('custom_fonts/normal_font', definitions_font)
|
||||||
$DefinitionInfo/VBoxContainer/Extra.set('custom_fonts/normal_font', definitions_font)
|
$DefinitionInfo/VBoxContainer/Extra.set('custom_fonts/normal_font', definitions_font)
|
||||||
|
|
||||||
# Character Name
|
$TextBubble.load_theme(theme)
|
||||||
$TextBubble/NameLabel/ColorRect.visible = theme.get_value('name', 'background_visible', false)
|
|
||||||
$TextBubble/NameLabel/ColorRect.color = Color(theme.get_value('name', 'background', '#282828'))
|
|
||||||
$TextBubble/NameLabel/TextureRect.visible = theme.get_value('name', 'image_visible', false)
|
|
||||||
$TextBubble/NameLabel/TextureRect.texture = DialogicUtil.path_fixer_load(theme.get_value('name','image', "res://addons/dialogic/Example Assets/backgrounds/background-2.png"))
|
|
||||||
var name_shadow_offset = theme.get_value('name', 'shadow_offset', Vector2(2,2))
|
|
||||||
if theme.get_value('name', 'shadow_visible', true):
|
|
||||||
$TextBubble/NameLabel.set('custom_colors/font_color_shadow', Color(theme.get_value('name', 'shadow', '#9e000000')))
|
|
||||||
$TextBubble/NameLabel.set('custom_constants/shadow_offset_x', name_shadow_offset.x)
|
|
||||||
$TextBubble/NameLabel.set('custom_constants/shadow_offset_y', name_shadow_offset.y)
|
|
||||||
$TextBubble/NameLabel.rect_position.y = theme.get_value('name', 'bottom_gap', 48) * -1
|
|
||||||
if theme.get_value('name', 'modulation', false) == true:
|
|
||||||
$TextBubble/NameLabel/TextureRect.modulate = Color(theme.get_value('name', 'modulation_color', '#ffffffff'))
|
|
||||||
else:
|
|
||||||
$TextBubble/NameLabel/TextureRect.modulate = Color('#ffffffff')
|
|
||||||
|
|
||||||
# Setting next indicator animation
|
|
||||||
$TextBubble/NextIndicator.self_modulate = Color('#ffffff')
|
|
||||||
$TextBubble/NextIndicator/AnimationPlayer.play(
|
|
||||||
theme.get_value('next_indicator', 'animation', 'Up and down')
|
|
||||||
)
|
|
||||||
|
|
||||||
return theme
|
return theme
|
||||||
|
|
||||||
|
@ -845,7 +718,7 @@ func _on_RichTextLabel_meta_hover_started(meta):
|
||||||
'color': current_theme.get_value('definitions', 'color', '#ffbebebe'),
|
'color': current_theme.get_value('definitions', 'color', '#ffbebebe'),
|
||||||
})
|
})
|
||||||
correct_type = true
|
correct_type = true
|
||||||
_dprint(d)
|
dprint(d)
|
||||||
|
|
||||||
if correct_type:
|
if correct_type:
|
||||||
definition_visible = true
|
definition_visible = true
|
||||||
|
@ -866,8 +739,12 @@ func _on_Definition_Timer_timeout():
|
||||||
$DefinitionInfo.visible = definition_visible
|
$DefinitionInfo.visible = definition_visible
|
||||||
|
|
||||||
|
|
||||||
func _wait_seconds(seconds):
|
func wait_seconds(seconds):
|
||||||
$WaitSeconds.start(seconds)
|
var timer = Timer.new()
|
||||||
|
timer.name = 'WaitSeconds'
|
||||||
|
add_child(timer)
|
||||||
|
timer.connect("timeout", self, '_on_WaitSeconds_timeout')
|
||||||
|
timer.start(seconds)
|
||||||
$TextBubble.visible = false
|
$TextBubble.visible = false
|
||||||
|
|
||||||
|
|
||||||
|
@ -875,11 +752,12 @@ func _on_WaitSeconds_timeout():
|
||||||
emit_signal("event_end", "wait")
|
emit_signal("event_end", "wait")
|
||||||
waiting = false
|
waiting = false
|
||||||
$WaitSeconds.stop()
|
$WaitSeconds.stop()
|
||||||
|
$WaitSeconds.queue_free()
|
||||||
$TextBubble.visible = true
|
$TextBubble.visible = true
|
||||||
_load_next_event(runtime_id)
|
load_dialog()
|
||||||
|
|
||||||
|
|
||||||
func _dprint(string, arg1='', arg2='', arg3='', arg4='' ):
|
func dprint(string, arg1='', arg2='', arg3='', arg4='' ):
|
||||||
# HAHAHA if you are here wondering what this is...
|
# HAHAHA if you are here wondering what this is...
|
||||||
# I ask myself the same question :')
|
# I ask myself the same question :')
|
||||||
if debug_mode:
|
if debug_mode:
|
||||||
|
@ -915,79 +793,27 @@ func _compare_definitions(def_value: String, event_value: String, condition: Str
|
||||||
return condition_met
|
return condition_met
|
||||||
|
|
||||||
|
|
||||||
func _characters_leave_all():
|
func characters_leave_all():
|
||||||
for p in $Portraits.get_children():
|
var portraits = get_node_or_null('Portraits')
|
||||||
p.fade_out()
|
if portraits != null:
|
||||||
|
for p in portraits.get_children():
|
||||||
|
p.fade_out()
|
||||||
|
|
||||||
|
|
||||||
func _close_dialog_event():
|
func close_dialog_event():
|
||||||
var tween = $TextBubble/CloseDialog/Tween
|
var tween = Tween.new()
|
||||||
|
add_child(tween)
|
||||||
tween.interpolate_property($TextBubble, "modulate",
|
tween.interpolate_property($TextBubble, "modulate",
|
||||||
$TextBubble.modulate, Color('#00ffffff'), 1,
|
$TextBubble.modulate, Color('#00ffffff'), 1,
|
||||||
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
|
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
|
||||||
tween.start()
|
tween.start()
|
||||||
$TextBubble/CloseDialog/Timer.start(2)
|
var close_dialog_timer = Timer.new()
|
||||||
_characters_leave_all()
|
close_dialog_timer.connect("timeout", self, '_on_close_dialog_timeout')
|
||||||
|
add_child(close_dialog_timer)
|
||||||
|
close_dialog_timer.start(2)
|
||||||
|
characters_leave_all()
|
||||||
|
|
||||||
|
|
||||||
func _stop_close_dialog():
|
func _on_close_dialog_timeout():
|
||||||
$TextBubble.modulate = Color('#ffffffff')
|
on_timeline_end()
|
||||||
$TextBubble/CloseDialog/Tween.stop_all()
|
queue_free()
|
||||||
$TextBubble/CloseDialog/Timer.stop()
|
|
||||||
|
|
||||||
|
|
||||||
func _on_close_dialog_timeout(tween, close_dialog_timer):
|
|
||||||
hide()
|
|
||||||
_on_timeline_end()
|
|
||||||
|
|
||||||
|
|
||||||
## *****************************************************************************
|
|
||||||
## OVERRIDES
|
|
||||||
## *****************************************************************************
|
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
|
||||||
# Loading the config files
|
|
||||||
_load_config_files()
|
|
||||||
|
|
||||||
# Connecting resize signal
|
|
||||||
get_viewport().connect("size_changed", self, "_resize_main")
|
|
||||||
_resize_main()
|
|
||||||
|
|
||||||
# Setting everything up for the node to be default
|
|
||||||
$TextBubble/NameLabel.text = ''
|
|
||||||
$Background.visible = false
|
|
||||||
$TextBubble/RichTextLabel.meta_underlined = false
|
|
||||||
$DefinitionInfo.visible = false
|
|
||||||
|
|
||||||
$TextBubble/CloseDialog/Timer.connect("timeout", self, '_on_close_dialog_timeout')
|
|
||||||
tween_node.connect("tween_completed", self, '_on_Tween_tween_completed')
|
|
||||||
|
|
||||||
# Getting the character information
|
|
||||||
characters = DialogicUtil.get_character_list()
|
|
||||||
|
|
||||||
# Try to start the timeline only if specified
|
|
||||||
if not timeline.empty():
|
|
||||||
start(timeline)
|
|
||||||
|
|
||||||
|
|
||||||
func _process(delta):
|
|
||||||
$TextBubble/NextIndicator.visible = finished
|
|
||||||
if waiting_for_answer and Input.is_action_just_released(input_next):
|
|
||||||
if $Options.get_child_count() > 0:
|
|
||||||
$Options.get_child(0).grab_focus()
|
|
||||||
|
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
|
||||||
if not Engine.is_editor_hint() and event.is_action_pressed(input_next) and not waiting:
|
|
||||||
if tween_node.is_active():
|
|
||||||
# Skip to end if key is pressed during the text animation
|
|
||||||
tween_node.seek(999)
|
|
||||||
finished = true
|
|
||||||
else:
|
|
||||||
if waiting_for_answer == false and waiting_for_input == false:
|
|
||||||
_load_next_event(runtime_id)
|
|
||||||
if settings.has_section_key('dialog', 'propagate_input'):
|
|
||||||
var propagate_input: bool = settings.get_value('dialog', 'propagate_input')
|
|
||||||
if not propagate_input:
|
|
||||||
get_tree().set_input_as_handled()
|
|
||||||
|
|
|
@ -12,50 +12,51 @@ extends Node
|
||||||
class_name Dialogic
|
class_name Dialogic
|
||||||
|
|
||||||
|
|
||||||
## Adds the dialogic node as a child of the given node
|
## Starts the dialog for the given timeline and returns a Dialog node.
|
||||||
## The parent node must be of type control
|
## You must then add it manually to the scene to display the dialog.
|
||||||
## To start the timeline, use the start method from the returned node
|
|
||||||
##
|
##
|
||||||
## @param parent The parent to add the dialogic node to.
|
## Example:
|
||||||
## @param dialog_scene_path If you made a custom Dialog scene or moved it from its default path, you can specify its new path here.
|
## var new_dialog = Dialogic.start('Your Timeline Name Here')
|
||||||
## @returns The Dialog node or null if the parent was invalid.
|
## add_child(new_dialog)
|
||||||
static func add_as_child_of(parent: Node, dialog_scene_path: String="res://addons/dialogic/Dialog.tscn") -> DialogicNode:
|
|
||||||
if parent is Control:
|
|
||||||
var dialog_node = get_instance(dialog_scene_path)
|
|
||||||
parent.add_child(dialog_node)
|
|
||||||
return dialog_node
|
|
||||||
else:
|
|
||||||
printerr("[Dialogic] Node's parent should be a Control")
|
|
||||||
return null
|
|
||||||
|
|
||||||
## Adds the dialogic node as a child of the given node, and below the given node
|
|
||||||
## The parent node must be of type control
|
|
||||||
## To start the timeline, use the start method from the returned node
|
|
||||||
##
|
##
|
||||||
## @param parent The parent to add the dialogic node to.
|
## This is exactly the same as using the editor:
|
||||||
## @param node The node to add dialogic below.
|
## you can drag and drop the scene located at /addons/dialogic/Dialog.tscn
|
||||||
## @param dialog_scene_path If you made a custom Dialog scene or moved it from its default path, you can specify its new path here.
|
## and set the current timeline via the inspector.
|
||||||
## @returns The Dialog node or null if the parent was invalid.
|
|
||||||
static func add_as_child_of_below_node(parent: Node, node: Node, dialog_scene_path: String="res://addons/dialogic/Dialog.tscn") -> DialogicNode:
|
|
||||||
if parent is Control:
|
|
||||||
var dialog_node = get_instance(dialog_scene_path)
|
|
||||||
parent.add_child_below_node(node, dialog_node)
|
|
||||||
return dialog_node
|
|
||||||
else:
|
|
||||||
printerr("[Dialogic] Node's parent should be a Control")
|
|
||||||
return null
|
|
||||||
|
|
||||||
|
|
||||||
## Gets a DialogicNode instance to be added to the tree
|
|
||||||
## This instance can then be added to the tree using add_child()
|
|
||||||
## To start the timeline, use the start method from the returned node
|
|
||||||
##
|
##
|
||||||
|
## @param timeline The timeline to load. You can provide the timeline name or the filename.
|
||||||
|
## @param reset_saves True to reset dialogic saved data such as definitions.
|
||||||
## @param dialog_scene_path If you made a custom Dialog scene or moved it from its default path, you can specify its new path here.
|
## @param dialog_scene_path If you made a custom Dialog scene or moved it from its default path, you can specify its new path here.
|
||||||
|
## @param debug_mode Debug is disabled by default but can be enabled if needed.
|
||||||
## @returns A Dialog node to be added into the scene tree.
|
## @returns A Dialog node to be added into the scene tree.
|
||||||
static func get_instance(dialog_scene_path: String="res://addons/dialogic/Dialog.tscn") -> DialogicNode:
|
static func start(timeline: String, reset_saves: bool=true, dialog_scene_path: String="res://addons/dialogic/Dialog.tscn", debug_mode: bool=false):
|
||||||
var dialog : = load(dialog_scene_path)
|
|
||||||
return dialog.instance()
|
|
||||||
|
|
||||||
|
var dialog: = load(dialog_scene_path)
|
||||||
|
var d = dialog.instance()
|
||||||
|
d.reset_saves = reset_saves
|
||||||
|
d.debug_mode = debug_mode
|
||||||
|
if not timeline.empty():
|
||||||
|
for t in DialogicUtil.get_timeline_list():
|
||||||
|
if t['name'] == timeline or t['file'] == timeline:
|
||||||
|
d.timeline = t['file']
|
||||||
|
return d
|
||||||
|
d.dialog_script = {
|
||||||
|
"events":[{"character":"","portrait":"",
|
||||||
|
"text":"[Dialogic Error] Loading dialog [color=red]" + timeline + "[/color]. It seems like the timeline doesn't exists. Maybe the name is wrong?"}]
|
||||||
|
}
|
||||||
|
return d
|
||||||
|
|
||||||
|
|
||||||
|
## Same as the start method above, but using the last timeline saved.
|
||||||
|
##
|
||||||
|
## @param initial_timeline The timeline to load in case no save is found.
|
||||||
|
## @param dialog_scene_path If you made a custom Dialog scene or moved it from its default path, you can specify its new path here.
|
||||||
|
## @param debug_mode Debug is disabled by default but can be enabled if needed.
|
||||||
|
## @returns A Dialog node to be added into the scene tree.
|
||||||
|
static func start_from_save(initial_timeline: String, dialog_scene_path: String="res://addons/dialogic/Dialog.tscn", debug_mode: bool=false):
|
||||||
|
var current := get_current_timeline()
|
||||||
|
if current.empty():
|
||||||
|
current = initial_timeline
|
||||||
|
return start(current, false, dialog_scene_path, debug_mode)
|
||||||
|
|
||||||
## Gets default values for definitions.
|
## Gets default values for definitions.
|
||||||
##
|
##
|
||||||
|
@ -75,12 +76,12 @@ static func get_definitions() -> Dictionary:
|
||||||
## Definitions are automatically saved on timeline start/end
|
## Definitions are automatically saved on timeline start/end
|
||||||
##
|
##
|
||||||
## @returns Error status, OK if all went well
|
## @returns Error status, OK if all went well
|
||||||
static func save_definitions():
|
func save_definitions():
|
||||||
return DialogicSingleton.save_definitions()
|
return DialogicSingleton.save_definitions()
|
||||||
|
|
||||||
|
|
||||||
## Resets data to default values. This is the same as calling start with reset_saves to true
|
## Resets data to default values. This is the same as calling start with reset_saves to true
|
||||||
static func reset_saves():
|
func reset_saves():
|
||||||
DialogicSingleton.init(true)
|
DialogicSingleton.init(true)
|
||||||
|
|
||||||
|
|
||||||
|
@ -134,63 +135,3 @@ static func set_glossary(name: String, title: String, text: String, extra: Strin
|
||||||
## @returns The current timeline filename, or an empty string if none was saved.
|
## @returns The current timeline filename, or an empty string if none was saved.
|
||||||
static func get_current_timeline() -> String:
|
static func get_current_timeline() -> String:
|
||||||
return DialogicSingleton.get_current_timeline()
|
return DialogicSingleton.get_current_timeline()
|
||||||
|
|
||||||
|
|
||||||
## ************************************************************
|
|
||||||
## DEPRECATED FUNCTIONS
|
|
||||||
## These functions will be removed in future versions
|
|
||||||
## Use at your own risk
|
|
||||||
## ************************************************************
|
|
||||||
|
|
||||||
|
|
||||||
## /!\ DEPRECATED /!\
|
|
||||||
## Use get_instance() instead
|
|
||||||
##
|
|
||||||
## Starts the dialog for the given timeline and returns a Dialog node.
|
|
||||||
## You must then add it manually to the scene to display the dialog.
|
|
||||||
##
|
|
||||||
## Example:
|
|
||||||
## var new_dialog = Dialogic.start('Your Timeline Name Here')
|
|
||||||
## add_child(new_dialog)
|
|
||||||
##
|
|
||||||
## This is exactly the same as using the editor:
|
|
||||||
## you can drag and drop the scene located at /addons/dialogic/Dialog.tscn
|
|
||||||
## and set the current timeline via the inspector.
|
|
||||||
##
|
|
||||||
## @param timeline The timeline to load. You can provide the timeline name or the filename.
|
|
||||||
## @param reset_saves True to reset dialogic saved data such as definitions.
|
|
||||||
## @param dialog_scene_path If you made a custom Dialog scene or moved it from its default path, you can specify its new path here.
|
|
||||||
## @param debug_mode Debug is disabled by default but can be enabled if needed.
|
|
||||||
## @returns A Dialog node to be added into the scene tree.
|
|
||||||
static func start(timeline: String, reset_saves: bool=true, dialog_scene_path: String="res://addons/dialogic/Dialog.tscn", debug_mode: bool=false) -> DialogicNode:
|
|
||||||
|
|
||||||
var dialog: = load(dialog_scene_path)
|
|
||||||
var d = dialog.instance()
|
|
||||||
d.reset_saves = reset_saves
|
|
||||||
d.debug_mode = debug_mode
|
|
||||||
if not timeline.empty():
|
|
||||||
for t in DialogicUtil.get_timeline_list():
|
|
||||||
if t['name'] == timeline or t['file'] == timeline:
|
|
||||||
d.timeline = t['file']
|
|
||||||
return d
|
|
||||||
d.dialog_script = {
|
|
||||||
"events":[{"character":"","portrait":"",
|
|
||||||
"text":"[Dialogic Error] Loading dialog [color=red]" + timeline + "[/color]. It seems like the timeline doesn't exists. Maybe the name is wrong?"}]
|
|
||||||
}
|
|
||||||
return d
|
|
||||||
|
|
||||||
|
|
||||||
## /!\ DEPRECATED /!\
|
|
||||||
## Use get_instance() instead
|
|
||||||
##
|
|
||||||
## Same as the start method above, but using the last timeline saved.
|
|
||||||
##
|
|
||||||
## @param initial_timeline The timeline to load in case no save is found.
|
|
||||||
## @param dialog_scene_path If you made a custom Dialog scene or moved it from its default path, you can specify its new path here.
|
|
||||||
## @param debug_mode Debug is disabled by default but can be enabled if needed.
|
|
||||||
## @returns A Dialog node to be added into the scene tree.
|
|
||||||
static func start_from_save(initial_timeline: String, dialog_scene_path: String="res://addons/dialogic/Dialog.tscn", debug_mode: bool=false) -> DialogicNode:
|
|
||||||
var current := get_current_timeline()
|
|
||||||
if current.empty():
|
|
||||||
current = initial_timeline
|
|
||||||
return start(current, false, dialog_scene_path, debug_mode)
|
|
||||||
|
|
|
@ -24,11 +24,6 @@ _global_script_classes=[ {
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://addons/dialogic/Other/DialogicDefinitionsUtil.gd"
|
"path": "res://addons/dialogic/Other/DialogicDefinitionsUtil.gd"
|
||||||
}, {
|
}, {
|
||||||
"base": "Control",
|
|
||||||
"class": "DialogicNode",
|
|
||||||
"language": "GDScript",
|
|
||||||
"path": "res://addons/dialogic/Nodes/dialog_node.gd"
|
|
||||||
}, {
|
|
||||||
"base": "Reference",
|
"base": "Reference",
|
||||||
"class": "DialogicResources",
|
"class": "DialogicResources",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
|
@ -43,7 +38,6 @@ _global_script_class_icons={
|
||||||
"Dialogic": "",
|
"Dialogic": "",
|
||||||
"DialogicBackgroundMusic": "",
|
"DialogicBackgroundMusic": "",
|
||||||
"DialogicDefinitionsUtil": "",
|
"DialogicDefinitionsUtil": "",
|
||||||
"DialogicNode": "",
|
|
||||||
"DialogicResources": "",
|
"DialogicResources": "",
|
||||||
"DialogicUtil": ""
|
"DialogicUtil": ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,12 @@ extends Node
|
||||||
|
|
||||||
onready var mini_game = $MiniGame;
|
onready var mini_game = $MiniGame;
|
||||||
|
|
||||||
onready var dialogic_node: DialogicNode;
|
var dialogic_node;
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
dialogic_node = Dialogic.add_as_child_of($Control)
|
dialogic_node = Dialogic.start('_start')
|
||||||
$Control.move_child(dialogic_node, 0)
|
add_child(dialogic_node)
|
||||||
dialogic_node.connect('dialogic_signal', self, "_on_Dialogic_signal_received")
|
dialogic_node.connect('dialogic_signal', self, "_on_Dialogic_signal_received")
|
||||||
dialogic_node.start_from_save("_start")
|
|
||||||
|
|
||||||
|
|
||||||
func _on_Dialogic_signal_received(value: String):
|
func _on_Dialogic_signal_received(value: String):
|
||||||
|
@ -39,4 +38,5 @@ func start_minigame():
|
||||||
func _on_MiniGame_game_over(next_timeline: String):
|
func _on_MiniGame_game_over(next_timeline: String):
|
||||||
print("Game over received")
|
print("Game over received")
|
||||||
print("next timeline: " + next_timeline)
|
print("next timeline: " + next_timeline)
|
||||||
dialogic_node.start(next_timeline)
|
dialogic_node = Dialogic.start(next_timeline)
|
||||||
|
add_child(dialogic_node)
|
||||||
|
|
|
@ -6,7 +6,7 @@ func load_main_game():
|
||||||
|
|
||||||
|
|
||||||
func _on_NewGameButton_pressed():
|
func _on_NewGameButton_pressed():
|
||||||
Dialogic.reset_saves()
|
# Dialogic.reset_saves()
|
||||||
load_main_game()
|
load_main_game()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue