Update Dialogic and remove exp dialog plugin

This commit is contained in:
Arnaud Vergnet 2021-03-22 17:17:08 +01:00
parent 1cf5125f7d
commit a1212b0f70
82 changed files with 779 additions and 3608 deletions

10
Main.gd
View file

@ -1,17 +1,13 @@
extends Node
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
var new_dialog = Dialogic.start('timeline1')
add_child(new_dialog)
new_dialog.connect('dialogic_signal', self, "_on_Dialogic_signal_received")
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _on_Dialogic_signal_received(value: String):
print('received ' + value)

View file

@ -1,76 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/dialog_editor.gd" type="Script" id=1]
[node name="Dialog_Editor" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
rect_min_size = Vector2( 0, 256 )
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
margin_right = 1024.0
margin_bottom = 20.0
[node name="Close_BTN" type="Button" parent="VBoxContainer/VBoxContainer"]
margin_right = 47.0
margin_bottom = 20.0
hint_tooltip = "Close the Dialog Editor."
text = "Close"
[node name="Back_BTN" type="Button" parent="VBoxContainer/VBoxContainer"]
margin_left = 51.0
margin_right = 93.0
margin_bottom = 20.0
hint_tooltip = "Return to the Story Editor."
text = "Back"
[node name="VSeparator" type="VSeparator" parent="VBoxContainer/VBoxContainer"]
margin_left = 97.0
margin_right = 101.0
margin_bottom = 20.0
[node name="Add_Node_BTN" type="Button" parent="VBoxContainer/VBoxContainer"]
margin_left = 105.0
margin_right = 180.0
margin_bottom = 20.0
hint_tooltip = "Add a new node to the graph."
text = "Add Node"
[node name="VSeparator2" type="VSeparator" parent="VBoxContainer/VBoxContainer"]
margin_left = 184.0
margin_right = 188.0
margin_bottom = 20.0
[node name="Human_Readable_LBL" type="Label" parent="VBoxContainer/VBoxContainer"]
margin_left = 192.0
margin_top = 3.0
margin_right = 378.0
margin_bottom = 17.0
text = "Human Readable Description"
[node name="GraphEdit" type="GraphEdit" parent="VBoxContainer"]
margin_top = 24.0
margin_right = 1024.0
margin_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 3
right_disconnects = true
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="VBoxContainer/VBoxContainer/Close_BTN" to="." method="_on_Close_BTN_pressed"]
[connection signal="pressed" from="VBoxContainer/VBoxContainer/Back_BTN" to="." method="_on_Back_BTN_pressed"]
[connection signal="pressed" from="VBoxContainer/VBoxContainer/Add_Node_BTN" to="." method="_on_Add_Node_BTN_pressed"]
[connection signal="connection_request" from="VBoxContainer/GraphEdit" to="." method="_on_GraphEdit_connection_request"]
[connection signal="disconnection_request" from="VBoxContainer/GraphEdit" to="." method="_on_GraphEdit_disconnection_request"]

View file

@ -1,52 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Editor/editor.gd" type="Script" id=1]
[node name="WindowDialog" type="WindowDialog"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -540.0
margin_top = -384.0
margin_right = 540.0
margin_bottom = 384.0
window_title = "Node Editor"
resizable = true
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 13.0
margin_top = 13.0
margin_right = -13.0
margin_bottom = -13.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TextEdit" type="TextEdit" parent="VBoxContainer"]
margin_right = 1054.0
margin_bottom = 718.0
size_flags_horizontal = 3
size_flags_vertical = 3
smooth_scrolling = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="OK_BTN" type="Button" parent="VBoxContainer"]
margin_left = 503.0
margin_top = 722.0
margin_right = 550.0
margin_bottom = 742.0
hint_tooltip = "Close the node editor."
size_flags_horizontal = 4
size_flags_vertical = 0
text = "Close"
[connection signal="text_changed" from="VBoxContainer/TextEdit" to="." method="_on_TextEdit_text_changed"]
[connection signal="pressed" from="VBoxContainer/OK_BTN" to="." method="_on_OK_BTN_pressed"]

View file

@ -1,21 +0,0 @@
tool
extends WindowDialog
onready var _Text_Editor = self.get_node("VBoxContainer/TextEdit")
var _Target_Node
#Public Methods
func set_target_node(node):
self._Target_Node = node
self._Text_Editor.text = node.get_text()
#Callback Methods
func _on_OK_BTN_pressed():
self.visible = false
func _on_TextEdit_text_changed():
self._Target_Node.set_text(self._Text_Editor.text)

View file

@ -1,64 +0,0 @@
tool
extends VBoxContainer
class_name Choice
signal choice_changed(index, new_json_structure)
signal choice_removed(index)
onready var _ChoiceTitleLineEdit: LineEdit = self.get_node("HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer/ChoiceTitleLineEdit")
onready var _ChoiceLabel: Label = self.get_node("HBoxContainer/MarginContainer/VBoxContainer/ChoiceLabel")
onready var _Infobox: Infobox = self.get_node("HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/Infobox")
onready var _ConditionsList: ConditionsList = self.get_node("HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/MarginContainer/ConditionsList")
var _id : int = 0;
var _json_structure := {
"title": "",
"conditions": []
}
#Callback Methods
func _on_ChoiceTitleLineEdit_text_changed(new_text):
_json_structure.title = new_text
_emit_changed_signal()
func _on_ChoiceRemoveButton_pressed():
emit_signal("choice_removed", _id)
func _on_ConditionsList_conditions_changed(new_json_structure):
_json_structure.conditions = new_json_structure
_emit_changed_signal()
func _on_Infobox_infobox_removed():
_json_structure.erase("infobox")
_emit_changed_signal()
func _on_Infobox_infobox_changed(new_json_structure):
_json_structure.infobox = new_json_structure
_emit_changed_signal()
#Public Methods
func set_structure(new_json_structure):
_json_structure = new_json_structure
_ChoiceTitleLineEdit.set_text(_json_structure.title)
if ("infobox" in _json_structure):
_Infobox.set_structure(_json_structure.infobox)
_ConditionsList.set_structure(_json_structure.conditions)
func set_id(new_id):
self._id = new_id;
_ChoiceLabel.set_text("Choice #" + str(new_id + 1))
#Private Methods
func _emit_changed_signal():
emit_signal("choice_changed", _id, _json_structure)

View file

@ -1,107 +0,0 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/Choice/Choice.gd" type="Script" id=1]
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/ConditionsList.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Infobox/Infobox.tscn" type="PackedScene" id=3]
[node name="Choice" type="VBoxContainer"]
margin_right = 272.0
margin_bottom = 156.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer" type="HBoxContainer" parent="."]
margin_right = 272.0
margin_bottom = 230.0
[node name="MarginContainer" type="MarginContainer" parent="HBoxContainer"]
margin_right = 272.0
margin_bottom = 230.0
size_flags_horizontal = 3
custom_constants/margin_right = 5
custom_constants/margin_top = 5
custom_constants/margin_left = 5
custom_constants/margin_bottom = 5
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/MarginContainer"]
margin_left = 5.0
margin_top = 5.0
margin_right = 267.0
margin_bottom = 225.0
size_flags_horizontal = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ChoiceLabel" type="Label" parent="HBoxContainer/MarginContainer/VBoxContainer"]
margin_right = 262.0
margin_bottom = 14.0
text = "Choice #1"
align = 1
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/MarginContainer/VBoxContainer"]
margin_top = 18.0
margin_right = 262.0
margin_bottom = 220.0
[node name="HBoxContainer2" type="HBoxContainer" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer"]
margin_right = 262.0
margin_bottom = 202.0
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2"]
margin_right = 238.0
margin_bottom = 202.0
size_flags_horizontal = 3
[node name="HBoxContainer" type="HBoxContainer" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
margin_right = 238.0
margin_bottom = 24.0
size_flags_horizontal = 3
[node name="ChoiceTitleLabel" type="Label" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer"]
margin_top = 5.0
margin_right = 32.0
margin_bottom = 19.0
text = "Title:"
[node name="ChoiceTitleLineEdit" type="LineEdit" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer"]
margin_left = 36.0
margin_right = 238.0
margin_bottom = 24.0
size_flags_horizontal = 3
[node name="Infobox" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer" instance=ExtResource( 3 )]
margin_bottom = 164.0
[node name="MarginContainer" type="MarginContainer" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
margin_top = 168.0
margin_right = 238.0
margin_bottom = 202.0
custom_constants/margin_right = 5
custom_constants/margin_top = 5
custom_constants/margin_left = 5
custom_constants/margin_bottom = 5
[node name="ConditionsList" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/MarginContainer" instance=ExtResource( 2 )]
margin_bottom = 29.0
[node name="ChoiceRemoveButton" type="Button" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2"]
margin_left = 242.0
margin_right = 262.0
margin_bottom = 202.0
text = "X"
[node name="HSeparator" type="HSeparator" parent="."]
margin_top = 234.0
margin_right = 272.0
margin_bottom = 238.0
[connection signal="text_changed" from="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer/ChoiceTitleLineEdit" to="." method="_on_ChoiceTitleLineEdit_text_changed"]
[connection signal="infobox_changed" from="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/Infobox" to="." method="_on_Infobox_infobox_changed"]
[connection signal="infobox_removed" from="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/Infobox" to="." method="_on_Infobox_infobox_removed"]
[connection signal="conditions_changed" from="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/MarginContainer/ConditionsList" to="." method="_on_ConditionsList_conditions_changed"]
[connection signal="pressed" from="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/ChoiceRemoveButton" to="." method="_on_ChoiceRemoveButton_pressed"]

View file

@ -1,74 +0,0 @@
tool
extends VBoxContainer
class_name ChoicesList
signal choices_changed(new_json_structure)
var _choice_scene = preload("res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/Choice/Choice.tscn")
onready var _VBoxContainer: VBoxContainer = self.get_node("VBoxContainer")
var _json_structure: Array = []
var _nodes: Array = []
#Callback Methods
func _on_choice_changed(index, new_structure):
_json_structure[index] = new_structure
_emit_changed_signal()
func _on_choice_removed(index):
_json_structure.remove(index)
_remove_choice_node(index)
_emit_changed_signal()
func _on_ChoiceAddButton_pressed():
add_choice()
#Public Methods
func add_choice():
_json_structure.append({
"title": "",
"conditions": []
})
_add_choice_node(_json_structure.size() - 1)
_emit_changed_signal()
func set_structure(new_json_structure):
_json_structure = new_json_structure
_clear_choice_nodes()
for i in range(0, _json_structure.size()):
var node: Choice = _add_choice_node(i)
node.set_structure(_json_structure[i])
#Private Methods
func _emit_changed_signal():
emit_signal("choices_changed", _json_structure)
func _add_choice_node(id: int):
var node: Choice = _choice_scene.instance()
_VBoxContainer.add_child(node)
node.set_id(id)
_nodes.append(node)
node.connect("choice_changed", self, "_on_choice_changed")
node.connect("choice_removed", self, "_on_choice_removed")
return node
func _remove_choice_node(index):
# Remove the node
if (index >= 0 and index < _nodes.size()):
_nodes[index].queue_free()
_nodes.remove(index)
# Update remaining nodes indexes
for i in range(0, _nodes.size()):
_nodes[i].set_id(i)
func _clear_choice_nodes():
_nodes.clear()
for node in _VBoxContainer.get_children():
node.queue_free()

View file

@ -1,23 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/ChoicesList.gd" type="Script" id=2]
[node name="ChoicesList" type="VBoxContainer"]
margin_top = 242.0
margin_right = 272.0
margin_bottom = 422.0
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_right = 272.0
size_flags_horizontal = 3
[node name="ChoiceAddButton" type="Button" parent="."]
margin_top = 4.0
margin_right = 272.0
margin_bottom = 24.0
text = "Add choice"
[connection signal="pressed" from="ChoiceAddButton" to="." method="_on_ChoiceAddButton_pressed"]

View file

@ -1,47 +0,0 @@
tool
extends VBoxContainer
class_name Condition
signal condition_changed(index, new_json_structure)
signal condition_removed(index)
onready var _ConditionLabel: Label = self.get_node("ContitionLabel")
onready var _ContitionNameLineEdit: LineEdit = self.get_node("HBoxContainer2/ContitionNameLineEdit")
onready var _ContitionValueSpinBox: SpinBox = self.get_node("HBoxContainer2/ContitionValueSpinBox")
var _id : int = 0;
var _json_structure = {
"id": "",
"value": 0
}
#Callback Methods
func _on_ContitionNameLineEdit_text_changed(new_text):
_json_structure.id = new_text
emit_signal("condition_changed", _id, _json_structure)
func _on_ContitionValueSpinBox_value_changed(value):
_json_structure.value = value
emit_signal("condition_changed", _id, _json_structure)
func _on_ContitionRemoveButton_pressed():
emit_signal("condition_removed", _id)
#Public Methods
func set_structure(new_json_structure):
_json_structure = new_json_structure
_ContitionNameLineEdit.text = _json_structure.id
_ContitionValueSpinBox.value = _json_structure.value
func set_id(new_id):
self._id = new_id;
_ConditionLabel.set_text("Condition #" + str(new_id + 1))

View file

@ -1,50 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/Condition/Condition.gd" type="Script" id=1]
[node name="Condition" type="VBoxContainer"]
margin_right = 228.0
margin_bottom = 50.0
size_flags_horizontal = 3
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HSeparator2" type="HSeparator" parent="."]
margin_right = 228.0
margin_bottom = 4.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ContitionLabel" type="Label" parent="."]
margin_top = 8.0
margin_right = 228.0
margin_bottom = 22.0
text = "Condition #1"
[node name="HBoxContainer2" type="HBoxContainer" parent="."]
margin_top = 26.0
margin_right = 228.0
margin_bottom = 50.0
size_flags_horizontal = 3
[node name="ContitionNameLineEdit" type="LineEdit" parent="HBoxContainer2"]
margin_right = 127.0
margin_bottom = 24.0
size_flags_horizontal = 3
[node name="ContitionValueSpinBox" type="SpinBox" parent="HBoxContainer2"]
margin_left = 131.0
margin_right = 205.0
margin_bottom = 24.0
[node name="ContitionRemoveButton" type="Button" parent="HBoxContainer2"]
margin_left = 209.0
margin_right = 228.0
margin_bottom = 24.0
text = "x"
[connection signal="text_changed" from="HBoxContainer2/ContitionNameLineEdit" to="." method="_on_ContitionNameLineEdit_text_changed"]
[connection signal="value_changed" from="HBoxContainer2/ContitionValueSpinBox" to="." method="_on_ContitionValueSpinBox_value_changed"]
[connection signal="pressed" from="HBoxContainer2/ContitionRemoveButton" to="." method="_on_ContitionRemoveButton_pressed"]

View file

@ -1,69 +0,0 @@
tool
extends VBoxContainer
class_name ConditionsList
signal conditions_changed(new_json_structure)
var _condition_scene = preload("res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/Condition/Condition.tscn")
onready var _VBoxContainer = self.get_node("VBoxContainer")
var _json_structure = []
var _nodes = []
#Callback Methods
func _on_condition_changed(index, new_structure):
_json_structure[index] = new_structure
_emit_changed_signal()
func _on_condition_removed(index):
_json_structure.remove(index)
_remove_choice_node(index)
_emit_changed_signal()
func _on_ContitionAddButton_pressed():
add_condition(
{
"id": "",
"value": 0
},
_json_structure.size() - 1
)
#Public Methods
func set_structure(new_json_structure):
_json_structure = new_json_structure
for i in range(0, _json_structure.size()):
add_condition(_json_structure[0], i)
func add_condition(structure: Dictionary, id: int):
_json_structure.append(structure)
_add_choice_node(structure, id)
_emit_changed_signal()
#Private Methods
func _emit_changed_signal():
emit_signal("conditions_changed", _json_structure)
func _add_choice_node(structure: Dictionary, id: int):
var node: Condition = _condition_scene.instance()
_VBoxContainer.add_child(node)
node.set_id(id)
node.set_structure(structure)
_nodes.append(node)
node.connect("condition_changed", self, "_on_condition_changed")
node.connect("condition_removed", self, "_on_condition_removed")
return node
func _remove_choice_node(index):
# Remove the node
_nodes[index].queue_free()
_nodes.remove(index)
# Update remaining nodes indexes
for i in range(0, _nodes.size()):
_nodes[i].set_id(i)

View file

@ -1,25 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/ConditionsList.gd" type="Script" id=1]
[node name="ConditionsList" type="VBoxContainer"]
margin_left = 5.0
margin_top = 5.0
margin_right = 233.0
margin_bottom = 79.0
size_flags_horizontal = 3
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_right = 228.0
size_flags_horizontal = 3
[node name="ContitionAddButton" type="Button" parent="."]
margin_top = 4.0
margin_right = 228.0
margin_bottom = 24.0
text = "Add condition"
[connection signal="pressed" from="ContitionAddButton" to="." method="_on_ContitionAddButton_pressed"]

View file

@ -1,68 +0,0 @@
tool
extends VBoxContainer
class_name Infobox
signal infobox_changed(new_json_structure)
signal infobox_removed()
onready var _TextEdit: TextEdit = self.get_node("HBoxContainer/VBoxContainer/TextEdit")
onready var _CreateButton: Button = self.get_node("CreateButton")
onready var _HBoxContainer: HBoxContainer = self.get_node("HBoxContainer")
onready var _ConditionsList: ConditionsList = self.get_node("HBoxContainer/VBoxContainer/ConditionsList")
var _json_structure = {
"text": "",
"conditions": []
}
#Virtual Methods
func _ready():
_CreateButton.show()
_HBoxContainer.hide()
#Callback Methods
func _on_RemoveInfoboxButton_pressed():
_disable_infobox()
emit_signal("infobox_removed")
func _on_ConditionsList_conditions_changed(new_json_structure):
_json_structure.conditions = new_json_structure
_emit_changed_signal()
func _on_TextEdit_text_changed():
_json_structure.text = self._TextEdit.get_text()
_emit_changed_signal()
func _on_CreateButton_pressed():
_enable_infobox()
_emit_changed_signal()
#Public Methods
func set_structure(new_json_structure):
_json_structure = new_json_structure
_TextEdit.set_text(_json_structure.text)
_ConditionsList.set_structure(_json_structure.conditions)
_enable_infobox()
#Private Methods
func _enable_infobox():
_CreateButton.hide()
_HBoxContainer.show()
func _disable_infobox():
_CreateButton.show()
_HBoxContainer.hide()
func _emit_changed_signal():
emit_signal("infobox_changed", _json_structure)

View file

@ -1,67 +0,0 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Infobox/Infobox.gd" type="Script" id=1]
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/ConditionsList.tscn" type="PackedScene" id=2]
[node name="Infobox" type="VBoxContainer"]
margin_top = 28.0
margin_right = 238.0
margin_bottom = 112.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer" type="HBoxContainer" parent="."]
margin_right = 238.0
margin_bottom = 112.0
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"]
margin_right = 215.0
margin_bottom = 112.0
size_flags_horizontal = 3
[node name="HSeparator" type="HSeparator" parent="HBoxContainer/VBoxContainer"]
margin_right = 215.0
margin_bottom = 4.0
[node name="Label" type="Label" parent="HBoxContainer/VBoxContainer"]
margin_top = 8.0
margin_right = 215.0
margin_bottom = 22.0
text = "Infobox"
align = 1
[node name="TextEdit" type="TextEdit" parent="HBoxContainer/VBoxContainer"]
margin_top = 26.0
margin_right = 215.0
margin_bottom = 76.0
rect_min_size = Vector2( 0, 50 )
size_flags_horizontal = 3
[node name="ConditionsList" parent="HBoxContainer/VBoxContainer" instance=ExtResource( 2 )]
margin_left = 0.0
margin_top = 80.0
margin_right = 215.0
margin_bottom = 104.0
[node name="HSeparator2" type="HSeparator" parent="HBoxContainer/VBoxContainer"]
margin_top = 108.0
margin_right = 215.0
margin_bottom = 112.0
[node name="RemoveInfoboxButton" type="Button" parent="HBoxContainer"]
margin_left = 219.0
margin_right = 238.0
margin_bottom = 112.0
text = "x"
[node name="CreateButton" type="Button" parent="."]
margin_top = 116.0
margin_right = 238.0
margin_bottom = 136.0
text = "Create Infobox"
[connection signal="text_changed" from="HBoxContainer/VBoxContainer/TextEdit" to="." method="_on_TextEdit_text_changed"]
[connection signal="conditions_changed" from="HBoxContainer/VBoxContainer/ConditionsList" to="." method="_on_ConditionsList_conditions_changed"]
[connection signal="pressed" from="HBoxContainer/RemoveInfoboxButton" to="." method="_on_RemoveInfoboxButton_pressed"]
[connection signal="pressed" from="CreateButton" to="." method="_on_CreateButton_pressed"]

View file

@ -1,201 +0,0 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/line_node.gd" type="Script" id=1]
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/icon_distraction_free.svg" type="Texture" id=2]
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/ChoicesList.tscn" type="PackedScene" id=3]
[node name="Line" type="GraphNode"]
margin_right = 324.0
margin_bottom = 375.0
rect_min_size = Vector2( 324, 137 )
title = "Line"
offset = Vector2( 40, 40 )
show_close = true
resizable = true
slot/0/left_enabled = true
slot/0/left_type = 0
slot/0/left_color = Color( 1, 1, 1, 1 )
slot/0/right_enabled = true
slot/0/right_type = 0
slot/0/right_color = Color( 1, 1, 1, 1 )
slot/1/left_enabled = false
slot/1/left_type = 0
slot/1/left_color = Color( 1, 1, 1, 1 )
slot/1/right_enabled = false
slot/1/right_type = 0
slot/1/right_color = Color( 1, 1, 1, 1 )
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MarginContainer" type="MarginContainer" parent="."]
margin_left = 16.0
margin_top = 39.0
margin_right = 308.0
margin_bottom = 329.0
custom_constants/margin_right = 10
custom_constants/margin_top = 10
custom_constants/margin_left = 10
custom_constants/margin_bottom = 10
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
margin_left = 10.0
margin_top = 10.0
margin_right = 282.0
margin_bottom = 280.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer3" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
margin_right = 272.0
margin_bottom = 70.0
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer3"]
margin_right = 272.0
margin_bottom = 70.0
size_flags_horizontal = 3
[node name="SpeakerLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer"]
margin_right = 272.0
margin_bottom = 14.0
text = "Speaker"
align = 1
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer"]
margin_left = 89.0
margin_top = 18.0
margin_right = 183.0
margin_bottom = 42.0
size_flags_horizontal = 4
[node name="SpeakerIdLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer"]
margin_top = 5.0
margin_right = 16.0
margin_bottom = 19.0
text = "id:"
[node name="SpeakerIdSpinBox" type="SpinBox" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer"]
margin_left = 20.0
margin_right = 94.0
margin_bottom = 24.0
[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer"]
margin_top = 46.0
margin_right = 272.0
margin_bottom = 70.0
[node name="SpeakerEmotionLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer2"]
margin_top = 5.0
margin_right = 57.0
margin_bottom = 19.0
text = "Emotion:"
[node name="SpeakerEmotionLineEdit" type="LineEdit" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer2"]
margin_left = 61.0
margin_right = 272.0
margin_bottom = 24.0
size_flags_horizontal = 3
[node name="HSeparator" type="HSeparator" parent="MarginContainer/VBoxContainer"]
margin_top = 74.0
margin_right = 272.0
margin_bottom = 78.0
[node name="HBoxContainer4" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
margin_top = 82.0
margin_right = 272.0
margin_bottom = 124.0
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer4"]
margin_right = 272.0
margin_bottom = 42.0
size_flags_horizontal = 3
[node name="SceneLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer"]
margin_right = 272.0
margin_bottom = 14.0
text = "Scene"
align = 1
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer"]
margin_left = 89.0
margin_top = 18.0
margin_right = 183.0
margin_bottom = 42.0
size_flags_horizontal = 4
[node name="SceneIdLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/HBoxContainer"]
margin_top = 5.0
margin_right = 16.0
margin_bottom = 19.0
text = "id:"
[node name="SceneIdSpinBox" type="SpinBox" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/HBoxContainer"]
margin_left = 20.0
margin_right = 94.0
margin_bottom = 24.0
[node name="HSeparator2" type="HSeparator" parent="MarginContainer/VBoxContainer"]
margin_top = 128.0
margin_right = 272.0
margin_bottom = 132.0
[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
margin_top = 136.0
margin_right = 272.0
margin_bottom = 234.0
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
margin_right = 272.0
margin_bottom = 98.0
size_flags_horizontal = 3
[node name="DialogLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
margin_right = 272.0
margin_bottom = 14.0
text = "Message"
align = 1
[node name="MessageTextEdit" type="TextEdit" parent="MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
margin_top = 18.0
margin_right = 272.0
margin_bottom = 98.0
rect_min_size = Vector2( 256, 80 )
size_flags_horizontal = 3
size_flags_vertical = 3
smooth_scrolling = true
[node name="Editor_BTN" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
visible = false
margin_left = 260.0
margin_right = 292.0
margin_bottom = 82.0
rect_min_size = Vector2( 32, 0 )
hint_tooltip = "Expand this node's text editor."
icon = ExtResource( 2 )
expand_icon = true
[node name="HSeparator3" type="HSeparator" parent="MarginContainer/VBoxContainer"]
margin_top = 238.0
margin_right = 272.0
margin_bottom = 242.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ChoicesList" parent="MarginContainer/VBoxContainer" instance=ExtResource( 3 )]
margin_top = 246.0
margin_bottom = 270.0
[connection signal="close_request" from="." to="." method="_on_Line_close_request"]
[connection signal="offset_changed" from="." to="." method="_on_Line_offset_changed"]
[connection signal="resize_request" from="." to="." method="_on_Line_resize_request"]
[connection signal="value_changed" from="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer/SpeakerIdSpinBox" to="." method="_on_SpeakerIdSpinBox_value_changed"]
[connection signal="text_changed" from="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer2/SpeakerEmotionLineEdit" to="." method="_on_SpeakerEmotionLineEdit_text_changed"]
[connection signal="value_changed" from="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/HBoxContainer/SceneIdSpinBox" to="." method="_on_SceneIdSpinBox_value_changed"]
[connection signal="text_changed" from="MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer/MessageTextEdit" to="." method="_on_MessageTextEdit_text_changed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer2/Editor_BTN" to="." method="_on_Editor_BTN_pressed"]
[connection signal="choices_changed" from="MarginContainer/VBoxContainer/ChoicesList" to="." method="_on_ChoicesList_choices_changed"]

View file

@ -1 +0,0 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1 1v5l1.793-1.793 2.5 2.5 1.4141-1.4141-2.5-2.5 1.793-1.793h-5zm9 0 1.793 1.793-2.5 2.5 1.4141 1.4141 2.5-2.5 1.793 1.793v-5h-5zm-4.707 8.293-2.5 2.5-1.793-1.793v5h5l-1.793-1.793 2.5-2.5-1.4141-1.4141zm5.4141 0-1.4141 1.4141 2.5 2.5-1.793 1.793h5v-5l-1.793 1.793-2.5-2.5z" fill="#e0e0e0"/></svg>

Before

Width:  |  Height:  |  Size: 388 B

View file

@ -1,34 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon_distraction_free.svg-5120bf5545890a3868c1108c903f7cd9.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/icon_distraction_free.svg"
dest_files=[ "res://.import/icon_distraction_free.svg-5120bf5545890a3868c1108c903f7cd9.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View file

@ -1,184 +0,0 @@
tool
extends GraphNode
class_name LineNode
signal changed_offset(nid, vec2)
signal changed_size(this)
signal changed_slots(this)
signal erased(this)
signal pressed_editor(this)
signal pressed_load(this)
signal pressed_save(this)
signal text_changed(nid, new_text)
onready var _SpeakerIdSpinBox: SpinBox = self.get_node("MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer/SpeakerIdSpinBox")
onready var _SpeakerEmotionLineEdit: LineEdit = self.get_node("MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer2/SpeakerEmotionLineEdit")
onready var _SceneIdSpinBox: SpinBox = self.get_node("MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/HBoxContainer/SceneIdSpinBox")
onready var _MessageTextEdit : TextEdit= self.get_node("MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer/MessageTextEdit")
onready var _ChoicesList: ChoicesList = self.get_node("MarginContainer/VBoxContainer/ChoicesList")
var _nid : int = 0
var _slot_amount : int = 1
var json_structure = {
"speaker": {
"id": 0,
"emotion": "happy"
},
"scene": {
"id": 0
},
"dialog": {
"message": "",
"choices_multiple": []
}
}
#Virtual Methods
func _ready():
self._update_slots()
#Callback Methods
func _on_Editor_BTN_pressed():
self.emit_signal("pressed_editor", self)
func _on_Line_close_request():
self.emit_signal("erased", self)
func _on_Line_offset_changed():
self.emit_signal("changed_offset", self._nid, self.offset)
func _on_Line_resize_request(new_minsize):
self.rect_size = new_minsize
self.emit_signal("changed_size", self)
func _on_Load_BTN_pressed():
self.emit_signal("pressed_load", self)
func _on_Save_BTN_pressed():
self.emit_signal("pressed_save", self)
func _on_MessageTextEdit_text_changed():
json_structure.dialog.message = self._MessageTextEdit.text
_emit_text()
func _on_SceneIdSpinBox_value_changed(value):
json_structure.scene.id = value
_emit_text()
func _on_SpeakerEmotionLineEdit_text_changed(new_text):
json_structure.speaker.emotion = new_text
_emit_text()
func _on_SpeakerIdSpinBox_value_changed(value):
json_structure.speaker.id = value
_emit_text()
func _on_ChoicesList_choices_changed(new_json_structure):
json_structure.dialog.choices_multiple = new_json_structure
var slot_number = json_structure.dialog.choices_multiple.size()
# Always have at least one slot
if slot_number == 0:
slot_number = 1
if (self.get_slot_amount() != slot_number):
self.set_slot_amount(slot_number)
self._update_slots()
self.emit_signal("changed_slots", self)
else:
_update_slots_labels()
_emit_text()
#Public Methods
func get_nid() -> int:
return self._nid
func get_slot_amount() -> int:
return self._slot_amount
func get_text() -> String:
return JSON.print(json_structure, "\t")
func set_nid(new_nid):
self._nid = new_nid
var new_name = "NID " + str(new_nid)
self.title = new_name
self.name = new_name
func set_slot_amount(new_amount : int):
self._slot_amount = new_amount
func set_text(new_text : String):
json_structure = JSON.parse(new_text).get_result()
_update_components()
_emit_text()
#Private Methods
func _update_components():
_SpeakerIdSpinBox.set_value(json_structure.speaker.id)
_SpeakerEmotionLineEdit.set_text(json_structure.speaker.emotion);
_SceneIdSpinBox.set_value(json_structure.scene.id)
_MessageTextEdit.set_text(json_structure.dialog.message)
_ChoicesList.set_structure(json_structure.dialog.choices_multiple)
func _emit_text():
self.emit_signal("text_changed", self._nid, get_text())
func _clear_link_labels():
var children = self.get_children()
for child in children:
if child is Label:
child.queue_free()
func _update_slots_labels():
for slot in range(0, self.get_slot_amount()):
var output_link_label = self.get_children()[slot]
if (output_link_label is Label):
output_link_label.text = self._get_choice_name(slot)
func _get_choice_name(index):
var choices: Array = json_structure.dialog.choices_multiple;
if (choices.size() > 0):
return choices[index].title
else:
return "Next"
func _update_slots():
self.clear_all_slots()
self._clear_link_labels()
self.set_slot(0, true, 0, Color(1.0, 1.0, 1.0, 1.0), true, 0, Color(1.0, 1.0, 1.0, 1.0), null, null)
var base_link_label = Label.new()
base_link_label.text = self._get_choice_name(0)
base_link_label.align = Label.ALIGN_RIGHT
self.add_child(base_link_label)
self.move_child(base_link_label, 0)
var last_output_link_label = base_link_label
for slot in range(1, self._slot_amount):
self.set_slot(slot, false, 0, Color(1.0, 1.0, 1.0, 1.0), true, 0, Color(1.0, 1.0, 1.0, 1.0), null, null)
var output_link_label = Label.new()
output_link_label.text = self._get_choice_name(slot)
output_link_label.align = Label.ALIGN_RIGHT
self.add_child_below_node(last_output_link_label, output_link_label)
last_output_link_label = output_link_label

View file

@ -1,224 +0,0 @@
tool
extends Control
signal back_BTN_pressed
signal close_BTN_pressed
onready var _Graph = self.get_node("VBoxContainer/GraphEdit")
onready var _Human_Readable_LBL = self.get_node("VBoxContainer/VBoxContainer/Human_Readable_LBL")
var _Editor_TSCN = preload("res://addons/EXP-System-Dialog/Dialog Editor/Editor/Editor.tscn")
var _LineNode = preload("res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Line_Node.tscn")
var _NodeTemplate= preload("res://addons/EXP-System-Dialog/Resource_NodeTemplate/EXP_NodeTemplate.gd")
var _did : int = -1
var _Editor
var _Load_Template : EditorFileDialog
var _Save_Template_As : EditorFileDialog
var _Story_Editor
var _Target_Node
#Virtual Methods
func _ready():
self._setup_dialogs()
self._Editor = _Editor_TSCN.instance()
self.add_child(self._Editor)
#Callback Methods
func _on_Add_Node_BTN_pressed():
var new_nid = self._Story_Editor.create_node(self._did, "line")
var new_line_node = self._LineNode.instance()
new_line_node.offset += self._Graph.scroll_offset
new_line_node.set_nid(new_nid)
new_line_node.connect("erased", self, "_on_Node_erased")
new_line_node.connect("changed_offset", self, "_on_Node_changed_offset")
new_line_node.connect("text_changed", self, "_on_Node_text_changed")
new_line_node.connect("pressed_save", self, "_on_Node_pressed_save")
new_line_node.connect("pressed_load", self, "_on_Node_pressed_load")
new_line_node.connect("pressed_editor", self, "_on_Node_pressed_editor")
new_line_node.connect("changed_slots", self, "_on_Node_changed_slots")
new_line_node.connect("changed_size", self, "_on_Node_changed_size")
var slot_count = self._Story_Editor.get_node_property(self._did, new_nid, "slot_amount")
self._Story_Editor.set_node_property(self._did, new_nid, "rect_size", new_line_node.rect_size)
new_line_node.set_slot_amount(slot_count)
self._Graph.add_child(new_line_node)
func _on_Back_BTN_pressed():
self.emit_signal("back_BTN_pressed")
func _on_Close_BTN_pressed():
self.emit_signal("close_BTN_pressed")
func _on_GraphEdit_connection_request(from, from_slot, to, to_slot):
self._Graph.connect_node(from, from_slot, to, to_slot)
var from_node = self._Graph.get_node(from)
var to_node = self._Graph.get_node(to)
var from_node_nid = from_node.get_nid()
var to_node_nid = to_node.get_nid()
self._Story_Editor.set_link(self._did, from_node_nid, from_slot, to_node_nid)
func _on_GraphEdit_disconnection_request(from, from_slot, to, to_slot):
self._Graph.disconnect_node(from, from_slot, to, to_slot)
var from_node = self._Graph.get_node(from)
var from_node_nid = from_node.get_nid()
self._Story_Editor.erase_link(self._did, from_node_nid, from_slot)
func _on_Load_Template_file_selected(filename):
var file_data = load(filename)
if not file_data.TYPE == "EXP_Dialog_Node_Template_editor":
return
self._Target_Node.set_text(file_data.template)
func _on_Node_changed_offset(nid, new_offset):
self._Story_Editor.set_node_property(self._did, nid, "graph_offset", new_offset)
func _on_Node_changed_size(changed_node):
var changed_node_nid = changed_node.get_nid()
self._Story_Editor.set_node_property(self._did, changed_node_nid, "rect_size", changed_node.rect_size)
func _on_Node_changed_slots(changed_node):
var changed_node_nid = changed_node.get_nid()
self._unlink_nid_from_story(changed_node_nid)
self._disconnect_all_from(changed_node)
self._Story_Editor.set_node_property(self._did, changed_node_nid, "slot_amount",
changed_node.get_slot_amount())
func _on_Node_erased(deleted_node):
var deleted_nid = deleted_node.get_nid()
self._unlink_nid_from_story(deleted_nid)
self._Story_Editor.erase_node(self._did, deleted_nid)
self._disconnect_all_from(deleted_node)
deleted_node.queue_free()
func _on_Node_pressed_editor(node):
self._Editor.set_target_node(node)
self._Editor.visible = true
func _on_Node_pressed_load(node):
self._Target_Node = node
self._Load_Template.popup_centered_ratio(0.7)
func _on_Node_pressed_save(node):
self._Target_Node = node
self._Save_Template_As.popup_centered_ratio(0.7)
func _on_Node_text_changed(nid, new_text):
self._Story_Editor.set_node_property(self._did, nid, "text", new_text)
func _on_Save_Template_As_file_selected(filename):
var save_file = _NodeTemplate.new()
save_file.template = self._Target_Node.get_text()
ResourceSaver.save(filename, save_file)
func _on_Story_Editor_dialog_edit_pressed(story_editor, did : int):
self._Story_Editor = story_editor
self._did = did
self._Human_Readable_LBL.text = self._Story_Editor.get_dialog_property(self._did, "human_readable_description")
self._clear_nodes()
self._populate_graph()
self._link_node_connections()
#Private Methods
func _clear_nodes():
self._Graph.clear_connections()
var children = self._Graph.get_children()
for child in children:
if child is GraphNode:
child.free()
func _disconnect_all_from(node):
var node_name = node.name
var connection_list = self._Graph.get_connection_list()
for connection in connection_list:
if connection["from"] == node.name or connection["to"] == node.name:
self._Graph.disconnect_node(connection["from"], connection["from_port"],
connection["to"], connection["to_port"])
func _link_node_connections():
var node_IDs = self._Story_Editor.get_nids(self._did)
for nID in node_IDs:
var slots = self._Story_Editor.get_link_slots(self._did, nID)
for slot in slots:
var to_node_nid = self._Story_Editor.get_nid_link_from(self._did, nID, slot)
var to = "NID " + str(to_node_nid)
var from = "NID " + str(nID)
self._Graph.connect_node(from, slot, to, 0)
func _populate_graph():
var node_IDs = self._Story_Editor.get_nids(self._did)
for nID in node_IDs:
var new_node : GraphNode
match self._Story_Editor.get_node_property(self._did, nID, "type"):
"line":
new_node = _LineNode.instance()
var slot_count = self._Story_Editor.get_node_property(self._did, nID, "slot_amount")
new_node.set_slot_amount(slot_count)
self._Graph.add_child(new_node)
new_node.connect("erased", self, "_on_Node_erased")
var new_text = self._Story_Editor.get_node_property(self._did, nID, "text")
var new_rect_size = self._Story_Editor.get_node_property(self._did, nID, "rect_size")
new_node.rect_size = new_rect_size
new_node.set_text(new_text)
new_node.connect("text_changed", self, "_on_Node_text_changed")
new_node.connect("pressed_save", self, "_on_Node_pressed_save")
new_node.connect("pressed_load", self, "_on_Node_pressed_load")
new_node.connect("pressed_editor", self, "_on_Node_pressed_editor")
new_node.connect("changed_slots", self, "_on_Node_changed_slots")
new_node.connect("changed_size", self, "_on_Node_changed_size")
new_node.set_nid(nID)
new_node.offset = self._Story_Editor.get_node_property(self._did, nID, "graph_offset")
new_node.connect("changed_offset", self, "_on_Node_changed_offset")
func _setup_dialogs():
self._Load_Template = EditorFileDialog.new()
self._Load_Template.mode = EditorFileDialog.MODE_OPEN_FILE
self._Load_Template.add_filter("*.res ; Template files")
self._Load_Template.resizable = true
self._Load_Template.access = EditorFileDialog.ACCESS_RESOURCES
self._Load_Template.current_dir = "res://"
self._Load_Template.connect("file_selected", self, "_on_Load_Template_file_selected")
self.add_child(self._Load_Template)
self._Save_Template_As = EditorFileDialog.new()
self._Save_Template_As.mode = EditorFileDialog.MODE_SAVE_FILE
self._Save_Template_As.add_filter("*.res ; Template files")
self._Save_Template_As.resizable = true
self._Save_Template_As.access = EditorFileDialog.ACCESS_RESOURCES
self._Save_Template_As.current_dir = "res://"
self._Save_Template_As.connect("file_selected", self, "_on_Save_Template_As_file_selected")
self.add_child(self._Save_Template_As)
func _unlink_nid_from_story(removed_nid):
self._Story_Editor.erase_all_links(self._did, removed_nid)
var nIDs = self._Story_Editor.get_nids(self._did)
for nID in nIDs:
var node_slots = self._Story_Editor.get_link_slots(self._did, nID)
for slot in node_slots:
var to_node_nid = self._Story_Editor.get_nid_link_from(self._did, nID, slot)
if to_node_nid == removed_nid:
self._Story_Editor.erase_link(self._did, nID, slot)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

View file

@ -1,34 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/de.png-fbe4565917c56d102e03dea598024725.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/EXP-System-Dialog/Images/de.png"
dest_files=[ "res://.import/de.png-fbe4565917c56d102e03dea598024725.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 701 B

View file

@ -1,34 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-47dc6e8cad94817cb2e2b72e131ff5fa.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/EXP-System-Dialog/Images/icon.png"
dest_files=[ "res://.import/icon.png-47dc6e8cad94817cb2e2b72e131ff5fa.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

View file

@ -1,34 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/se.png-e2b4f76b280be2edfdda792d18e61fd1.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/EXP-System-Dialog/Images/se.png"
dest_files=[ "res://.import/se.png-e2b4f76b280be2edfdda792d18e61fd1.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View file

@ -1,83 +0,0 @@
extends Reference
var _story : Dictionary = {}
var _names : Dictionary = {}
func get_dids() -> Array:
return self._story.keys()
func get_did_via_record_name(name : String) -> int:
assert(self._names.has(name))
return self._names[name]
func get_nid_from_slot(did : int, nid : int, slot : int) -> int:
assert(self.has_did(did))
assert(self.has_nid(did, nid))
assert(self.has_slot(did, nid, slot))
return self._story[did]["nodes"][nid]["links"][slot]
func get_nid_via_exact_text(did : int, query : String) -> int:
assert(self.has_did(did))
for nid in self._story[did]["nodes"].keys():
if self._story[did]["nodes"][nid]["text"] == query:
return nid
return -1
func get_nids(did : int) -> Array:
assert(self.has_did(did))
return self._story[did]["nodes"].keys()
func get_slot_count(did : int, nid : int) -> int:
assert(self.has_did(did))
assert(self.has_nid(did, nid))
return self._story[did]["nodes"][nid]["links"].size()
func get_slots(did : int, nid : int) -> Array:
assert(self.has_did(did))
assert(self.has_nid(did, nid))
return self._story[did]["nodes"][nid]["links"].keys()
func get_text(did : int, nid : int) -> String:
assert(self.has_did(did))
assert(self.has_nid(did, nid))
return self._story[did]["nodes"][nid]["text"]
func has_did(did : int) -> bool:
return self._story.has(did)
func has_nid(did : int, nid : int) -> bool:
assert(self.has_did(did))
return self._story[did]["nodes"].has(nid)
func has_record_name(name : String) -> bool:
return self._names.has(name)
func has_slot(did: int, nid : int, slot : int) -> bool:
assert(self.has_did(did))
assert(self.has_nid(did, nid))
return self._story[did]["nodes"][nid]["links"].has(slot)
func read(file):
if not "TYPE" in file:
print_debug("Story reader failed to open file: ", str(file.filename))
return
if not file.TYPE == "EXP_Baked_Story" or file.TYPE == "EXP_Story_editor":
print_debug("Story reader failed to open file: ", str(file.filename))
return
self._story = file.story
self._names = file.names

View file

@ -1,6 +0,0 @@
tool
extends Resource
export(String) var TYPE = "EXP_Baked_Story"
export(Dictionary) var story : Dictionary
export(Dictionary) var names : Dictionary

View file

@ -1,9 +0,0 @@
tool
extends Resource
export(String) var TYPE = "EXP_Story_editor"
export(Dictionary) var names : Dictionary
export(Dictionary) var story : Dictionary
export(Array) var available_dids : Array
export(Array) var groups : Array

View file

@ -1,6 +0,0 @@
tool
extends Resource
var TYPE = "EXP_Dialog_Node_Template_editor"
export(String) var template

View file

@ -1,109 +0,0 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://addons/EXP-System-Dialog/Story Editor/Dialog Record/dialog_record.gd" type="Script" id=1]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.6, 0.6, 0.6, 0 )
border_color = Color( 0.8, 0.8, 0.8, 0 )
shadow_color = Color( 0, 0, 0, 0 )
[sub_resource type="StyleBoxFlat" id=2]
bg_color = Color( 0.6, 0.6, 0.6, 0 )
border_color = Color( 0.8, 0.8, 0.8, 0 )
shadow_color = Color( 0, 0, 0, 0 )
[node name="Dialog_Record" type="Control"]
anchor_right = 1.0
rect_min_size = Vector2( 0, 28 )
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ColorRect" type="ColorRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
rect_min_size = Vector2( 0, 24 )
size_flags_horizontal = 3
color = Color( 1, 1, 1, 0.12549 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer" type="HBoxContainer" parent="ColorRect"]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CheckBox" type="CheckBox" parent="ColorRect/HBoxContainer"]
margin_right = 24.0
margin_bottom = 28.0
[node name="DID_LBL" type="Label" parent="ColorRect/HBoxContainer"]
margin_left = 28.0
margin_top = 7.0
margin_right = 85.0
margin_bottom = 21.0
text = "DID: 101"
[node name="VSeparator" type="VSeparator" parent="ColorRect/HBoxContainer"]
margin_left = 89.0
margin_right = 93.0
margin_bottom = 28.0
[node name="Edit_BTN" type="Button" parent="ColorRect/HBoxContainer"]
margin_left = 97.0
margin_right = 138.0
margin_bottom = 28.0
hint_tooltip = "Edit this dialog record in the Dialog Editor."
text = "EDIT"
flat = true
[node name="VSeparator4" type="VSeparator" parent="ColorRect/HBoxContainer"]
margin_left = 142.0
margin_right = 146.0
margin_bottom = 28.0
[node name="Name_BTN" type="Button" parent="ColorRect/HBoxContainer"]
margin_left = 150.0
margin_right = 200.0
margin_bottom = 28.0
hint_tooltip = "Edit this dialog record in the Dialog Editor."
text = "NAME"
flat = true
[node name="VSeparator2" type="VSeparator" parent="ColorRect/HBoxContainer"]
margin_left = 204.0
margin_right = 208.0
margin_bottom = 28.0
[node name="Group_BTN" type="OptionButton" parent="ColorRect/HBoxContainer"]
margin_left = 212.0
margin_right = 274.0
margin_bottom = 28.0
hint_tooltip = "View groups applied to this dialog record."
text = "TAGS"
flat = true
[node name="VSeparator3" type="VSeparator" parent="ColorRect/HBoxContainer"]
margin_left = 278.0
margin_right = 282.0
margin_bottom = 28.0
[node name="Human_Readable_LineEdit" type="LineEdit" parent="ColorRect/HBoxContainer"]
margin_left = 286.0
margin_right = 476.0
margin_bottom = 28.0
custom_styles/focus = SubResource( 1 )
custom_styles/normal = SubResource( 2 )
text = "Human Readable Description"
expand_to_text_length = true
context_menu_enabled = false
[connection signal="toggled" from="ColorRect/HBoxContainer/CheckBox" to="." method="_on_CheckBox_toggled"]
[connection signal="pressed" from="ColorRect/HBoxContainer/Edit_BTN" to="." method="_on_Edit_BTN_pressed"]
[connection signal="pressed" from="ColorRect/HBoxContainer/Name_BTN" to="." method="_on_Name_BTN_pressed"]
[connection signal="pressed" from="ColorRect/HBoxContainer/Group_BTN" to="." method="_on_Group_BTN_pressed"]
[connection signal="focus_exited" from="ColorRect/HBoxContainer/Human_Readable_LineEdit" to="." method="_on_Human_Readable_LineEdit_focus_exited"]
[connection signal="text_changed" from="ColorRect/HBoxContainer/Human_Readable_LineEdit" to="." method="_on_Human_Readable_LineEdit_text_changed"]

View file

@ -1,91 +0,0 @@
tool
extends Control
signal changed_human_readable_text(did, text)
signal checked(this)
signal edit_pressed(did)
signal rename_pressed(this)
signal unchecked(this)
onready var _DID_LBL = self.get_node("ColorRect/HBoxContainer/DID_LBL")
onready var _Human_Readable_LineEdit = self.get_node("ColorRect/HBoxContainer/Human_Readable_LineEdit")
onready var _Group_List = self.get_node("ColorRect/HBoxContainer/Group_BTN")
onready var _Name_BTN = self.get_node("ColorRect/HBoxContainer/Name_BTN")
onready var _Select_CheckBox = self.get_node("ColorRect/HBoxContainer/CheckBox")
var _did : int = -1
var _Story_Editor
#Virtual Methods
func _ready():
self.update_human_readable_description("Human Readable Description")
#Callback Methods
func _on_CheckBox_toggled(button_pressed):
if button_pressed:
self.emit_signal("checked", self)
else:
self.emit_signal("unchecked", self)
func _on_Edit_BTN_pressed():
self.emit_signal("edit_pressed", self._did)
func _on_Group_BTN_pressed():
var groups = self._Story_Editor.dialog_get_groups(self._did)
self._Group_List.clear()
self._Group_List.text = "TAGS"
for group in groups:
self._Group_List.get_popup().add_item(group)
for idx in range(self._Group_List.get_item_count()):
self._Group_List.set_item_disabled(idx, true)
func _on_Human_Readable_LineEdit_focus_exited():
self._Human_Readable_LineEdit.deselect()
func _on_Human_Readable_LineEdit_text_changed(new_text):
self.emit_signal("changed_human_readable_text", self._did, new_text)
func _on_Name_BTN_pressed():
emit_signal("rename_pressed", self)
#Public Methods
func check():
self._Select_CheckBox.pressed = true
func get_did():
return self._did
func get_record_name():
return self._Name_BTN.text
func set_did(new_did : int):
self._did = new_did
self._DID_LBL.text = "DID: " + str(new_did)
func set_record_name(rename : String):
self._Name_BTN.text = rename
func set_story_editor(editor):
self._Story_Editor = editor
func uncheck():
self._Select_CheckBox.pressed = false
func update_human_readable_description(new_text):
self._Human_Readable_LineEdit.text = new_text
self.emit_signal("changed_human_readable_text", self._did, new_text)

View file

@ -1,92 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/EXP-System-Dialog/Story Editor/Rename Record Box/rename_record_box.gd" type="Script" id=1]
[node name="Record_Rename_Box" type="WindowDialog"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -193.0
margin_top = -64.0
margin_right = 193.0
margin_bottom = 52.0
rect_min_size = Vector2( 386, 116 )
size_flags_horizontal = 3
size_flags_vertical = 3
window_title = "Rename Dialog Record"
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MarginContainer" type="MarginContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 8.0
margin_top = 8.0
margin_right = -8.0
margin_bottom = -8.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
margin_right = 370.0
margin_bottom = 100.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Name_LBL" type="Label" parent="MarginContainer/VBoxContainer"]
margin_right = 370.0
margin_bottom = 14.0
text = "Name:"
[node name="Spacer2" type="Control" parent="MarginContainer/VBoxContainer"]
margin_top = 18.0
margin_right = 370.0
margin_bottom = 22.0
rect_min_size = Vector2( 0, 4 )
[node name="Name_LineEdit" type="LineEdit" parent="MarginContainer/VBoxContainer"]
margin_top = 26.0
margin_right = 370.0
margin_bottom = 50.0
[node name="Spacer3" type="Control" parent="MarginContainer/VBoxContainer"]
margin_top = 54.0
margin_right = 370.0
margin_bottom = 58.0
rect_min_size = Vector2( 0, 4 )
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
margin_top = 62.0
margin_right = 370.0
margin_bottom = 82.0
alignment = 1
[node name="Cancel_BTN" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
margin_left = 106.0
margin_right = 160.0
margin_bottom = 20.0
text = "Cancel"
[node name="Spacer" type="Control" parent="MarginContainer/VBoxContainer/HBoxContainer"]
margin_left = 164.0
margin_right = 196.0
margin_bottom = 20.0
rect_min_size = Vector2( 32, 0 )
[node name="Rename_BTN" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
margin_left = 200.0
margin_right = 264.0
margin_bottom = 20.0
text = "Rename"
[connection signal="text_entered" from="MarginContainer/VBoxContainer/Name_LineEdit" to="." method="_on_Name_LineEdit_text_entered"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/Cancel_BTN" to="." method="_on_Cancel_BTN_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/Rename_BTN" to="." method="_on_Rename_BTN_pressed"]

View file

@ -1,32 +0,0 @@
tool
extends WindowDialog
signal rename_BTN_pressed(text)
onready var _Name_LineEdit = self.get_node("MarginContainer/VBoxContainer/Name_LineEdit")
var _Target_Record = null
#Public Methods
func get_target_record():
return self._Target_Record
func set_target_record(record):
self._Target_Record = record
self._Name_LineEdit.text = record.get_record_name()
#Callback Methods
func _on_Cancel_BTN_pressed():
self.visible = false
func _on_Rename_BTN_pressed():
self.visible = false
self.emit_signal("rename_BTN_pressed", self._Name_LineEdit.text)
func _on_Name_LineEdit_text_entered(new_text):
self._on_Rename_BTN_pressed()

View file

@ -1,268 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/EXP-System-Dialog/Story Editor/story_editor.gd" type="Script" id=1]
[node name="Story_Editor" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
rect_min_size = Vector2( 0, 256 )
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
margin_right = 1024.0
margin_bottom = 20.0
[node name="Close_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
margin_right = 47.0
margin_bottom = 20.0
text = "Close"
[node name="VSeparator5" type="VSeparator" parent="VBoxContainer/HBoxContainer"]
margin_left = 51.0
margin_right = 55.0
margin_bottom = 20.0
[node name="Story" type="MenuButton" parent="VBoxContainer/HBoxContainer"]
margin_left = 59.0
margin_right = 103.0
margin_bottom = 20.0
text = "Story"
items = [ "New Story", null, 0, false, false, 0, 0, null, "", false, "Load Story", null, 0, false, false, 1, 0, null, "", false, "Save Story As", null, 0, false, false, 2, 0, null, "", false, "Bake Story As", null, 0, false, false, 3, 0, null, "", false, "Save CSV As", null, 0, false, false, 4, 0, null, "", false, "Load CSV", null, 0, false, false, 5, 0, null, "", false ]
[node name="VSeparator" type="VSeparator" parent="VBoxContainer/HBoxContainer"]
margin_left = 107.0
margin_right = 111.0
margin_bottom = 20.0
[node name="Label2" type="Label" parent="VBoxContainer/HBoxContainer"]
margin_left = 115.0
margin_top = 3.0
margin_right = 163.0
margin_bottom = 17.0
text = "Dialog: "
[node name="Create_Dialog_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
margin_left = 167.0
margin_right = 220.0
margin_bottom = 20.0
hint_tooltip = "Create a new dialog record."
text = "Create"
[node name="Delete_Dialog_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
margin_left = 224.0
margin_right = 279.0
margin_bottom = 20.0
hint_tooltip = "Delete all checked dialog records."
text = "Delete"
[node name="Check_All_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
margin_left = 283.0
margin_right = 354.0
margin_bottom = 20.0
hint_tooltip = "Check all currently visible dialog records."
text = "Check All"
[node name="UnCheck_All_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
margin_left = 358.0
margin_right = 447.0
margin_bottom = 20.0
hint_tooltip = "Uncheck all currently visible dialog records."
text = "UnCheck All"
[node name="VSeparator2" type="VSeparator" parent="VBoxContainer/HBoxContainer"]
margin_left = 451.0
margin_right = 455.0
margin_bottom = 20.0
[node name="Label3" type="Label" parent="VBoxContainer/HBoxContainer"]
margin_left = 459.0
margin_top = 3.0
margin_right = 495.0
margin_bottom = 17.0
text = "Tags: "
[node name="Group_Manager_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
margin_left = 499.0
margin_right = 590.0
margin_bottom = 20.0
hint_tooltip = "Toggles the Group Manager open and closed. Use the Group Manager to add and delete groups that can be applied to dialog records in this story project."
toggle_mode = true
text = "Tag Manager"
[node name="VSeparator3" type="VSeparator" parent="VBoxContainer/HBoxContainer"]
margin_left = 594.0
margin_right = 598.0
margin_bottom = 20.0
[node name="Apply_Group_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
margin_left = 602.0
margin_right = 650.0
margin_bottom = 20.0
hint_tooltip = "Apply the group selected in the Group selector menu to all checked dialog records."
text = "Apply"
[node name="Remove_Group_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
margin_left = 654.0
margin_right = 718.0
margin_bottom = 20.0
hint_tooltip = "Remove the group selected in the Group selector menu from all checked dialog records if the group is applied to them."
text = "Remove"
[node name="Group_Selector_BTN" type="OptionButton" parent="VBoxContainer/HBoxContainer"]
margin_left = 722.0
margin_right = 779.0
margin_bottom = 20.0
hint_tooltip = "Select a group to apply or remove from dialog records."
text = "Tags"
[node name="VSeparator4" type="VSeparator" parent="VBoxContainer/HBoxContainer"]
margin_left = 783.0
margin_right = 787.0
margin_bottom = 20.0
[node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 24.0
margin_right = 1024.0
margin_bottom = 572.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Panel" type="Panel" parent="VBoxContainer/HBoxContainer3"]
margin_right = 1024.0
margin_bottom = 548.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="VScrollBar" type="ScrollContainer" parent="VBoxContainer/HBoxContainer3/Panel"]
anchor_right = 1.0
anchor_bottom = 1.0
rect_min_size = Vector2( 0, 128 )
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Dialog_Record_Root" type="VBoxContainer" parent="VBoxContainer/HBoxContainer3/Panel/VScrollBar"]
margin_right = 1024.0
margin_bottom = 548.0
rect_min_size = Vector2( 0, 128 )
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Group_Manager" type="VBoxContainer" parent="VBoxContainer/HBoxContainer3"]
visible = false
margin_left = 824.0
margin_right = 1080.0
margin_bottom = 716.0
rect_min_size = Vector2( 256, 0 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/HBoxContainer3/Group_Manager"]
margin_right = 256.0
margin_bottom = 24.0
[node name="Add_Group_LineEdit" type="LineEdit" parent="VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer"]
margin_right = 156.0
margin_bottom = 24.0
rect_min_size = Vector2( 128, 0 )
size_flags_horizontal = 3
[node name="Add_Group_BTN" type="Button" parent="VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer"]
margin_left = 160.0
margin_right = 197.0
margin_bottom = 24.0
hint_tooltip = "Add a group to this story project."
text = "Add"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Delete_Group_BTN" type="Button" parent="VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer"]
margin_left = 201.0
margin_right = 256.0
margin_bottom = 24.0
hint_tooltip = "Remove the selected group from this story project."
text = "Delete"
[node name="Group_ItemList" type="ItemList" parent="VBoxContainer/HBoxContainer3/Group_Manager"]
margin_top = 28.0
margin_right = 256.0
margin_bottom = 716.0
size_flags_vertical = 3
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 576.0
margin_right = 1024.0
margin_bottom = 600.0
rect_min_size = Vector2( 0, 24 )
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer2"]
margin_top = 5.0
margin_right = 65.0
margin_bottom = 19.0
text = "Search by "
[node name="Search_OptionButton" type="OptionButton" parent="VBoxContainer/HBoxContainer2"]
margin_left = 69.0
margin_right = 233.0
margin_bottom = 24.0
text = "Human Readable LBL"
items = [ "Human Readable LBL", null, false, 0, null, "DID", null, false, 1, null ]
selected = 0
[node name="Search_LineEdit" type="LineEdit" parent="VBoxContainer/HBoxContainer2"]
margin_left = 237.0
margin_right = 493.0
margin_bottom = 24.0
rect_min_size = Vector2( 256, 0 )
[node name="Filter_MenuButton" type="MenuButton" parent="VBoxContainer/HBoxContainer2"]
margin_left = 497.0
margin_right = 537.0
margin_bottom = 24.0
hint_tooltip = "Select the groups that appear listed in the story editor."
keep_pressed_outside = true
text = "Tags"
flat = false
items = [ "-No Tags-", null, 1, true, false, 0, 0, null, "", false ]
[node name="VSeparator" type="VSeparator" parent="VBoxContainer/HBoxContainer2"]
margin_left = 541.0
margin_right = 545.0
margin_bottom = 24.0
[node name="Filename_LBL" type="Label" parent="VBoxContainer/HBoxContainer2"]
margin_left = 549.0
margin_top = 5.0
margin_right = 640.0
margin_bottom = 19.0
text = "Unsaved Story"
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Close_BTN" to="." method="_on_Close_BTN_pressed"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Create_Dialog_BTN" to="." method="_on_Create_Dialog_BTN_pressed"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Delete_Dialog_BTN" to="." method="_on_Delete_Dialog_BTN_pressed"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Check_All_BTN" to="." method="_on_Check_All_BTN_pressed"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer/UnCheck_All_BTN" to="." method="_on_Uncheck_All_BTN_pressed"]
[connection signal="toggled" from="VBoxContainer/HBoxContainer/Group_Manager_BTN" to="." method="_on_Group_Manager_BTN_toggled"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Apply_Group_BTN" to="." method="_on_Apply_Group_BTN_pressed"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Remove_Group_BTN" to="." method="_on_Remove_Group_BTN_pressed"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Group_Selector_BTN" to="." method="_on_Group_Selector_BTN_pressed"]
[connection signal="text_entered" from="VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer/Add_Group_LineEdit" to="." method="_on_Add_Group_LineEdit_text_entered"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer/Add_Group_BTN" to="." method="_on_Add_Group_BTN_pressed"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer/Delete_Group_BTN" to="." method="_on_Delete_Group_BTN_pressed"]
[connection signal="item_selected" from="VBoxContainer/HBoxContainer2/Search_OptionButton" to="." method="_on_Search_OptionButton_item_selected"]
[connection signal="text_changed" from="VBoxContainer/HBoxContainer2/Search_LineEdit" to="." method="_on_Search_LineEdit_text_changed"]

View file

@ -1,753 +0,0 @@
tool
extends Control
signal changed_story
signal close_pressed
signal dialog_edit_pressed(story, did)
onready var _Dialog_Record_Root = self.get_node("VBoxContainer/HBoxContainer3/Panel/VScrollBar/Dialog_Record_Root")
onready var _Dir = Directory.new()
onready var _Filename_LBL = self.get_node("VBoxContainer/HBoxContainer2/Filename_LBL")
onready var _Filter_Menu = self.get_node("VBoxContainer/HBoxContainer2/Filter_MenuButton")
onready var _Group_List = self.get_node("VBoxContainer/HBoxContainer3/Group_Manager/Group_ItemList")
onready var _Group_Manager_Panel = self.get_node("VBoxContainer/HBoxContainer3/Group_Manager")
onready var _Group_Selector = self.get_node("VBoxContainer/HBoxContainer/Group_Selector_BTN")
onready var _New_Group_LineEdit = self.get_node("VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer/Add_Group_LineEdit")
onready var _Search_LineEdit = self.get_node("VBoxContainer/HBoxContainer2/Search_LineEdit")
onready var _Search_Option_BTN = self.get_node("VBoxContainer/HBoxContainer2/Search_OptionButton")
onready var _Story_Menu = self.get_node("VBoxContainer/HBoxContainer/Story")
var _Dialog_Record = preload("res://addons/EXP-System-Dialog/Story Editor/Dialog Record/Dialog_Record.tscn")
var _EXP_Baked_Story = preload("res://addons/EXP-System-Dialog/Resource_BakedStory/EXP_BakedStory.gd")
var _EXP_Story = preload("res://addons/EXP-System-Dialog/Resource_EditorStory/EXP_EditorStory.gd")
var _Record_Rename_Box_TSCN = preload("res://addons/EXP-System-Dialog/Story Editor/Rename Record Box/Rename_Record_Box.tscn")
var _available_dids : Array
var _Bake_Story_As : EditorFileDialog
var _checked_dialogs : Array = []
var _groups : Array
var _Load_CSV : EditorFileDialog
var _Load_Story : EditorFileDialog
var _record_names : Dictionary
var _Record_Rename_Box
var _Save_CSV_As : EditorFileDialog
var _Save_Story_As : EditorFileDialog
var _story : Dictionary
#Virtual Methods
func _ready():
self._create_rename_box()
self._populate_story_menu()
self._setup_dialogs()
self._Filter_Menu.get_popup().connect("index_pressed", self, "_on_Filter_Menu_index_pressed")
self._Filter_Menu.get_popup().hide_on_checkable_item_selection = false
self._populate_filter_menu()
self._populate_searchby_menu()
#Callback Methods
func _on_Add_Group_BTN_pressed():
self._add_group()
func _on_Add_Group_LineEdit_text_entered(new_text):
self._add_group()
func _on_Apply_Group_BTN_pressed():
var id = self._Group_Selector.get_selected_id()
if id == -1:
return
var idx = self._Group_Selector.get_item_index(id)
var group = self._Group_Selector.get_popup().get_item_text(idx)
for record in self._checked_dialogs.duplicate():
var did = record.get_did()
self._dialog_apply_group(did, group)
record.uncheck()
self.emit_signal("changed_story")
func _on_Bake_Story_As_file_selected(filename : String):
self._bake_data_to(filename)
func _on_Bake_Story_BTN_pressed():
self._Bake_Story_As.popup_centered_ratio(0.7)
func _on_Check_All_BTN_pressed():
var records = self._Dialog_Record_Root.get_children()
for record in records:
if record.visible:
record.check()
func _on_Close_BTN_pressed():
self.emit_signal("close_pressed")
func _on_Create_Dialog_BTN_pressed():
self._create_dialog_record()
func _on_Delete_Dialog_BTN_pressed():
self._delete_checked_dialogs()
func _on_Delete_Group_BTN_pressed():
var idxs = self._Group_List.get_selected_items()
var group
for idx in idxs:
group = self._Group_List.get_item_text(idx)
self._Group_List.remove_item(idx)
self._delete_group(group)
self._populate_group_selector()
self._populate_filter_menu()
func _on_Dialog_changed_human_readable_text(did : int, new_text : String):
self.set_dialog_property(did, "human_readable_description", new_text)
self.emit_signal("changed_story")
func _on_Dialog_checked(dialog):
self._checked_dialogs.push_front(dialog)
func _on_Dialog_edit_pressed(did : int):
self.emit_signal("dialog_edit_pressed", self, did)
func _on_Dialog_unchecked(dialog):
self._checked_dialogs.erase(dialog)
func _on_Filter_Menu_index_pressed(idx):
var checked = self._Filter_Menu.get_popup().is_item_checked(idx)
if not checked:
self._Filter_Menu.get_popup().set_item_checked(idx, true)
else:
self._Filter_Menu.get_popup().set_item_checked(idx, false)
self._update_filter()
func _on_Group_Manager_BTN_toggled(button_pressed : bool):
if button_pressed:
self._Group_Manager_Panel.visible = true
else:
self._Group_Manager_Panel.visible = false
func _on_Group_Selector_BTN_pressed():
self._populate_group_selector()
func _on_Load_CSV_BTN_pressed():
self._Load_CSV.popup_centered_ratio(0.7)
func _on_Load_CSV_file_selected(filepath : String):
var csv_file = File.new()
var status = csv_file.open(filepath, File.READ)
if not status == OK:
print_debug("EXP_Story_Editor: Error loading file \"" + filepath + "\".")
return
csv_file.get_csv_line()
while not csv_file.eof_reached():
var line = csv_file.get_csv_line()
if line.empty():
continue
var did = int(line[0])
var nid = int(line[1])
var dialog = String(line[2])
if not self._story.has(did):
continue
if not self._story[did]["nodes"].has(nid):
continue
self._story[did]["nodes"][nid]["text"] = dialog
csv_file.close()
func _on_Load_Story_BTN_pressed():
self._Load_Story.popup_centered_ratio(0.7)
func _on_Load_Story_file_selected(filename : String):
var file_data = load(filename)
if not file_data.TYPE == "EXP_Story_editor":
return
self._clear_story()
self._load_data_from(file_data)
self._Filename_LBL.text = filename.get_file()
for group in self._groups:
self._Group_List.add_item(group)
self._populate_filter_menu()
for did in self.get_dids():
var new_dialog_record = _Dialog_Record.instance()
self._Dialog_Record_Root.add_child(new_dialog_record)
new_dialog_record.set_story_editor(self)
new_dialog_record.connect("checked", self, "_on_Dialog_checked")
new_dialog_record.connect("unchecked", self, "_on_Dialog_unchecked")
new_dialog_record.connect("changed_human_readable_text", self,
"_on_Dialog_changed_human_readable_text")
new_dialog_record.connect("edit_pressed", self, "_on_Dialog_edit_pressed")
new_dialog_record.connect("rename_pressed", self, "_on_Record_Rename_pressed")
new_dialog_record.set_did(did)
var human_readable_description = self.get_dialog_property(did, "human_readable_description")
new_dialog_record.update_human_readable_description(human_readable_description)
if self._story[did].has("name"):
var record_name = self._story[did]["name"]
new_dialog_record.set_record_name(record_name)
func _on_New_Story_BTN_pressed():
self._clear_story()
func _on_Record_Rename_pressed(record):
self._Record_Rename_Box.set_target_record(record)
self._Record_Rename_Box.visible = true
func _on_Remove_Group_BTN_pressed():
var id = self._Group_Selector.get_selected_id()
if id == -1:
return
var idx = self._Group_Selector.get_item_index(id)
var group = self._Group_Selector.get_popup().get_item_text(idx)
for record in self._checked_dialogs.duplicate():
var did = record.get_did()
self._dialog_remove_group(did, group)
record.uncheck()
self.emit_signal("changed_story")
func _on_Rename_Box_Rename(rename : String):
var record = self._Record_Rename_Box.get_target_record()
var old_name = record.get_record_name()
var record_did = record.get_did()
if rename.empty() or rename == "NAME":
record.set_record_name("NAME")
self._story[record_did].erase("name")
self._record_names.erase(old_name)
return
if self._record_names.has(rename):
return
self._record_names.erase(old_name)
self._record_names[rename] = record_did
self._story[record_did]["name"] = rename
record.set_record_name(rename)
func _on_Save_CSV_BTN_pressed():
self._Save_CSV_As.popup_centered_ratio(0.7)
func _on_Save_CVS_As_file_selected(filepath : String):
var csv_file = File.new()
var status = csv_file.open(filepath, File.WRITE)
if not status == OK:
print_debug("EXP_Story_Editor: Error saving csv file \"" + filepath + "\".")
return
csv_file.store_csv_line(["DID", "NID", "Dialog"], ",")
for did in self._story.keys():
for nid in self._story[did]["nodes"].keys():
var dialog = self._story[did]["nodes"][nid]["text"]
csv_file.store_csv_line([did, nid, dialog], ",")
csv_file.close()
func _on_Save_Story_As_file_selected(filename : String):
self._save_data_to(filename)
self._Filename_LBL.text = filename.get_file()
func _on_Save_Story_BTN_pressed():
self._Save_Story_As.popup_centered_ratio(0.7)
func _on_Search_LineEdit_text_changed(new_text : String):
self._update_filter()
func _on_Search_OptionButton_item_selected(id):
self._update_filter()
func _on_story_menu_option_pressed(id):
match id:
0:
self._on_New_Story_BTN_pressed()
1:
self._on_Load_Story_BTN_pressed()
2:
self._on_Save_Story_BTN_pressed()
3:
self._on_Bake_Story_BTN_pressed()
4:
self._on_Save_CSV_BTN_pressed()
5:
self._on_Load_CSV_BTN_pressed()
func _on_Uncheck_All_BTN_pressed():
var records = self._Dialog_Record_Root.get_children()
for record in records:
if record.visible:
record.uncheck()
#Public Methods
func create_node(did : int, type : String) -> int:
var new_nid = self._generate_nid(did)
var node_data = {"type": type, "text": "", "graph_offset": Vector2(40, 40),
"rect_size": Vector2(0,0) ,"links": {}, "slot_amount": 1}
self._story[did]["nodes"][new_nid] = node_data
return new_nid
func dialog_get_groups(did : int):
return self._story[did]["groups"]
func erase_all_links(did: int, nid : int):
self._story[did]["nodes"][nid]["links"].clear()
func erase_dialog(did : int):
self._story.erase(did)
self._make_did_available(did)
func erase_link(did : int, nid : int, slot : int):
self._story[did]["nodes"][nid]["links"].erase(slot)
func erase_node(did :int, nid :int):
self._story[did]["nodes"].erase(nid)
self._make_nid_available(did, nid)
func get_dialog_property(did : int, property: String):
return self._story[did][property]
func get_dids():
return self._story.keys()
func get_link_slots(did : int, nid : int):
return self._story[did]["nodes"][nid]["links"].keys()
func get_nid_link_from(did : int, nid: int, slot : int):
return self._story[did]["nodes"][nid]["links"][slot]
func get_nids(did : int):
return self._story[did]["nodes"].keys()
func get_node_property(did : int, nid : int, property: String):
return self._story[did]["nodes"][nid][property]
func set_dialog_property(did : int, property : String , data):
self._story[did][property] = data
func set_link(did : int, this_nid : int, slot : int, that_nid : int):
self._story[did]["nodes"][this_nid]["links"][slot] = that_nid
func set_node_property(did : int, nid : int, property : String , data):
self._story[did]["nodes"][nid][property] = data
func set_node_slot_count(did : int, nid : int, amount : int):
self._story[did]["nodes"][nid]["slot_amount"] = amount
#Private Methods
func _add_group():
var new_group_name = self._New_Group_LineEdit.text
if new_group_name == "" or self._groups.has(new_group_name):
return
self._groups.push_back(new_group_name)
self._New_Group_LineEdit.text = ""
self._Group_List.add_item(new_group_name)
self._populate_filter_menu()
var sort_list : Array
for idx in range(self._Group_List.get_item_count()):
var group = self._Group_List.get_item_text(idx)
sort_list.push_back(group)
sort_list.sort()
self._Group_List.clear()
for group in sort_list:
self._Group_List.add_item(group)
func _bake_data() :
var baked_story = self._story.duplicate(true)
for did in baked_story.keys():
baked_story[did].erase("name")
baked_story[did].erase("groups")
baked_story[did].erase("available_nid")
baked_story[did].erase("human_readable_description")
for nid in baked_story[did]["nodes"].keys():
baked_story[did]["nodes"][nid].erase("type")
baked_story[did]["nodes"][nid].erase("graph_offset")
baked_story[did]["nodes"][nid].erase("rect_size")
baked_story[did]["nodes"][nid].erase("slot_amount")
return baked_story.duplicate(true)
func _bake_data_to(filename):
var file_data
if self._Dir.file_exists(filename):
file_data = load(filename)
if file_data.TYPE == "EXP_Baked_Story":
file_data.story = self._bake_data()
file_data.names = self._record_names.duplicate(true)
ResourceSaver.save(filename, file_data)
else:
file_data = _EXP_Baked_Story.new()
file_data.story = self._bake_data()
file_data.names = self._record_names.duplicate(true)
ResourceSaver.save(filename, file_data)
func _clear_group_manager():
self._groups.clear()
for idx in range(self._Group_List.get_item_count()):
self._Group_List.remove_item(0)
self._populate_group_selector()
self._Filter_Menu.get_popup().clear()
func _clear_story():
self._remove_all_records()
self._clear_group_manager()
self._populate_filter_menu()
self._story.clear()
self._available_dids.clear()
self._checked_dialogs.clear()
self._record_names.clear()
self._Filename_LBL.text = "Unsaved Story"
self.emit_signal("changed_story")
func _create_dialog() -> int:
var new_did = self._generate_did()
var dialog_data = {"human_readable_description":
"New Dialog - Enter Human Readable Description",
"groups": [],
"available_nid": [],
"nodes": {}}
self._story[new_did] = dialog_data
return new_did
func _create_dialog_record():
var new_did = self._create_dialog()
var new_dialog_record = _Dialog_Record.instance()
self._Dialog_Record_Root.add_child(new_dialog_record)
new_dialog_record.set_story_editor(self)
new_dialog_record.connect("checked", self, "_on_Dialog_checked")
new_dialog_record.connect("unchecked", self, "_on_Dialog_unchecked")
new_dialog_record.connect("changed_human_readable_text", self,
"_on_Dialog_changed_human_readable_text")
new_dialog_record.connect("edit_pressed", self, "_on_Dialog_edit_pressed")
new_dialog_record.connect("rename_pressed", self, "_on_Record_Rename_pressed")
new_dialog_record.set_did(new_did)
new_dialog_record.update_human_readable_description(
"New Dialog - Enter Human Readable Description.")
func _create_rename_box():
self._Record_Rename_Box = _Record_Rename_Box_TSCN.instance()
self._Record_Rename_Box.connect("rename_BTN_pressed", self, "_on_Rename_Box_Rename")
self.add_child(self._Record_Rename_Box)
func _delete_checked_dialogs():
for dialog in self._checked_dialogs:
self._delete_dialog(dialog)
self._checked_dialogs.clear()
self.emit_signal("changed_story")
func _delete_dialog(dialog):
var did = dialog.get_did()
self.erase_dialog(did)
self._remove_record(dialog)
func _delete_group(group):
self._groups.erase(group)
self._remove_group_from_story(group)
func _dialog_apply_group(did : int, group : String):
if not self._story[did]["groups"].has(group):
self._story[did]["groups"].push_back(group)
func _dialog_remove_group(did : int, group : String):
if self._story[did]["groups"].has(group):
self._story[did]["groups"].erase(group)
func _generate_did() -> int:
if not self._available_dids.empty():
return self._available_dids.pop_front()
else:
return self._story.size() + 1
func _generate_nid(did : int) -> int:
if not self._story[did]["available_nid"].empty():
return self._story[did]["available_nid"].pop_front()
else:
return self._story[did]["nodes"].size() + 1
func _load_data_from(new_story):
self._story = new_story.story.duplicate(true)
self._available_dids = new_story.available_dids.duplicate(true)
self._groups = new_story.groups.duplicate(true)
self._record_names = new_story.names.duplicate(true)
func _make_did_available(did : int):
self._available_dids.push_front(did)
self._available_dids.sort()
func _make_nid_available(did : int, nid : int):
self._story[did]["available_nid"].push_front(nid)
self._story[did]["available_nid"].sort()
func _make_records_visible():
var children = self._Dialog_Record_Root.get_children()
for child in children:
child.visible = true
func _populate_filter_menu():
self._Filter_Menu.get_popup().clear()
self._Filter_Menu.get_popup().add_check_item("-No Tags-")
for group in self._groups:
self._Filter_Menu.get_popup().add_check_item(group)
for idx in range(self._Filter_Menu.get_popup().get_item_count()):
self._Filter_Menu.get_popup().set_item_checked(idx, true)
func _populate_group_selector():
self._Group_Selector.clear()
self._Group_Selector.text = "Tags"
for group in self._groups:
self._Group_Selector.get_popup().add_item(group)
func _populate_searchby_menu():
self._Search_Option_BTN.clear()
self._Search_Option_BTN.get_popup().add_item("Human Readable LBL", 0)
self._Search_Option_BTN.get_popup().add_item("DID", 1)
self._Search_Option_BTN.get_popup().add_item("Record Name", 2)
self._Search_Option_BTN.select(0)
func _populate_story_menu():
self._Story_Menu.get_popup().clear()
self._Story_Menu.get_popup().add_item("New Story", 0)
self._Story_Menu.get_popup().add_item("Load Story", 1)
self._Story_Menu.get_popup().add_item("Save Story As", 2)
self._Story_Menu.get_popup().add_item("Bake Story As", 3)
self._Story_Menu.get_popup().add_item("Save CSV As", 4)
self._Story_Menu.get_popup().add_item("Load CSV", 5)
self._Story_Menu.get_popup().connect("id_pressed", self, "_on_story_menu_option_pressed")
func _remove_all_records():
var dialog_records = self._Dialog_Record_Root.get_children()
for record in dialog_records:
self._remove_record(record)
func _remove_group_from_story(group : String):
for did in self._story:
if self._story[did]["groups"].has(group):
self._story[did]["groups"].erase(group)
func _remove_record(dialog_record):
dialog_record.disconnect("checked", self, "_on_Dialog_checked")
dialog_record.disconnect("unchecked", self, "_on_Dialog_unchecked")
dialog_record.disconnect("changed_human_readable_text", self,
"_on_Dialog_changed_human_readable_text")
dialog_record.disconnect("rename_pressed", self, "_on_Record_Rename_pressed")
var record_name = dialog_record.get_record_name()
if not record_name == "NAME":
self._record_names.erase(record_name)
dialog_record.free()
func _save_data_to(filename):
var file_data
if self._Dir.file_exists(filename):
file_data = load(filename)
if file_data.TYPE == "EXP_Story_editor":
file_data.names = self._record_names.duplicate(true)
file_data.story = self._story.duplicate(true)
file_data.available_dids = self._available_dids.duplicate(true)
file_data.groups = self._groups.duplicate(true)
ResourceSaver.save(filename, file_data)
else:
file_data = _EXP_Story.new()
file_data.names = self._record_names.duplicate(true)
file_data.story = self._story.duplicate(true)
file_data.available_dids = self._available_dids.duplicate(true)
file_data.groups = self._groups.duplicate(true)
ResourceSaver.save(filename, file_data)
func _setup_dialogs():
self._Load_Story = EditorFileDialog.new()
self._Load_Story.mode = EditorFileDialog.MODE_OPEN_FILE
self._Load_Story.add_filter("*.tres ; Story files")
self._Load_Story.resizable = true
self._Load_Story.access = EditorFileDialog.ACCESS_RESOURCES
self._Load_Story.current_dir = "res://"
self._Load_Story.connect("file_selected", self, "_on_Load_Story_file_selected")
self.add_child(self._Load_Story)
self._Save_Story_As = EditorFileDialog.new()
self._Save_Story_As.mode = EditorFileDialog.MODE_SAVE_FILE
self._Save_Story_As.add_filter("*.tres ; Story files")
self._Save_Story_As.resizable = true
self._Save_Story_As.access = EditorFileDialog.ACCESS_RESOURCES
self._Save_Story_As.current_dir = "res://"
self._Save_Story_As.connect("file_selected", self, "_on_Save_Story_As_file_selected")
self.add_child(self._Save_Story_As)
self._Bake_Story_As = EditorFileDialog.new()
self._Bake_Story_As.mode = EditorFileDialog.MODE_SAVE_FILE
self._Bake_Story_As.add_filter("*.tres ; Baked Story files")
self._Bake_Story_As.resizable = true
self._Bake_Story_As.access = EditorFileDialog.ACCESS_RESOURCES
self._Bake_Story_As.current_dir = "res://"
self._Bake_Story_As.connect("file_selected", self, "_on_Bake_Story_As_file_selected")
self.add_child(self._Bake_Story_As)
self._Save_CSV_As = EditorFileDialog.new()
self._Save_CSV_As.mode = EditorFileDialog.MODE_SAVE_FILE
self._Save_CSV_As.add_filter("*.csv ; CSV files")
self._Save_CSV_As.resizable = true
self._Save_CSV_As.access = EditorFileDialog.ACCESS_FILESYSTEM
self._Save_CSV_As.current_dir = "res://"
self._Save_CSV_As.connect("file_selected", self, "_on_Save_CVS_As_file_selected")
self.add_child(self._Save_CSV_As)
self._Load_CSV = EditorFileDialog.new()
self._Load_CSV .mode = EditorFileDialog.MODE_OPEN_FILE
self._Load_CSV .add_filter("*.csv ; CSV files")
self._Load_CSV .resizable = true
self._Load_CSV .access = EditorFileDialog.ACCESS_FILESYSTEM
self._Load_CSV .current_dir = "res://"
self._Load_CSV .connect("file_selected", self, "_on_Load_CSV_file_selected")
self.add_child(self._Load_CSV)
func _update_filter():
var new_text = self._Search_LineEdit.text
self._make_records_visible()
var filter_groups : Array
for idx in range(self._Filter_Menu.get_popup().get_item_count()):
if self._Filter_Menu.get_popup().is_item_checked(idx):
var group = self._Filter_Menu.get_popup().get_item_text(idx)
filter_groups.push_back(group)
var children = self._Dialog_Record_Root.get_children()
var search_option = self._Search_Option_BTN.selected
match search_option:
0: #Human Readable Search
for child in children:
var did = child.get_did()
var human_readable_description = self.get_dialog_property(did, "human_readable_description")
if human_readable_description.find(new_text) == -1 and not new_text.empty():
child.visible = false
else:
child.visible = false
if self._Filter_Menu.get_popup().get_item_count() == 0:
child.visible = true
var dialog_groups = self.dialog_get_groups(did)
if dialog_groups.empty() and filter_groups.has("-No Tags-"):
child.visible = true
for group in dialog_groups:
if filter_groups.has(group):
child.visible = true
1: #DID Search
for child in children:
var did = child.get_did()
if not new_text == str(did) and not new_text.empty():
child.visible = false
else:
child.visible = false
if self._Filter_Menu.get_popup().get_item_count() == 0:
child.visible = true
var dialog_groups = self.dialog_get_groups(did)
if dialog_groups.empty() and filter_groups.has("-No Tags-"):
child.visible = true
for group in dialog_groups:
if filter_groups.has(group):
child.visible = true
2: #Record Name Search
for child in children:
var did = child.get_did()
var record_name = child.get_record_name()
if record_name.find(new_text) == -1 and not new_text.empty():
child.visible = false
else:
child.visible = false
if self._Filter_Menu.get_popup().get_item_count() == 0:
child.visible = true
var dialog_groups = self.dialog_get_groups(did)
if dialog_groups.empty() and filter_groups.has("-No Tags-"):
child.visible = true
for group in dialog_groups:
if filter_groups.has(group):
child.visible = true

View file

@ -1,7 +0,0 @@
[plugin]
name="EXP_Dialog"
description="EXPWorld's dialog technology."
author="David Lipps @ EXPWorlds"
version="1.1.0"
script="plugin.gd"

View file

@ -1,87 +0,0 @@
tool
extends EditorPlugin
var _Story_Editor = preload("res://addons/EXP-System-Dialog/Story Editor/Story_Editor.tscn")
var _Story_Editor_Instance
var _Story_Editor_BTN : ToolButton
var _Dialog_Editor = preload("res://addons/EXP-System-Dialog/Dialog Editor/Dialog_Editor.tscn")
var _Dialog_Editor_Instance
var _Dialog_Editor_BTN : ToolButton
func _enter_tree():
self._Story_Editor_Instance = self._Story_Editor.instance()
self._Story_Editor_Instance.connect("close_pressed", self, "_on_StoryFile_Editor_close_pressed")
self._Story_Editor_BTN = self.add_control_to_bottom_panel(self._Story_Editor_Instance, "EXP StoryFile Editor")
self._Story_Editor_Instance.visible = false
self._Story_Editor_BTN.visible = false
self.add_tool_menu_item("EXP StoryFile Editor", self, "_on_StoryFile_Editor_opened")
self._Dialog_Editor_Instance = self._Dialog_Editor.instance()
self._Dialog_Editor_BTN = self.add_control_to_bottom_panel(self._Dialog_Editor_Instance, "EXP Dialog Editor")
self._Dialog_Editor_BTN.visible = false
self._Story_Editor_Instance.connect("dialog_edit_pressed",
self, "_on_Story_Editor_dialog_edit_pressed")
self._Story_Editor_Instance.connect("dialog_edit_pressed",
self._Dialog_Editor_Instance, "_on_Story_Editor_dialog_edit_pressed")
self._Dialog_Editor_Instance.connect("close_BTN_pressed", self,
"_on_Dialog_Editor_close_BTN_pressed")
self._Dialog_Editor_Instance.connect("back_BTN_pressed", self,
"_on_Dialog_Editor_back_BTN_pressed")
self._Story_Editor_Instance.connect("changed_story", self,
"_on_Story_Editor_changed_story")
func _exit_tree():
self._Story_Editor_Instance.disconnect("dialog_edit_pressed",
self, "_on_Story_Editor_dialog_edit_pressed")
self._Story_Editor_Instance.disconnect("dialog_edit_pressed",
self._Dialog_Editor_Instance, "_on_Story_Editor_dialog_edit_pressed")
self._Dialog_Editor_Instance.disconnect("close_BTN_pressed", self,
"_on_Dialog_Editor_close_BTN_pressed")
self._Dialog_Editor_Instance.disconnect("back_BTN_pressed", self,
"_on_Dialog_Editor_back_BTN_pressed")
self._Story_Editor_Instance.disconnect("changed_story", self,
"_on_Story_Editor_changed_story")
self.remove_control_from_bottom_panel(self._Story_Editor_Instance)
self._Story_Editor_Instance.queue_free()
self.remove_control_from_bottom_panel(self._Dialog_Editor_Instance)
self._Dialog_Editor_Instance.queue_free()
self.remove_tool_menu_item("EXP StoryFile Editor")
func _on_Story_Editor_dialog_edit_pressed(story, did):
self._Dialog_Editor_BTN.visible = true
self._Story_Editor_BTN.pressed = false
self._Dialog_Editor_BTN.pressed = true
self._Dialog_Editor_BTN.emit_signal("pressed")
func _on_Dialog_Editor_close_BTN_pressed():
self._Dialog_Editor_BTN.pressed = false
self._Dialog_Editor_BTN.visible = false
func _on_Story_Editor_changed_story():
self._Dialog_Editor_BTN.visible = false
func _on_Dialog_Editor_back_BTN_pressed():
self._Story_Editor_BTN.pressed = true
self._Dialog_Editor_BTN.pressed = false
self._Story_Editor_BTN.emit_signal("pressed")
func _on_StoryFile_Editor_opened(trash_parameter):
self._Story_Editor_BTN.visible = true
func _on_StoryFile_Editor_close_pressed():
self._Story_Editor_Instance.visible = false
self._Story_Editor_BTN.visible = false
self._Dialog_Editor_Instance.visible = false
self._Dialog_Editor_BTN.visible = false

View file

@ -71,15 +71,7 @@ func create_character():
'default_speaker': false,
'portraits': []
}
var directory = Directory.new()
if not directory.dir_exists(DialogicUtil.get_path('WORKING_DIR')):
directory.make_dir(DialogicUtil.get_path('WORKING_DIR'))
if not directory.dir_exists(DialogicUtil.get_path('CHAR_DIR')):
directory.make_dir(DialogicUtil.get_path('CHAR_DIR'))
var file = File.new()
file.open(DialogicUtil.get_path('CHAR_DIR', character_file), File.WRITE)
file.store_line(to_json(character))
file.close()
DialogicResources.set_character(character)
character['metadata'] = {'file': character_file}
return character
@ -118,19 +110,16 @@ func generate_character_data_to_save():
func save_character():
var path = DialogicUtil.get_path('CHAR_DIR', nodes['file'].text)
var info_to_save = generate_character_data_to_save()
if info_to_save['id']:
var file = File.new()
file.open(path, File.WRITE)
file.store_line(to_json(info_to_save))
file.close()
DialogicResources.set_character(info_to_save)
opened_character_data = info_to_save
func load_character(path):
var data = DialogicUtil.load_json(path)
func load_character(filename: String):
clear_character_editor()
var data = DialogicResources.get_character_json(filename)
opened_character_data = data
nodes['file'].text = data['id']
nodes['default_speaker'].pressed = false

View file

@ -29,7 +29,7 @@ func _on_file_selected(path, target):
update_preview(path)
$PathEdit.text = path
if $NameEdit.text == '':
$NameEdit.text = DialogicUtil.get_filename_from_path(path)
$NameEdit.text = DialogicResources.get_filename_from_path(path)
func _on_focus_entered():

View file

@ -70,43 +70,23 @@ func show_sub_editor(type):
nodes['extra_editor'].visible = true
func get_definition(key, default):
func get_definition(key: String, default):
if current_section != '':
var config = ConfigFile.new()
config.load(DialogicUtil.get_path('DEFINITIONS_FILE'))
if config.has_section(current_section):
return config.get_value(current_section, key, default)
return DialogicResources.get_default_definition_key(current_section, key, default)
else:
return default
func new_definition():
var config = ConfigFile.new()
var section = DialogicUtil.generate_random_id()
var err = config.load(DialogicUtil.get_path('DEFINITIONS_FILE'))
if err == OK:
config.set_value(section, 'name', 'New definition')
config.set_value(section, 'type', 0)
config.set_value(section, 'value', '')
config.save(DialogicUtil.get_path('DEFINITIONS_FILE'))
master_tree.add_definition({'section': section,'name': 'New definition', 'type': 0}, true)
else:
print('Error loading definitions')
DialogicResources.add_default_definition_variable(section, 'New definition', 0, '')
master_tree.add_definition({'section': section,'name': 'New definition', 'type': 0}, true)
func save_definition():
if current_section != '':
var config = ConfigFile.new()
var err = config.load(DialogicUtil.get_path('DEFINITIONS_FILE'))
if err == OK:
config.set_value(current_section, 'name', nodes['name'].text)
var type = nodes['type'].selected
config.set_value(current_section, 'type', type)
if type == 0:
config.set_value(current_section, 'value', nodes['value'].text)
if type == 1:
config.set_value(current_section, 'extra_title', nodes['extra_title'].text)
config.set_value(current_section, 'extra_text', nodes['extra_text'].text)
config.set_value(current_section, 'extra_extra', nodes['extra_extra'].text)
config.save(DialogicUtil.get_path('DEFINITIONS_FILE'))
var type: int = nodes['type'].selected
if type == 0:
DialogicResources.set_default_definition_variable(current_section, nodes['name'].text, nodes['value'].text)
if type == 1:
DialogicResources.set_default_definition_glossary(current_section, nodes['name'].text, nodes['extra_title'].text, nodes['extra_text'].text, nodes['extra_extra'].text)

View file

@ -1,7 +1,6 @@
tool
extends Control
var plugin_reference
var debug_mode: bool = true # For printing info
var editor_file_dialog # EditorFileDialog
var file_picker_data: Dictionary = {'method': '', 'node': self}
@ -59,7 +58,7 @@ func _ready():
# Timeline context menu
func _on_TimelinePopupMenu_id_pressed(id):
if id == 0: # View files
OS.shell_open(ProjectSettings.globalize_path(DialogicUtil.get_path('TIMELINE_DIR')))
OS.shell_open(ProjectSettings.globalize_path(DialogicResources.get_path('TIMELINE_DIR')))
if id == 1: # Copy to clipboard
OS.set_clipboard($MainPanel/TimelineEditor.timeline_name)
if id == 2: # Remove
@ -78,7 +77,7 @@ func _on_RemoveTimelineConfirmation_confirmed():
# Character context menu
func _on_CharacterPopupMenu_id_pressed(id):
if id == 0:
OS.shell_open(ProjectSettings.globalize_path(DialogicUtil.get_path('CHAR_DIR')))
OS.shell_open(ProjectSettings.globalize_path(DialogicResources.get_path('CHAR_DIR')))
if id == 1:
$RemoveCharacterConfirmation.popup_centered()
@ -86,7 +85,7 @@ func _on_CharacterPopupMenu_id_pressed(id):
# Theme context menu
func _on_ThemePopupMenu_id_pressed(id):
if id == 0:
OS.shell_open(ProjectSettings.globalize_path(DialogicUtil.get_path('THEME_DIR')))
OS.shell_open(ProjectSettings.globalize_path(DialogicResources.get_path('THEME_DIR')))
if id == 1:
$RemoveThemeConfirmation.popup_centered()
@ -94,38 +93,28 @@ func _on_ThemePopupMenu_id_pressed(id):
# Definition context menu
func _on_DefinitionPopupMenu_id_pressed(id):
if id == 0:
OS.shell_open(ProjectSettings.globalize_path(DialogicUtil.get_path('DEFINITIONS_FILE')))
OS.shell_open(ProjectSettings.globalize_path(DialogicResources.get_path('DEFAULT_DEFINITIONS_FILE')))
if id == 1:
$RemoveDefinitionConfirmation.popup_centered()
func _on_RemoveDefinitionConfirmation_confirmed():
var target = $MainPanel/DefinitionEditor.current_section
var config = ConfigFile.new()
var err = config.load(DialogicUtil.get_path('DEFINITIONS_FILE'))
if err == OK:
config.erase_section(target)
config.save(DialogicUtil.get_path('DEFINITIONS_FILE'))
$MainPanel/MasterTree.remove_selected()
$MainPanel/MasterTree.hide_all_editors(true)
else:
print('Error loading definitions')
DialogicResources.delete_default_definition(target)
$MainPanel/MasterTree.remove_selected()
$MainPanel/MasterTree.hide_all_editors(true)
func _on_RemoveCharacterConfirmation_confirmed():
var dir = Directory.new()
print($MainPanel/CharacterEditor.opened_character_data)
var target = DialogicUtil.get_path('CHAR_DIR', $MainPanel/CharacterEditor.opened_character_data['id'])
dir.remove(target)
var filename = DialogicResources.get_path('CHAR_DIR', $MainPanel/CharacterEditor.opened_character_data['id'])
DialogicResources.delete_character(filename)
$MainPanel/MasterTree.remove_selected()
$MainPanel/MasterTree.hide_all_editors(true)
func _on_RemoveThemeConfirmation_confirmed():
var dir = Directory.new()
var filepath = $MainPanel/MasterTree.get_selected().get_metadata(0)['file']
var target = DialogicUtil.get_path('THEME_DIR', filepath)
dir.remove(target)
var filename = $MainPanel/MasterTree.get_selected().get_metadata(0)['file']
DialogicResources.delete_timeline(filename)
$MainPanel/MasterTree.remove_selected()
$MainPanel/MasterTree.hide_all_editors(true)

View file

@ -69,7 +69,7 @@ func _ready():
add_character(c)
# Adding Definitions
for d in DialogicUtil.get_definition_list():
for d in DialogicUtil.get_default_definition_list():
add_definition(d)
# Adding Themes
@ -149,10 +149,10 @@ func _on_item_selected():
hide_all_editors()
if metadata['editor'] == 'Timeline':
timeline_editor.visible = true
timeline_editor.load_timeline(DialogicUtil.get_path('TIMELINE_DIR', metadata['file']))
timeline_editor.load_timeline(metadata['file'])
if metadata['editor'] == 'Character':
character_editor.visible = true
character_editor.load_character(DialogicUtil.get_path('CHAR_DIR', metadata['file']))
character_editor.load_character(metadata['file'])
if metadata['editor'] == 'Definition':
definition_editor.visible = true
definition_editor.load_definition(metadata['section'])
@ -221,7 +221,7 @@ func _on_item_edited():
if metadata['editor'] == 'Timeline':
timeline_editor.timeline_name = item.get_text(0)
if metadata['editor'] == 'Theme':
DialogicUtil.set_theme_value(metadata['file'], 'settings', 'name', item.get_text(0))
DialogicResources.set_theme_value(metadata['file'], 'settings', 'name', item.get_text(0))
if metadata['editor'] == 'Character':
character_editor.nodes['name'].text = item.get_text(0)
if metadata['editor'] == 'Definition':

View file

@ -28,10 +28,7 @@ func _on_MenuButton_about_to_show():
Dropdown.get_popup().clear()
var index = 0
for c in DialogicUtil.get_timeline_list():
if c['file'].replace('.json', '') == DialogicUtil.get_filename_from_path(editor_reference.get_node('MainPanel/TimelineEditor').working_timeline_file):
Dropdown.get_popup().add_item('(Current) ' + c['name'])
else:
Dropdown.get_popup().add_item(c['name'])
Dropdown.get_popup().add_item(c['name'])
Dropdown.get_popup().set_item_metadata(index, {'file': c['file'], 'color': c['color']})
index += 1

View file

@ -78,7 +78,7 @@ func check_active_position(active_color = Color("#ffffff")):
func load_data(data):
event_data = data
if data['character'] != '':
var character_data = DialogicUtil.load_json(DialogicUtil.get_path('CHAR_DIR', data['character']))
var character_data = DialogicResources.get_character_json(data['character'])
$PanelContainer/VBoxContainer/Header/CharacterPicker.set_data(character_data['name'], Color(character_data['color']))
portrait_picker.set_character(data['character'], data['portrait'])
current_color = Color(character_data['color'])

View file

@ -37,6 +37,6 @@ func load_data(data):
event_data = data
if data['character'] != '[All]':
if data['character'] != '':
var character_data = DialogicUtil.load_json(DialogicUtil.get_path('CHAR_DIR', data['character']))
var character_data = DialogicResources.get_character_json(data['character'])
if character_data.has('name'):
$PanelContainer/VBoxContainer/Header/CharacterDropdown.text = character_data['name']

View file

@ -37,7 +37,7 @@ func _on_character_selected(index: int):
func set_data_by_file(file_name):
# This method is used when you don't know the character's color
var character = DialogicUtil.load_json(DialogicUtil.get_path('CHAR_DIR', file_name))
var character = DialogicResources.get_character_json(file_name)
set_data(character['name'], Color(character['color']))

View file

@ -0,0 +1,58 @@
tool
extends MenuButton
var options = [
{
"text": "[ Equal to ]",
"condition": "=="
},
{
"text": "[ Different from ]",
"condition": "!="
},
{
"text": "[ Greater than ]",
"condition": ">"
},
{
"text": "[ Greater or equal to ]",
"condition": ">="
},
{
"text": "[ Less than ]",
"condition": "<"
},
{
"text": "[ Less or equal to ]",
"condition": "<="
}
]
func _ready():
get_popup().connect("index_pressed", self, '_on_entry_selected')
get_popup().clear()
connect("about_to_show", self, "_on_MenuButton_about_to_show")
func _on_MenuButton_about_to_show():
get_popup().clear()
var index = 0
for o in options:
get_popup().add_item(o['text'])
get_popup().set_item_metadata(index, o)
index += 1
func _on_entry_selected(index):
var _text = get_popup().get_item_text(index)
var metadata = get_popup().get_item_metadata(index)
text = _text
func load_condition(condition):
if condition != '':
for o in options:
if (o['condition'] == condition):
text = o['text']
else:
text = options[0]['text']

View file

@ -0,0 +1,13 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/ConditionPicker.gd" type="Script" id=1]
[node name="ConditionPicker" type="MenuButton"]
margin_left = 173.0
margin_right = 252.0
margin_bottom = 28.0
text = "[ Equal to ]"
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}

View file

@ -12,7 +12,7 @@ func _ready():
func _on_MenuButton_about_to_show():
get_popup().clear()
var index = 0
for d in DialogicUtil.get_definition_list():
for d in DialogicUtil.get_default_definition_list():
if d['type'] == 0:
get_popup().add_item(d['name'])
get_popup().set_item_metadata(index, {
@ -29,7 +29,7 @@ func _on_entry_selected(index):
func load_definition(section):
if section != '':
for d in DialogicUtil.get_definition_list():
for d in DialogicUtil.get_default_definition_list():
if d['section'] == section:
text = d['name']
else:

View file

@ -2,10 +2,12 @@ tool
extends Control
var moving
var hover = false
func _ready():
get_parent().connect("gui_input", self, '_on_gui_input')
get_parent().connect("mouse_entered", self, '_on_mouse_entered')
get_parent().connect("mouse_exited", self, '_on_mouse_exited')
func _process(delta):
if moving:
@ -18,6 +20,18 @@ func _process(delta):
if current_position.y > node_position + height:
get_parent().get_node("PanelContainer/VBoxContainer/Header/OptionButton")._on_OptionSelected(1)
# TODO: I have to figure out a way to modify only an instance's theme.
# This code modifies the custom theme of all the same kind of scenes.
#if hover:
# get_parent().get_node("PanelContainer").self_modulate = Color("#dd42ff")
# var panel = get_parent().get_node("PanelContainer").get('custom_styles/panel')
# panel.set('border_color', '#ffffff')
#else:
# get_parent().get_node("PanelContainer").self_modulate = Color("#ffffff")
# var panel = get_parent().get_node("PanelContainer").get('custom_styles/panel')
# panel.set('border_color', '#202020')
func _on_gui_input(event):
if event is InputEventMouseButton and event.button_index == 1:
@ -25,3 +39,11 @@ func _on_gui_input(event):
moving = false
else:
moving = true
func _on_mouse_entered():
hover = true
func _on_mouse_exited():
hover = false

View file

@ -7,17 +7,19 @@ var editorPopup
# This is the information of this event and it will get parsed and saved to the JSON file.
var event_data = {
'condition': '',
'condition': '==',
'definition': '',
'value': ''
}
onready var nodes = {
'definition_picker': $PanelContainer/VBoxContainer/Header/DefinitionPicker,
'condition_picker': $PanelContainer/VBoxContainer/Header/ConditionPicker,
}
func _ready():
nodes['definition_picker'].get_popup().connect("index_pressed", self, '_on_definition_entry_selected')
nodes['condition_picker'].get_popup().connect("index_pressed", self, '_on_condition_entry_selected')
$PanelContainer/VBoxContainer/Header/CustomLineEdit.connect("text_changed", self, '_on_text_changed')
@ -29,8 +31,14 @@ func load_data(data):
event_data = data
$PanelContainer/VBoxContainer/Header/CustomLineEdit.text = event_data['value']
nodes['definition_picker'].load_definition(data['definition'])
nodes['condition_picker'].load_condition(data['condition'])
func _on_definition_entry_selected(index):
var metadata = nodes['definition_picker'].get_popup().get_item_metadata(index)
event_data['definition'] = metadata['section']
func _on_condition_entry_selected(index):
var metadata = nodes['condition_picker'].get_popup().get_item_metadata(index)
event_data['condition'] = metadata['condition']

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=9 format=2]
[ext_resource path="res://addons/dialogic/Images/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/Pieces/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/Pieces/Common/DragController.tscn" type="PackedScene" id=5]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/CustomLineEdit.tscn" type="PackedScene" id=6]
@ -70,11 +71,7 @@ margin_left = 26.0
margin_right = 169.0
margin_bottom = 28.0
[node name="MenuButton2" type="MenuButton" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 173.0
margin_right = 252.0
margin_bottom = 28.0
text = "[ Equal to ]"
[node name="ConditionPicker" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 3 )]
[node name="CustomLineEdit" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 6 )]
margin_left = 256.0

View file

@ -17,7 +17,7 @@ func _ready():
func update_data():
var settings = DialogicUtil.get_settings()
var settings = DialogicResources.get_settings_config()
refresh_themes(settings)
dialog_options(settings)
@ -71,9 +71,4 @@ func _on_auto_color_names_toggled(value):
# Reading and saving data to the settings file
func set_value(section, key, value):
var config = ConfigFile.new()
var file = DialogicUtil.get_path('SETTINGS_FILE')
var err = config.load(file)
if err == OK:
config.set_value(section, key, value)
config.save(file)
DialogicResources.set_settings_value(section, key, value)

View file

@ -62,16 +62,16 @@ func _ready():
func load_theme(filename):
current_theme = filename
var theme = DialogicUtil.get_theme(filename)
var theme = DialogicResources.get_theme_config(filename)
# Settings
n['theme_action_key'].text = theme.get_value('settings', 'action_key', 'ui_accept')
# Background
n['theme_background_image'].text = DialogicUtil.get_filename_from_path(theme.get_value('background', 'image', 'res://addons/dialogic/Images/background/background-2.png'))
n['theme_background_image'].text = DialogicResources.get_filename_from_path(theme.get_value('background', 'image', 'res://addons/dialogic/Images/background/background-2.png'))
n['background_texture_button_visible'].pressed = theme.get_value('background', 'use_image', true)
n['theme_background_color'].color = Color(theme.get_value('background', 'color', '#ff000000'))
n['theme_background_color_visible'].pressed = theme.get_value('background', 'use_color', false)
n['theme_next_image'].text = DialogicUtil.get_filename_from_path(theme.get_value('next_indicator', 'image', 'res://addons/dialogic/Images/next-indicator.png'))
n['theme_next_image'].text = DialogicResources.get_filename_from_path(theme.get_value('next_indicator', 'image', 'res://addons/dialogic/Images/next-indicator.png'))
var size_value = theme.get_value('box', 'size', Vector2(910, 167))
n['size_w'].value = size_value.x
@ -84,7 +84,7 @@ func load_theme(filename):
n['button_text_color'].color = Color(theme.get_value('buttons', 'text_color', "#ffffffff"))
n['button_background'].color = Color(theme.get_value('buttons', 'background_color', "#ff000000"))
n['button_background_visible'].pressed = theme.get_value('buttons', 'use_background_color', false)
n['button_image'].text = DialogicUtil.get_filename_from_path(theme.get_value('buttons', 'image', 'res://addons/dialogic/Images/background/background-2.png'))
n['button_image'].text = DialogicResources.get_filename_from_path(theme.get_value('buttons', 'image', 'res://addons/dialogic/Images/background/background-2.png'))
n['button_image_visible'].pressed = theme.get_value('buttons', 'use_image', true)
n['button_offset_x'].value = theme.get_value('buttons', 'padding', Vector2(5,5)).x
n['button_offset_y'].value = theme.get_value('buttons', 'padding', Vector2(5,5)).y
@ -92,11 +92,11 @@ func load_theme(filename):
# Definitions
n['glossary_color'].color = Color(theme.get_value('definitions', 'color', "#ffffffff"))
n['glossary_font'].text = DialogicUtil.get_filename_from_path(theme.get_value('definitions', 'font', "res://addons/dialogic/Fonts/GlossaryFont.tres"))
n['glossary_font'].text = DialogicResources.get_filename_from_path(theme.get_value('definitions', 'font', "res://addons/dialogic/Fonts/GlossaryFont.tres"))
# Text
n['theme_text_speed'].value = theme.get_value('text','speed', 2)
n['theme_font'].text = DialogicUtil.get_filename_from_path(theme.get_value('text', 'font', 'res://addons/dialogic/Fonts/DefaultFont.tres'))
n['theme_font'].text = DialogicResources.get_filename_from_path(theme.get_value('text', 'font', 'res://addons/dialogic/Fonts/DefaultFont.tres'))
n['theme_text_color'].color = Color(theme.get_value('text', 'color', '#ffffffff'))
n['theme_text_shadow'].pressed = theme.get_value('text', 'shadow', false)
n['theme_text_shadow_color'].color = Color(theme.get_value('text', 'shadow_color', '#9e000000'))
@ -113,10 +113,13 @@ func load_theme(filename):
'Right':
n['alignment'].select(2)
# Preview text
n['text_preview'].text = theme.get_value('text', 'preview', 'This is preview text. You can use [color=#A5EFAC]BBCode[/color] to style it.\n[wave amp=50 freq=2]You can even use effects![/wave]')
func new_theme():
var theme_file = 'theme-' + str(OS.get_unix_time()) + '.cfg'
DialogicUtil.create_empty_file(DialogicUtil.get_path('THEME_DIR', theme_file))
DialogicResources.add_theme(theme_file)
master_tree.add_theme({'file': theme_file, 'name': theme_file})
load_theme(theme_file)
# Check if it is the only theme to set as default
@ -131,8 +134,8 @@ func _on_BackgroundTextureButton_pressed():
func _on_background_selected(path, target):
DialogicUtil.set_theme_value(current_theme, 'background','image', path)
n['theme_background_image'].text = DialogicUtil.get_filename_from_path(path)
DialogicResources.set_theme_value(current_theme, 'background','image', path)
n['theme_background_image'].text = DialogicResources.get_filename_from_path(path)
func _on_NextIndicatorButton_pressed():
@ -141,24 +144,24 @@ func _on_NextIndicatorButton_pressed():
func _on_indicator_selected(path, target):
DialogicUtil.set_theme_value(current_theme, 'next_indicator','image', path)
n['theme_next_image'].text = DialogicUtil.get_filename_from_path(path)
DialogicResources.set_theme_value(current_theme, 'next_indicator','image', path)
n['theme_next_image'].text = DialogicResources.get_filename_from_path(path)
func _on_ColorPickerButton_color_changed(color):
DialogicUtil.set_theme_value(current_theme, 'text','color', '#' + color.to_html())
DialogicResources.set_theme_value(current_theme, 'text','color', '#' + color.to_html())
func _on_ColorPickerButtonShadow_color_changed(color):
DialogicUtil.set_theme_value(current_theme, 'text','shadow_color', '#' + color.to_html())
DialogicResources.set_theme_value(current_theme, 'text','shadow_color', '#' + color.to_html())
func _on_CheckBoxShadow_toggled(button_pressed):
DialogicUtil.set_theme_value(current_theme, 'text','shadow', button_pressed)
DialogicResources.set_theme_value(current_theme, 'text','shadow', button_pressed)
func _on_ShadowOffset_value_changed(_value):
DialogicUtil.set_theme_value(current_theme, 'text','shadow_offset', Vector2(n['theme_shadow_offset_x'].value,n['theme_shadow_offset_y'].value))
DialogicResources.set_theme_value(current_theme, 'text','shadow_offset', Vector2(n['theme_shadow_offset_x'].value,n['theme_shadow_offset_y'].value))
func _on_PreviewButton_pressed():
@ -172,24 +175,24 @@ func _on_PreviewButton_pressed():
preview_dialog.dialog_script['events'] = [{
"character":"",
"portrait":"",
"text": n['text_preview'].text
"text": preview_dialog.parse_definitions(n['text_preview'].text)
}]
# Settings
preview_dialog.settings = DialogicUtil.get_settings()
preview_dialog.settings = DialogicResources.get_settings_config()
# Alignment
preview_dialog.dialog_script = preview_dialog.parse_definitions(preview_dialog.dialog_script)
preview_dialog.dialog_script = preview_dialog.parse_text_lines(preview_dialog.dialog_script)
n['preview_panel'].add_child(preview_dialog)
# Not sure why but I need to reload the theme again for it to work properly
preview_dialog.current_theme = preview_dialog.load_theme(current_theme)
preview_dialog.load_dialog()
preview_dialog.current_theme = preview_dialog.load_theme(current_theme)
# maintaining the preview panel big enough for the dialog box
n['preview_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)
n['preview_panel'].rect_size = Vector2(0,0)
n['preview_panel'].rect_size.y = 0
func _on_ActionOptionButton_item_selected(index):
DialogicUtil.set_theme_value(current_theme, 'settings','action_key', n['theme_action_key'].text)
DialogicResources.set_theme_value(current_theme, 'settings','action_key', n['theme_action_key'].text)
func _on_ActionOptionButton_pressed():
@ -206,12 +209,12 @@ func _on_FontButton_pressed():
func _on_Font_selected(path, target):
DialogicUtil.set_theme_value(current_theme, 'text','font', path)
n['theme_font'].text = DialogicUtil.get_filename_from_path(path)
DialogicResources.set_theme_value(current_theme, 'text','font', path)
n['theme_font'].text = DialogicResources.get_filename_from_path(path)
func _on_textSpeed_value_changed(value):
DialogicUtil.set_theme_value(current_theme, 'text','speed', value)
DialogicResources.set_theme_value(current_theme, 'text','speed', value)
func _on_TextMargin_value_changed(value):
@ -219,27 +222,27 @@ func _on_TextMargin_value_changed(value):
n['theme_text_margin'].value,
n['theme_text_margin_h'].value
)
DialogicUtil.set_theme_value(current_theme, 'text', 'margin', final_vector)
DialogicResources.set_theme_value(current_theme, 'text', 'margin', final_vector)
func _on_BackgroundColor_CheckBox_toggled(button_pressed):
DialogicUtil.set_theme_value(current_theme, 'background', 'use_color', button_pressed)
DialogicResources.set_theme_value(current_theme, 'background', 'use_color', button_pressed)
func _on_BackgroundColor_ColorPickerButton_color_changed(color):
DialogicUtil.set_theme_value(current_theme, 'background', 'color', '#' + color.to_html())
DialogicResources.set_theme_value(current_theme, 'background', 'color', '#' + color.to_html())
func _on_BackgroundTexture_CheckBox_toggled(button_pressed):
DialogicUtil.set_theme_value(current_theme, 'background', 'use_image', button_pressed)
DialogicResources.set_theme_value(current_theme, 'background', 'use_image', button_pressed)
func _on_button_background_visible_toggled(button_pressed):
DialogicUtil.set_theme_value(current_theme, 'buttons', 'use_background_color', button_pressed)
DialogicResources.set_theme_value(current_theme, 'buttons', 'use_background_color', button_pressed)
func _on_button_background_color_color_changed(color):
DialogicUtil.set_theme_value(current_theme, 'buttons', 'background_color', '#' + color.to_html())
DialogicResources.set_theme_value(current_theme, 'buttons', 'background_color', '#' + color.to_html())
func _on_ButtonOffset_value_changed(value):
@ -247,15 +250,15 @@ func _on_ButtonOffset_value_changed(value):
n['button_offset_x'].value,
n['button_offset_y'].value
)
DialogicUtil.set_theme_value(current_theme, 'buttons', 'padding', final_vector)
DialogicResources.set_theme_value(current_theme, 'buttons', 'padding', final_vector)
func _on_VerticalSeparation_value_changed(value):
DialogicUtil.set_theme_value(current_theme, 'buttons', 'gap', n['button_separation'].value)
DialogicResources.set_theme_value(current_theme, 'buttons', 'gap', n['button_separation'].value)
func _on_button_texture_toggled(button_pressed):
DialogicUtil.set_theme_value(current_theme, 'buttons', 'use_image', button_pressed)
DialogicResources.set_theme_value(current_theme, 'buttons', 'use_image', button_pressed)
func _on_ButtonTextureButton_pressed():
@ -264,20 +267,20 @@ func _on_ButtonTextureButton_pressed():
func _on_button_texture_selected(path, target):
DialogicUtil.set_theme_value(current_theme, 'buttons', 'image', path)
n['button_image'].text = DialogicUtil.get_filename_from_path(path)
DialogicResources.set_theme_value(current_theme, 'buttons', 'image', path)
n['button_image'].text = DialogicResources.get_filename_from_path(path)
func _on_ButtonTextColor_color_changed(color):
DialogicUtil.set_theme_value(current_theme, 'buttons', 'text_color', '#' + color.to_html())
DialogicResources.set_theme_value(current_theme, 'buttons', 'text_color', '#' + color.to_html())
func _on_Custom_Button_Color_toggled(button_pressed):
DialogicUtil.set_theme_value(current_theme, 'buttons', 'text_color_enabled', button_pressed)
DialogicResources.set_theme_value(current_theme, 'buttons', 'text_color_enabled', button_pressed)
func _on_GlossaryColorPicker_color_changed(color):
DialogicUtil.set_theme_value(current_theme, 'definitions', 'color', '#' + color.to_html())
DialogicResources.set_theme_value(current_theme, 'definitions', 'color', '#' + color.to_html())
func _on_GlossaryFontButton_pressed():
@ -285,8 +288,8 @@ func _on_GlossaryFontButton_pressed():
editor_reference.godot_dialog_connect(self, "_on_Glossary_Font_selected")
func _on_Glossary_Font_selected(path, target):
DialogicUtil.set_theme_value(current_theme, 'definitions', 'font', path)
n['glossary_font'].text = DialogicUtil.get_filename_from_path(path)
DialogicResources.set_theme_value(current_theme, 'definitions', 'font', path)
n['glossary_font'].text = DialogicResources.get_filename_from_path(path)
func _on_visibility_changed():
@ -302,18 +305,22 @@ func _on_visibility_changed():
func _on_BoxSize_value_changed(value):
var size_value = Vector2(n['size_w'].value, n['size_h'].value)
DialogicUtil.set_theme_value(current_theme, 'box', 'size', size_value)
DialogicResources.set_theme_value(current_theme, 'box', 'size', size_value)
func _on_BottomGap_value_changed(value):
DialogicUtil.set_theme_value(current_theme, 'box', 'bottom_gap', value)
DialogicResources.set_theme_value(current_theme, 'box', 'bottom_gap', value)
func _on_Alignment_item_selected(index):
if index == 0:
DialogicUtil.set_theme_value(current_theme, 'text', 'alignment', 'Left')
DialogicResources.set_theme_value(current_theme, 'text', 'alignment', 'Left')
elif index == 1:
DialogicUtil.set_theme_value(current_theme, 'text', 'alignment', 'Center')
DialogicResources.set_theme_value(current_theme, 'text', 'alignment', 'Center')
elif index == 2:
DialogicUtil.set_theme_value(current_theme, 'text', 'alignment', 'Right')
DialogicResources.set_theme_value(current_theme, 'text', 'alignment', 'Right')
func _on_Preview_text_changed():
DialogicUtil.set_theme_value(current_theme, 'text', 'preview', n['text_preview'].text)

View file

@ -626,8 +626,15 @@ margin_right = 1048.0
margin_bottom = 293.0
custom_constants/separation = 10
[node name="PreviewButton" type="Button" parent="VBoxContainer/HBoxContainer3"]
margin_right = 152.0
margin_bottom = 60.0
text = " Preview changes "
icon = ExtResource( 1 )
[node name="TextEdit" type="TextEdit" parent="VBoxContainer/HBoxContainer3"]
margin_right = 886.0
margin_left = 162.0
margin_right = 1048.0
margin_bottom = 60.0
rect_min_size = Vector2( 400, 60 )
size_flags_horizontal = 3
@ -635,13 +642,6 @@ text = "This is preview text. You can use [color=#A5EFAC]BBCode[/color] to styl
[wave amp=50 freq=2]You can even use effects![/wave]"
wrap_enabled = true
[node name="PreviewButton" type="Button" parent="VBoxContainer/HBoxContainer3"]
margin_left = 896.0
margin_right = 1048.0
margin_bottom = 60.0
text = " Preview changes "
icon = ExtResource( 1 )
[node name="Panel" type="Panel" parent="VBoxContainer"]
margin_top = 308.0
margin_right = 1048.0
@ -694,3 +694,4 @@ size_flags_vertical = 3
[connection signal="value_changed" from="VBoxContainer/HBoxContainer2/Glossary/GridContainer/HBoxContainer/ShadowOffsetX" to="." method="_on_ShadowOffset_value_changed"]
[connection signal="value_changed" from="VBoxContainer/HBoxContainer2/Glossary/GridContainer/HBoxContainer/ShadowOffsetY" to="." method="_on_ShadowOffset_value_changed"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer3/PreviewButton" to="." method="_on_PreviewButton_pressed"]
[connection signal="text_changed" from="VBoxContainer/HBoxContainer3/TextEdit" to="." method="_on_Preview_text_changed"]

View file

@ -2,9 +2,8 @@ tool
extends HSplitContainer
var editor_reference
var timeline_name
var working_timeline_file: String = ''
var timeline_name: String = ''
var timeline_file: String = ''
var current_timeline: Dictionary = {}
onready var master_tree = get_node('../MasterTree')
@ -100,14 +99,14 @@ func indent_events() -> void:
starter = false
func load_timeline(path):
func load_timeline(filename: String):
print('---------------------------')
print('Loading: ',path)
print('Loading: ', filename)
clear_timeline()
var start_time = OS.get_system_time_msecs()
working_timeline_file = path
timeline_file = filename
var data = DialogicUtil.load_json(path)
var data = DialogicResources.get_timeline_json(filename)
if data['metadata'].has('name'):
timeline_name = data['metadata']['name']
else:
@ -177,9 +176,8 @@ func move_block(block, direction):
return false
# Create timeline
func create_timeline():
var timeline_file = 'timeline-' + str(OS.get_unix_time()) + '.json'
timeline_file = 'timeline-' + str(OS.get_unix_time()) + '.json'
var timeline = {
"events": [],
"metadata":{
@ -187,15 +185,7 @@ func create_timeline():
"file": timeline_file
}
}
var directory = Directory.new()
if not directory.dir_exists(DialogicUtil.get_path('WORKING_DIR')):
directory.make_dir(DialogicUtil.get_path('WORKING_DIR'))
if not directory.dir_exists(DialogicUtil.get_path('TIMELINE_DIR')):
directory.make_dir(DialogicUtil.get_path('TIMELINE_DIR'))
var file = File.new()
file.open(DialogicUtil.get_path('TIMELINE_DIR') + '/' + timeline_file, File.WRITE)
file.store_line(to_json(timeline))
file.close()
DialogicResources.set_timeline(timeline)
return timeline
@ -206,15 +196,11 @@ func new_timeline():
# Saving
func generate_save_data():
var t_name = timeline_name
var f_name = DialogicUtil.get_filename_from_path(working_timeline_file)
if t_name == '':
timeline_name = f_name
var info_to_save = {
'metadata': {
'dialogic-version': editor_reference.version_string,
'name': t_name,
'file': f_name
'name': timeline_name,
'file': timeline_file
},
'events': []
}
@ -225,13 +211,10 @@ func generate_save_data():
func save_timeline() -> void:
if working_timeline_file != '':
if timeline_file != '':
var info_to_save = generate_save_data()
var file = File.new()
file.open(working_timeline_file, File.WRITE)
file.store_line(to_json(info_to_save))
file.close()
#print('[+] Saving: ' , working_timeline_file)
DialogicResources.set_timeline(info_to_save)
#print('[+] Saving: ' , timeline_file)
# Utilities

View file

@ -6,7 +6,12 @@ var character_data = {
'color': Color(0.973511, 1, 0.152344),
'file': ''
}
var positions = {'left': Vector2(-400,0), 'right': Vector2(+400,0), 'center': Vector2(0,0), 'center_right': Vector2(200,0), 'center_left': Vector2(-200,0)}
var positions = {
'left': Vector2(-400,-130),
'right': Vector2(+400,-130),
'center': Vector2(0,-130),
'center_right': Vector2(200,-130),
'center_left': Vector2(-200,-130)}
var direction = 'left'
var debug = false
@ -50,8 +55,7 @@ func set_portrait(expression: String) -> void:
var portraits = character_data['portraits']
for p in portraits:
if p['name'] == expression:
var directory = Directory.new();
if directory.file_exists(p['path']):
if ResourceLoader.exists(p['path']):
$TextureRect.texture = load(p['path'])
else:
$TextureRect.texture = Texture.new()

View file

@ -17,6 +17,7 @@ var settings
var current_theme
export(String, "TimelineDropdown") var timeline: String
export(bool) var reset_saves = true
export(bool) var debug_mode = true
signal event_start(type, event)
signal event_end(type)
@ -34,10 +35,12 @@ func _ready():
# Loading the config files
load_config_files()
# Make sure saves are ready
DialogicResources.init_definitions_saves(reset_saves)
# Checking if the dialog should read the code from a external file
if timeline != '':
dialog_script = set_current_dialog('/' + timeline + '.json')
dialog_script = set_current_dialog(timeline + '.json')
# Connecting resize signal
get_viewport().connect("size_changed", self, "resize_main")
@ -58,7 +61,7 @@ func _ready():
func load_config_files():
definitions = DialogicUtil.get_definition_list()
settings = DialogicUtil.get_settings()
settings = DialogicResources.get_settings_config()
var theme_file = 'res://addons/dialogic/Editor/ThemeEditor/default-theme.cfg'
if settings.has_section('theme'):
theme_file = settings.get_value('theme', 'default')
@ -78,7 +81,7 @@ func resize_main():
func set_current_dialog(dialog_path):
var dialog_script = DialogicUtil.load_json(DialogicUtil.get_path('TIMELINE_DIR', dialog_path))
var dialog_script = DialogicResources.get_timeline_json(dialog_path)
# All this parse events should be happening in the same loop ideally
# But until performance is not an issue I will probably stay lazy
# And keep adding different functions for each parsing operation.
@ -89,7 +92,6 @@ func set_current_dialog(dialog_path):
dialog_script = parse_characters(dialog_script)
dialog_script = parse_text_lines(dialog_script)
dialog_script = parse_definitions(dialog_script)
dialog_script = parse_branches(dialog_script)
return dialog_script
@ -213,34 +215,40 @@ func parse_branches(dialog_script: Dictionary) -> Dictionary:
return dialog_script
func parse_definitions(dialog_script):
func parse_definitions(text: String):
var words = []
var definition_list = DialogicUtil.get_definition_list()
if Engine.is_editor_hint():
# Loading variables again to avoid issues in the preview dialog
load_config_files()
var final_text: String;
final_text = _insert_variable_definitions(text)
final_text = _insert_glossary_definitions(final_text)
return final_text
func _insert_variable_definitions(text: String):
var final_text := text;
for d in definitions:
if d['type'] == 0:
var name : String = d['name'];
var value = DialogicUtil.get_var(name)
final_text = final_text.replace('[' + name + ']', value)
return final_text;
func _insert_glossary_definitions(text: String):
var color = self.current_theme.get_value('definitions', 'color', '#ffbebebe')
var final_text := text;
# I should use regex here, but this is way easier :)
for d in definitions:
if d['type'] == 1:
words.append(d)
# I should use regex here, but this is way easier :)
if words.size() > 0:
var color = current_theme.get_value('definitions', 'color', '#ffbebebe')
var index = 0
for t in dialog_script['events']:
if t.has('text') and t.has('character') and t.has('portrait'):
for d in definitions:
if d['type'] == 1:
dialog_script['events'][index]['text'] = t['text'].replace(d['name'],
'[url=' + d['section'] + ']' +
'[color=' + color + ']' + d['name'] + '[/color]' +
'[/url]'
)
index += 1
return dialog_script
final_text = final_text.replace(d['name'],
'[url=' + d['section'] + ']' +
'[color=' + color + ']' + d['name'] + '[/color]' +
'[/url]'
)
return final_text;
func _process(_delta):
@ -292,7 +300,7 @@ func update_name(character, color='#FFFFFF'):
func update_text(text):
# Updating the text and starting the animation from 0
$TextBubble/RichTextLabel.bbcode_text = text
$TextBubble/RichTextLabel.bbcode_text = self.parse_definitions(text)
$TextBubble/RichTextLabel.percent_visible = 0
# The call to this function needs to be deferred.
@ -338,6 +346,9 @@ func get_character(character_id):
func event_handler(event: Dictionary):
# Handling an event and updating the available nodes accordingly.
reset_dialog_extras()
# Updating the settings and definitions in case that they were modified by a timelien
load_config_files()
dprint('[D] Current Event: ', event)
match event:
{'text', 'character', 'portrait'}:
@ -440,7 +451,7 @@ func event_handler(event: Dictionary):
wait_seconds(event['wait_seconds'])
waiting = true
{'change_timeline'}:
dialog_script = set_current_dialog('/' + event['change_timeline'])
dialog_script = set_current_dialog(event['change_timeline'])
dialog_index = -1
go_to_next_event()
{'condition', 'definition', 'value', 'question_id', ..}:
@ -449,25 +460,21 @@ func event_handler(event: Dictionary):
var current_question = questions[event['question_id']]
for d in definitions:
if d['section'] == event['definition']:
#if d['config'].has_section('runtime_value'):
# def_value = d['config'].get_value(event['definition'], 'runtime_value', null)
#else:
def_value = d['config'].get_value(event['definition'], 'value', null)
if def_value != null:
if def_value != event['value']:
current_question['answered'] = true # This will abort the current conditional branch
def_value = DialogicUtil.get_var(d['name'])
if current_question['answered']:
# If the option is for an answered question, skip to the end of it.
var condition_met = self._compare_definitions(def_value, event['value'], event['condition']);
current_question['answered'] = !condition_met
if !condition_met:
# condition not met, skipping branch
dialog_index = current_question['end_id']
load_dialog(true)
else:
# It should never get here, but if it does, go to the next place.
# condition met, entering branch
go_to_next_event()
{'set_value', 'definition'}:
emit_signal("event_start", "set_value", event)
#DialogicUtil.set_definition(event['definition'], 'runtime_value', event['set_value'])
DialogicUtil.set_definition(event['definition'], 'value', event['set_value'])
DialogicResources.set_saved_definition_variable_value(event['definition'], event['set_value'])
go_to_next_event()
_:
visible = false
@ -617,7 +624,7 @@ func deferred_resize(current_size, result):
resize_main()
func load_theme(filename):
var theme = DialogicUtil.get_theme(filename)
var theme = DialogicResources.get_theme_config(filename)
# Box size
call_deferred('deferred_resize', $TextBubble.rect_size, theme.get_value('box', 'size', Vector2(910, 167)))
@ -726,3 +733,27 @@ func dprint(string, arg1='', arg2='', arg3='', arg4='' ):
# I ask myself the same question :')
if debug_mode:
print(str(string) + str(arg1) + str(arg2) + str(arg3) + str(arg4))
func _compare_definitions(def_value: String, event_value: String, condition: String):
var condition_met = false;
if def_value != null and event_value != null:
var converted_def_value = def_value
var converted_event_value = event_value
if def_value.is_valid_float() and event_value.is_valid_float():
converted_def_value = float(def_value)
converted_event_value = float(event_value)
match condition:
"==":
condition_met = converted_def_value == converted_event_value
"!=":
condition_met = converted_def_value != converted_event_value
">":
condition_met = converted_def_value > converted_event_value
">=":
condition_met = converted_def_value >= converted_event_value
"<":
condition_met = converted_def_value < converted_event_value
"<=":
condition_met = converted_def_value <= converted_event_value
return condition_met

View file

@ -2,8 +2,8 @@ extends Node
class_name Dialogic
static func start(timeline: String, debug_mode=true):
var dialog = load("res://addons/dialogic/Dialog.tscn")
static func start(timeline: String, dialog_scene_path: String="res://addons/dialogic/Dialog.tscn", debug_mode: bool=false):
var dialog = load(dialog_scene_path)
var d = dialog.instance()
d.debug_mode = debug_mode
for t in DialogicUtil.get_timeline_list():
@ -17,12 +17,13 @@ static func start(timeline: String, debug_mode=true):
return d
static func reset_saves():
DialogicResources.init_definitions_saves(true)
static func get_var(variable: String):
return DialogicUtil.get_var(variable)
static func set_var(variable: String, value):
for d in DialogicUtil.get_definition_list():
if d['name'] == variable:
DialogicUtil.set_definition(d['section'], 'value', value)
return value
DialogicUtil.set_var(variable, value)

View file

@ -0,0 +1,349 @@
tool
class_name DialogicResources
const RESOURCES_DIR: String = "res://dialogic" # Readonly, used for static data
const WORKING_DIR: String = "user://dialogic" # Readwrite, used for saves
static func load_json(path: String) -> Dictionary:
# An easy function to load json files and handle common errors.
var file:File = File.new()
if file.open(path, File.READ) != OK:
file.close()
return {'error':'file read error'}
var data_text: String = file.get_as_text()
file.close()
var data_parse:JSONParseResult = JSON.parse(data_text)
if data_parse.error != OK:
return {'error':'data parse error'}
var final_data = data_parse.result
if typeof(final_data) == TYPE_DICTIONARY:
return final_data
# If everything else fails
return {'error':'data parse error'}
static func init_dialogic_files() -> void:
# This functions makes sure that the needed files and folders
# exists when the plugin is loaded. If they don't, we create
# them.
# WARNING: only call while in the editor
var directory = Directory.new()
var paths = get_working_directories()
var files = get_config_files_paths()
# Create directories
for dir in paths:
if not directory.dir_exists(paths[dir]):
directory.make_dir_recursive(paths[dir])
# Create empty files
for f in files:
if not directory.file_exists(files[f]):
create_empty_file(files[f])
static func get_working_directories() -> Dictionary:
return {
'RESOURCES_DIR': RESOURCES_DIR,
'WORKING_DIR': WORKING_DIR,
'TIMELINE_DIR': RESOURCES_DIR + "/timelines",
'THEME_DIR': RESOURCES_DIR + "/themes",
'CHAR_DIR': RESOURCES_DIR + "/characters",
}
static func get_config_files_paths() -> Dictionary:
return {
'SETTINGS_FILE': RESOURCES_DIR + "/settings.cfg",
'DEFAULT_DEFINITIONS_FILE': RESOURCES_DIR + "/definitions.cfg",
'SAVED_DEFINITIONS_FILE': WORKING_DIR + "/definitions.cfg",
}
static func init_definitions_saves(overwrite: bool=true):
var directory := Directory.new()
var source := File.new()
var sink := File.new()
var paths := get_config_files_paths()
var err := directory.make_dir_recursive(get_working_directories()['WORKING_DIR'])
if err == OK:
if not directory.file_exists(paths["SAVED_DEFINITIONS_FILE"]):
err = sink.open(paths["SAVED_DEFINITIONS_FILE"], File.WRITE)
print('Saved definitions not present, creating file: ' + str(err))
if err == OK:
sink.store_string('')
sink.close()
else:
print('Error opening saved definitions file: ' + str(err))
err = sink.open(paths["SAVED_DEFINITIONS_FILE"], File.READ_WRITE)
if err == OK:
if overwrite or sink.get_len() == 0:
err = source.open(paths["DEFAULT_DEFINITIONS_FILE"], File.READ)
if err == OK:
sink.store_string(source.get_as_text())
else:
print('Error opening default definitions file: ' + str(err))
else:
print('Did not overwrite previous saved definitions')
else:
print('Error opening saved definitions file: ' + str(err))
else:
print('Error creating working directory: ' + str(err))
source.close()
sink.close()
static func get_path(name: String, extra: String ='') -> String:
var paths: Dictionary = get_working_directories()
if extra != '':
return paths[name] + '/' + extra
else:
return paths[name]
static func get_filename_from_path(path: String, extension = false) -> String:
var file_name: String = path.split('/')[-1]
if extension == false:
file_name = file_name.split('.')[0]
return file_name
static func listdir(path: String) -> Array:
# https://docs.godotengine.org/en/stable/classes/class_directory.html#description
var files: Array = []
var dir := Directory.new()
var err = dir.open(path)
if err == OK:
dir.list_dir_begin()
var file_name = dir.get_next()
while file_name != "":
if not dir.current_is_dir() and not file_name.begins_with("."):
files.append(file_name)
file_name = dir.get_next()
dir.list_dir_end()
else:
print("Error while accessing path " + path + " - Error: " + str(err))
return files
static func create_empty_file(path):
var file = File.new()
file.open(path, File.WRITE)
file.store_string('')
file.close()
# CONFIG UTIL
static func get_config(id: String) -> ConfigFile:
var paths := get_config_files_paths()
var config := ConfigFile.new()
if id in paths.keys():
var err = config.load(paths[id])
if err != OK:
print("Error while opening config file " + paths[id] + ". Error: " + str(err))
return config
# FILE UTIL
static func remove_file(path: String):
var dir = Directory.new()
dir.remove(path)
# JSON UTIL
static func get_json(dir_id: String, path: String):
return load_json(get_path(dir_id, path))
static func set_json(dir_id: String, path: String, data: Dictionary):
var directory = Directory.new()
var base_path := get_path(dir_id)
if not directory.dir_exists(base_path):
directory.make_dir_recursive(base_path)
var file = File.new()
file.open(get_path(dir_id, path), File.WRITE)
file.store_line(to_json(data))
file.close()
# TIMELINE
static func get_timeline_json(path: String):
return get_json('TIMELINE_DIR', path)
static func set_timeline(timeline: Dictionary):
# WARNING: For use in the editor only
set_json('TIMELINE_DIR', timeline['metadata']['file'], timeline)
static func delete_timeline(filename: String):
# WARNING: For use in the editor only
remove_file(get_path('TIMELINE_DIR', filename))
# CHARACTER
static func get_character_json(path: String):
return get_json('CHAR_DIR', path)
static func set_character(character: Dictionary):
# WARNING: For use in the editor only
set_json('CHAR_DIR', character['id'], character)
static func delete_character(filename: String):
# WARNING: For use in the editor only
remove_file(get_path('CHAR_DIR', filename))
# THEME
static func get_theme_config(filename: String):
var config = ConfigFile.new()
var path
if filename.begins_with('res://'):
path = filename
else:
path = get_path('THEME_DIR', filename)
var err = config.load(path)
if err == OK:
return config
static func set_theme_value(filename, section, key, value):
# WARNING: For use in the editor only
print('=> theme update')
print(filename)
var config = get_theme_config(filename)
config.set_value(section, key, value)
config.save(get_path('THEME_DIR', filename))
static func add_theme(filename: String):
create_empty_file(get_path('THEME_DIR', filename))
# SETTINGS
static func get_settings_config():
return get_config("SETTINGS_FILE")
static func set_settings_value(section: String, key: String, value):
var config = get_settings_config()
config.set_value(section, key, value)
config.save(get_config_files_paths()['SETTINGS_FILE'])
# DEFINITIONS UTIL
# used by default and saved definitions
static func get_definition_key(config_id: String, section: String, key: String, default):
var config = get_config(config_id)
if config.has_section(section):
return config.get_value(section, key, default)
else:
return default
static func set_definition_variable(config_id: String, section: String, name: String, value):
var config = get_config(config_id)
config.set_value(section, 'name', name)
config.set_value(section, 'type', 0)
config.set_value(section, 'value', str(value))
return config.save(get_config_files_paths()[config_id])
static func set_definition_glossary(config_id: String, section: String, name: String, extra_title: String, extra_text: String, extra_extra: String):
var config = get_config(config_id)
config.set_value(section, 'name', name)
config.set_value(section, 'type', 1)
config.set_value(section, 'extra_title', extra_title)
config.set_value(section, 'extra_text', extra_text)
config.set_value(section, 'extra_extra', extra_extra)
return config.save(get_config_files_paths()[config_id])
static func add_definition_variable(config_id: String, section: String, name: String, type: int, value):
var config = get_config(config_id)
config.set_value(section, 'name', name)
config.set_value(section, 'type', type)
config.set_value(section, 'value', str(value))
return config.save(get_config_files_paths()[config_id])
static func delete_definition(config_id: String, section: String):
var config = get_config(config_id)
config.erase_section(section)
return config.save(get_config_files_paths()[config_id])
# DEFAULT DEFINITIONS
# Can only be edited in the editor
static func get_default_definitions_config():
return get_config('DEFAULT_DEFINITIONS_FILE')
static func get_default_definition_key(section: String, key: String, default):
return get_definition_key('DEFAULT_DEFINITIONS_FILE', section, key, default)
static func set_default_definition_variable(section: String, name: String, value):
# WARNING: For use in the editor only
return set_definition_variable('DEFAULT_DEFINITIONS_FILE', section, name, value)
static func set_default_definition_glossary(section: String, name: String, extra_title: String, extra_text: String, extra_extra: String):
# WARNING: For use in the editor only
return set_definition_glossary('DEFAULT_DEFINITIONS_FILE', section, name, extra_title, extra_text, extra_extra)
static func add_default_definition_variable(section: String, name: String, type: int, value):
# WARNING: For use in the editor only
return add_definition_variable('DEFAULT_DEFINITIONS_FILE', section, name, type, value)
static func delete_default_definition(section: String):
# WARNING: For use in the editor only
return delete_definition('DEFAULT_DEFINITIONS_FILE', section)
# SAVED DEFINITIONS
# Can be edited at runtime, and will persist across runs
static func get_saved_definitions_config():
return get_config("SAVED_DEFINITIONS_FILE")
static func set_saved_definition_variable(section: String, name: String, value):
return set_definition_variable('SAVED_DEFINITIONS_FILE', section, name, value)
static func set_saved_definition_variable_value(section: String, value):
var config = get_saved_definitions_config()
return set_definition_variable('SAVED_DEFINITIONS_FILE', section, config.get_value(section, 'name', section), value)
static func set_saved_definition_glossary(section: String, name: String, extra_title: String, extra_text: String, extra_extra: String):
return set_definition_glossary('SAVED_DEFINITIONS_FILE', section, name, extra_title, extra_text, extra_extra)

View file

@ -1,105 +1,12 @@
tool
class_name DialogicUtil
# This class was initially for doing small things... but after a while
# it ended up being one of the corner stones of the plugin.
# It should probably be split into several other classes and leave
# just the basic stuff here, but I'll keep working like this until I have
# some extra time to burn.
# A good point to start would be to add a "resource manager" instead of
# handling most of that here. But who knows? (:
static func init_dialogic_files() -> void:
# This functions makes sure that the needed files and folders
# exists when the plugin is loaded. If they don't, we create
# them.
var directory = Directory.new()
var paths = get_working_directories()
for dir in paths:
if 'settings.cfg' in paths[dir]:
if directory.file_exists(paths['SETTINGS_FILE']) == false:
create_empty_file(paths['SETTINGS_FILE'])
elif 'definitions.cfg' in paths[dir]:
if directory.file_exists(paths['DEFINITIONS_FILE']) == false:
create_empty_file(paths['DEFINITIONS_FILE'])
else:
if directory.dir_exists(paths[dir]) == false:
directory.make_dir(paths[dir])
static func load_json(path: String) -> Dictionary:
# An easy function to load json files and handle common errors.
var file:File = File.new()
if file.open(path, File.READ) != OK:
file.close()
return {'error':'file read error'}
var data_text: String = file.get_as_text()
file.close()
var data_parse:JSONParseResult = JSON.parse(data_text)
if data_parse.error != OK:
return {'error':'data parse error'}
var final_data = data_parse.result
if typeof(final_data) == TYPE_DICTIONARY:
return final_data
# If everything else fails
return {'error':'data parse error'}
static func get_working_directories() -> Dictionary:
var WORKING_DIR: String = "res://dialogic"
var paths: Dictionary = {
'WORKING_DIR': WORKING_DIR,
'TIMELINE_DIR': WORKING_DIR + "/timelines",
'THEME_DIR': WORKING_DIR + "/themes",
'CHAR_DIR': WORKING_DIR + "/characters",
'DEFINITIONS_FILE': WORKING_DIR + "/definitions.cfg",
'SETTINGS_FILE': WORKING_DIR + "/settings.cfg",
}
return paths
static func get_path(name: String, extra: String ='') -> String:
var paths: Dictionary = get_working_directories()
if extra != '':
return paths[name] + '/' + extra
else:
return paths[name]
static func get_filename_from_path(path: String, extension = false) -> String:
var file_name: String = path.split('/')[-1]
if extension == false:
file_name = file_name.split('.')[0]
return file_name
static func listdir(path: String) -> Array:
# https://godotengine.org/qa/5175/how-to-get-all-the-files-inside-a-folder
var files: Array = []
var dir: Directory = Directory.new()
dir.open(path)
dir.list_dir_begin()
while true:
var file = dir.get_next()
if file == "":
break
elif not file.begins_with("."):
files.append(file)
dir.list_dir_end()
return files
static func get_character_list() -> Array:
var characters: Array = []
var directory = Directory.new();
if directory.dir_exists(get_path('CHAR_DIR')) == false:
return characters
for file in listdir(get_path('CHAR_DIR')):
for file in DialogicResources.listdir(DialogicResources.get_path('CHAR_DIR')):
if '.json' in file:
var data: Dictionary = load_json(get_path('CHAR_DIR', file))
var data: Dictionary = DialogicResources.get_character_json(file)
var color: Color = Color("#ffffff")
var c_name: String = data['id']
var default_speaker = false
@ -134,9 +41,9 @@ static func get_character_list() -> Array:
static func get_timeline_list() -> Array:
var timelines: Array = []
for file in listdir(get_path('TIMELINE_DIR')):
for file in DialogicResources.listdir(DialogicResources.get_path('TIMELINE_DIR')):
if '.json' in file:
var data = load_json(get_path('TIMELINE_DIR', file))
var data = DialogicResources.get_timeline_json(file)
if data.has('error') == false:
var metadata = data['metadata']
var color = Color("#ffffff")
@ -147,43 +54,57 @@ static func get_timeline_list() -> Array:
return timelines
static func get_definition_list() -> Array:
var definitions: Array = []
var config = ConfigFile.new()
var err = config.load(get_path('DEFINITIONS_FILE'))
if err == OK:
for section in config.get_sections():
definitions.append({
'section': section,
'name': config.get_value(section, 'name', section),
'config': config,
'type': config.get_value(section, 'type', 0),
static func get_theme_list() -> Array:
var themes: Array = []
for file in DialogicResources.listdir(DialogicResources.get_path('THEME_DIR')):
if '.cfg' in file:
var config = ConfigFile.new()
var err = DialogicResources.get_theme_config(file)
themes.append({
'file': file,
'name': config.get_value('settings','name', file),
'config': config
})
return themes
static func get_default_definition_list() -> Array:
var definitions: Array = []
var config = DialogicResources.get_default_definitions_config()
for section in config.get_sections():
definitions.append({
'section': section,
'name': config.get_value(section, 'name', section),
'config': config,
'type': config.get_value(section, 'type', 0),
})
return definitions
static func set_definition(current_section: String, key, value) -> void:
var config = ConfigFile.new()
var err = config.load(get_path('DEFINITIONS_FILE'))
if err == OK:
config.set_value(current_section, key, str(value))
config.save(get_path('DEFINITIONS_FILE'))
static func get_definition_list() -> Array:
var definitions: Array = []
var config = DialogicResources.get_saved_definitions_config()
for section in config.get_sections():
definitions.append({
'section': section,
'name': config.get_value(section, 'name', section),
'config': config,
'type': config.get_value(section, 'type', 0),
})
return definitions
static func get_var(variable: String):
print(get_definition_list())
static func get_var(variable: String) -> String:
for d in get_definition_list():
if d['name'] == variable:
return d['config'].get_value(d['section'], 'value')
return ''
static func set_var(variable: String):
print(get_definition_list())
static func set_var(variable: String, value) -> void:
for d in get_definition_list():
if d['name'] == variable:
return d['config'].get_value(d['section'], 'value')
return ''
DialogicResources.set_saved_definition_variable(d['section'], d['name'], value)
static func generate_random_id() -> String:
@ -199,56 +120,3 @@ static func compare_dicts(dict_1: Dictionary, dict_2: Dictionary) -> bool:
return false
static func get_theme_list() -> Array:
var themes: Array = []
for file in listdir(get_path('THEME_DIR')):
if '.cfg' in file:
var config = ConfigFile.new()
var err = config.load(get_path('THEME_DIR', file))
if err == OK: # If not, something went wrong with the file loading
themes.append({
'file': file,
'name': config.get_value('settings','name', file),
'config': config
})
else:
print('Error loading ',file , ' - Error: ', err)
return themes
static func get_theme(filename):
var config = ConfigFile.new()
var path
if 'res://' in filename:
path = filename
else:
path = get_path('THEME_DIR', filename)
var err = config.load(path)
if err == OK:
return config
static func set_theme_value(filename, section, key, value):
var config = ConfigFile.new()
var file = get_path('THEME_DIR', filename)
var err = config.load(file)
if err == OK:
config.set_value(section, key, value)
config.save(file)
static func create_empty_file(path):
var file = File.new()
file.open(path, File.WRITE)
file.store_string('')
file.close()
static func get_settings():
var directory = Directory.new()
var config = ConfigFile.new()
if directory.file_exists(get_path('SETTINGS_FILE')):
var err = config.load(get_path('SETTINGS_FILE'))
if err == OK:
return config
return config

View file

@ -15,11 +15,12 @@ func _enter_tree() -> void:
func _ready():
if Engine.editor_hint:
# Make sure the core files exist
DialogicUtil.init_dialogic_files()
DialogicResources.init_dialogic_files()
# Force Godot to show the dialogic folder
get_editor_interface().get_resource_filesystem().scan()
func _exit_tree() -> void:
_remove_custom_editor_view()
remove_inspector_plugin(_parts_inspector)
@ -44,7 +45,7 @@ func get_plugin_icon():
func _add_custom_editor_view():
_editor_view = preload("res://addons/dialogic/Editor/EditorView.tscn").instance()
_editor_view.plugin_reference = self
#_editor_view.plugin_reference = self
func _remove_custom_editor_view():

BIN
characters/df-2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View file

@ -2,15 +2,15 @@
importer="texture"
type="StreamTexture"
path="res://.import/nice.png-45252d21bfd68632293e809427fcb2ee.stex"
path="res://.import/df-2.png-1f29f4d1e6a1f1242da97614da8b7f6c.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://characters/test/nice.png"
dest_files=[ "res://.import/nice.png-45252d21bfd68632293e809427fcb2ee.stex" ]
source_file="res://characters/df-2.png"
dest_files=[ "res://.import/df-2.png-1f29f4d1e6a1f1242da97614da8b7f6c.stex" ]
[params]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

View file

@ -1,34 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/happy.png-34b31afa58bc0c96ccc038435502ee02.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://characters/test/happy.png"
dest_files=[ "res://.import/happy.png-34b31afa58bc0c96ccc038435502ee02.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

View file

@ -1,34 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/shock.png-a8c62a852aea125c35d6b3bd7987a7fc.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://characters/test/shock.png"
dest_files=[ "res://.import/shock.png-a8c62a852aea125c35d6b3bd7987a7fc.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View file

@ -1 +0,0 @@
{"color":"#ffffffff","default_speaker":true,"description":"","display_name":"","display_name_bool":false,"id":"character-1615795338.json","name":"Test","offset_x":0,"offset_y":-100,"portraits":[{"name":"Default","path":"res://characters/test/happy.png"},{"name":"nice","path":"res://characters/test/nice.png"},{"name":"shock","path":"res://characters/test/shock.png"}],"scale":100}

View file

@ -0,0 +1 @@
{"color":"#ffbe1616","default_speaker":true,"description":"","display_name":"","display_name_bool":false,"id":"character-1615932195.json","name":"Test","offset_x":0,"offset_y":0,"portraits":[{"name":"Default","path":"res://characters/df-2.png"}],"scale":100}

View file

@ -1,5 +1,8 @@
[1615795512-648]
[1615930196-648]
name="New definition"
type=0
name="Hello"
type=1
value=""
extra_title="Hello"
extra_text="When you say hi"
extra_extra=""

View file

@ -1,3 +1,3 @@
[theme]
default="theme-1615795528.cfg"
default="theme-1615930210.cfg"

View file

@ -1,14 +0,0 @@
[box]
size=Vector2( 910, 167 )
[text]
margin=Vector2( 20, 10 )
shadow=false
speed=4.0
[background]
use_color=false
use_image=true

View file

@ -0,0 +1,7 @@
[box]
size=Vector2( 910, 167 )
[text]
margin=Vector2( 20, 10 )

View file

@ -1 +0,0 @@
{"events":[{"action":"join","character":"character-1615795338.json","portrait":"Default","position":{"0":false,"1":true,"2":false,"3":false,"4":false}},{"background":"res://backgrounds/office_background.jpg"},{"character":"character-1615795338.json","portrait":"","text":"Bonjour"},{"options":[],"question":"Coucou ?"},{"choice":"Oui !"},{"character":"character-1615795338.json","portrait":"nice","text":"Noice"},{"choice":"Non"},{"character":"character-1615795338.json","portrait":"shock","text":"Bah t'es nul"},{"endbranch":""},{"action":"leaveall","character":"[All]"}],"metadata":{"dialogic-version":"1.0","file":"timeline-1615795397","name":"timeline1"}}

View file

@ -0,0 +1 @@
{"events":[{"background":"res://backgrounds/office_background.jpg"},{"action":"join","character":"character-1615932195.json","portrait":"","position":{"0":false,"1":true,"2":false,"3":false,"4":false}},{"character":"character-1615932195.json","portrait":"","text":"Hello"},{"character":"character-1615932195.json","portrait":"happy","text":"Hi"},{"character":"character-1615932195.json","portrait":"","text":"Bye"},{"action":"leaveall","character":"[All]"},{"wait_seconds":1},{"close_dialog":""}],"metadata":{"dialogic-version":"1.0","file":"timeline-1615930166.json","name":"timeline1"}}

48
export_presets.cfg Normal file
View file

@ -0,0 +1,48 @@
[preset.0]
name="Linux/X11"
platform="Linux/X11"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter="*.json"
exclude_filter=""
export_path="build/linux/Pir-serious-game-ethics.x86_64"
patch_list=PoolStringArray( )
script_export_mode=1
script_encryption_key=""
[preset.0.options]
texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true
binary_format/64_bits=true
binary_format/embed_pck=true
custom_template/release=""
custom_template/debug=""
[preset.1]
name="HTML5"
platform="HTML5"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter="*.json"
exclude_filter=""
export_path="build/html/Pir-serious-game-ethics.html"
patch_list=PoolStringArray( )
script_export_mode=1
script_encryption_key=""
[preset.1.options]
vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=false
html/custom_html_shell=""
html/head_include=""
custom_template/release=""
custom_template/debug=""

View file

@ -1,16 +0,0 @@
[general]
singleton=true
load_once=true
symbol_prefix="godot_"
reloadable=false
[entry]
Windows.64="res://bin/win64/release/libgitapi.dll"
X11.64="res://bin/x11/release/libgitapi.so"
[dependencies]
Windows.64=[ ]
X11.64=[ ]

View file

@ -1,9 +0,0 @@
[gd_resource type="NativeScript" load_steps=2 format=2]
[ext_resource path="res://git_api.gdnlib" type="GDNativeLibrary" id=1]
[resource]
resource_name = "GitAPI"
class_name = "GitAPI"
library = ExtResource( 1 )
script_class_name = "GitAPI"

View file

@ -15,7 +15,6 @@
choices_multiple: [
{
title: "choix 1",
arc: 0,
infobox: {
title: "coucou !",
text: "ça va ?",

View file

@ -9,61 +9,25 @@
config_version=4
_global_script_classes=[ {
"base": "VBoxContainer",
"class": "Choice",
"language": "GDScript",
"path": "res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/Choice/Choice.gd"
}, {
"base": "VBoxContainer",
"class": "ChoicesList",
"language": "GDScript",
"path": "res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/ChoicesList.gd"
}, {
"base": "VBoxContainer",
"class": "Condition",
"language": "GDScript",
"path": "res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/Condition/Condition.gd"
}, {
"base": "VBoxContainer",
"class": "ConditionsList",
"language": "GDScript",
"path": "res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/ConditionsList.gd"
}, {
"base": "Node",
"class": "Dialogic",
"language": "GDScript",
"path": "res://addons/dialogic/Other/dialogic_class.gd"
"path": "res://addons/dialogic/Other/DialogicClass.gd"
}, {
"base": "Reference",
"class": "DialogicResources",
"language": "GDScript",
"path": "res://addons/dialogic/Other/DialogicResources.gd"
}, {
"base": "Reference",
"class": "DialogicUtil",
"language": "GDScript",
"path": "res://addons/dialogic/Other/DialogicUtil.gd"
}, {
"base": "",
"class": "GitAPI",
"language": "NativeScript",
"path": "res://git_api.gdns"
}, {
"base": "VBoxContainer",
"class": "Infobox",
"language": "GDScript",
"path": "res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Infobox/Infobox.gd"
}, {
"base": "GraphNode",
"class": "LineNode",
"language": "GDScript",
"path": "res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/line_node.gd"
} ]
_global_script_class_icons={
"Choice": "",
"ChoicesList": "",
"Condition": "",
"ConditionsList": "",
"Dialogic": "",
"DialogicUtil": "",
"GitAPI": "",
"Infobox": "",
"LineNode": ""
"DialogicResources": "",
"DialogicUtil": ""
}
[application]
@ -74,11 +38,11 @@ config/icon="res://icon.png"
[editor_plugins]
enabled=PoolStringArray( "EXP-System-Dialog", "Todo_Manager", "dialogic" )
enabled=PoolStringArray( "Todo_Manager", "dialogic" )
[gdnative]
singletons=[ "res://git_api.gdnlib" ]
singletons=[ ]
[rendering]