Browse Source

Update Dialogic and remove exp dialog plugin

Arnaud Vergnet 3 years ago
parent
commit
a1212b0f70
82 changed files with 779 additions and 3608 deletions
  1. 3
    7
      Main.gd
  2. 0
    76
      addons/EXP-System-Dialog/Dialog Editor/Dialog_Editor.tscn
  3. 0
    52
      addons/EXP-System-Dialog/Dialog Editor/Editor/Editor.tscn
  4. 0
    21
      addons/EXP-System-Dialog/Dialog Editor/Editor/editor.gd
  5. 0
    64
      addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/Choice/Choice.gd
  6. 0
    107
      addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/Choice/Choice.tscn
  7. 0
    74
      addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/ChoicesList.gd
  8. 0
    23
      addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/ChoicesList.tscn
  9. 0
    47
      addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/Condition/Condition.gd
  10. 0
    50
      addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/Condition/Condition.tscn
  11. 0
    69
      addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/ConditionsList.gd
  12. 0
    25
      addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/ConditionsList.tscn
  13. 0
    68
      addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Infobox/Infobox.gd
  14. 0
    67
      addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Infobox/Infobox.tscn
  15. 0
    201
      addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Line_Node.tscn
  16. 0
    1
      addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/icon_distraction_free.svg
  17. 0
    34
      addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/icon_distraction_free.svg.import
  18. 0
    184
      addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/line_node.gd
  19. 0
    224
      addons/EXP-System-Dialog/Dialog Editor/dialog_editor.gd
  20. BIN
      addons/EXP-System-Dialog/Images/de.png
  21. 0
    34
      addons/EXP-System-Dialog/Images/de.png.import
  22. BIN
      addons/EXP-System-Dialog/Images/icon.png
  23. 0
    34
      addons/EXP-System-Dialog/Images/icon.png.import
  24. BIN
      addons/EXP-System-Dialog/Images/se.png
  25. 0
    34
      addons/EXP-System-Dialog/Images/se.png.import
  26. 0
    83
      addons/EXP-System-Dialog/Reference_StoryReader/EXP_StoryReader.gd
  27. 0
    6
      addons/EXP-System-Dialog/Resource_BakedStory/EXP_BakedStory.gd
  28. 0
    9
      addons/EXP-System-Dialog/Resource_EditorStory/EXP_EditorStory.gd
  29. 0
    6
      addons/EXP-System-Dialog/Resource_NodeTemplate/EXP_NodeTemplate.gd
  30. 0
    109
      addons/EXP-System-Dialog/Story Editor/Dialog Record/Dialog_Record.tscn
  31. 0
    91
      addons/EXP-System-Dialog/Story Editor/Dialog Record/dialog_record.gd
  32. 0
    92
      addons/EXP-System-Dialog/Story Editor/Rename Record Box/Rename_Record_Box.tscn
  33. 0
    32
      addons/EXP-System-Dialog/Story Editor/Rename Record Box/rename_record_box.gd
  34. 0
    268
      addons/EXP-System-Dialog/Story Editor/Story_Editor.tscn
  35. 0
    753
      addons/EXP-System-Dialog/Story Editor/story_editor.gd
  36. 0
    7
      addons/EXP-System-Dialog/plugin.cfg
  37. 0
    87
      addons/EXP-System-Dialog/plugin.gd
  38. 5
    16
      addons/dialogic/Editor/CharacterEditor/CharacterEditor.gd
  39. 1
    1
      addons/dialogic/Editor/CharacterEditor/PortraitEntry.gd
  40. 9
    29
      addons/dialogic/Editor/DefinitionEditor/DefinitionEditor.gd
  41. 11
    22
      addons/dialogic/Editor/EditorView.gd
  42. 4
    4
      addons/dialogic/Editor/MasterTree/MasterTree.gd
  43. 1
    4
      addons/dialogic/Editor/Pieces/ChangeTimeline.gd
  44. 1
    1
      addons/dialogic/Editor/Pieces/CharacterJoinBlock.gd
  45. 1
    1
      addons/dialogic/Editor/Pieces/CharacterLeaveBlock.gd
  46. 1
    1
      addons/dialogic/Editor/Pieces/Common/CharacterPicker.gd
  47. 58
    0
      addons/dialogic/Editor/Pieces/Common/ConditionPicker.gd
  48. 13
    0
      addons/dialogic/Editor/Pieces/Common/ConditionPicker.tscn
  49. 2
    2
      addons/dialogic/Editor/Pieces/Common/DefinitionPicker.gd
  50. 23
    1
      addons/dialogic/Editor/Pieces/Common/DragController.gd
  51. 9
    1
      addons/dialogic/Editor/Pieces/IfCondition.gd
  52. 3
    6
      addons/dialogic/Editor/Pieces/IfCondition.tscn
  53. 2
    7
      addons/dialogic/Editor/SettingsEditor/SettingsEditor.gd
  54. 54
    47
      addons/dialogic/Editor/ThemeEditor/ThemeEditor.gd
  55. 9
    8
      addons/dialogic/Editor/ThemeEditor/ThemeEditor.tscn
  56. 13
    30
      addons/dialogic/Editor/TimelineEditor/TimelineEditor.gd
  57. 7
    3
      addons/dialogic/Nodes/Portrait.gd
  58. 72
    41
      addons/dialogic/Nodes/dialog_node.gd
  59. 7
    6
      addons/dialogic/Other/DialogicClass.gd
  60. 349
    0
      addons/dialogic/Other/DialogicResources.gd
  61. 41
    173
      addons/dialogic/Other/DialogicUtil.gd
  62. 3
    2
      addons/dialogic/dialogic.gd
  63. BIN
      characters/df-2.png
  64. 3
    3
      characters/df-2.png.import
  65. BIN
      characters/test/happy.png
  66. 0
    34
      characters/test/happy.png.import
  67. BIN
      characters/test/nice.png
  68. BIN
      characters/test/shock.png
  69. 0
    34
      characters/test/shock.png.import
  70. 0
    1
      dialogic/characters/character-1615795338.json
  71. 1
    0
      dialogic/characters/character-1615932195.json
  72. 6
    3
      dialogic/definitions.cfg
  73. 1
    1
      dialogic/settings.cfg
  74. 0
    14
      dialogic/themes/theme-1615795528.cfg
  75. 7
    0
      dialogic/themes/theme-1615930210.cfg
  76. 0
    1
      dialogic/timelines/timeline-1615795397.json
  77. 1
    0
      dialogic/timelines/timeline-1615930166.json
  78. 48
    0
      export_presets.cfg
  79. 0
    16
      git_api.gdnlib
  80. 0
    9
      git_api.gdns
  81. 0
    1
      json_example.json
  82. 10
    46
      project.godot

+ 3
- 7
Main.gd View File

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

+ 0
- 76
addons/EXP-System-Dialog/Dialog Editor/Dialog_Editor.tscn View File

@@ -1,76 +0,0 @@
1
-[gd_scene load_steps=2 format=2]
2
-
3
-[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/dialog_editor.gd" type="Script" id=1]
4
-
5
-[node name="Dialog_Editor" type="Control"]
6
-anchor_right = 1.0
7
-anchor_bottom = 1.0
8
-rect_min_size = Vector2( 0, 256 )
9
-script = ExtResource( 1 )
10
-__meta__ = {
11
-"_edit_use_anchors_": false
12
-}
13
-
14
-[node name="VBoxContainer" type="VBoxContainer" parent="."]
15
-anchor_right = 1.0
16
-anchor_bottom = 1.0
17
-__meta__ = {
18
-"_edit_use_anchors_": false
19
-}
20
-
21
-[node name="VBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
22
-margin_right = 1024.0
23
-margin_bottom = 20.0
24
-
25
-[node name="Close_BTN" type="Button" parent="VBoxContainer/VBoxContainer"]
26
-margin_right = 47.0
27
-margin_bottom = 20.0
28
-hint_tooltip = "Close the Dialog Editor."
29
-text = "Close"
30
-
31
-[node name="Back_BTN" type="Button" parent="VBoxContainer/VBoxContainer"]
32
-margin_left = 51.0
33
-margin_right = 93.0
34
-margin_bottom = 20.0
35
-hint_tooltip = "Return to the Story Editor."
36
-text = "Back"
37
-
38
-[node name="VSeparator" type="VSeparator" parent="VBoxContainer/VBoxContainer"]
39
-margin_left = 97.0
40
-margin_right = 101.0
41
-margin_bottom = 20.0
42
-
43
-[node name="Add_Node_BTN" type="Button" parent="VBoxContainer/VBoxContainer"]
44
-margin_left = 105.0
45
-margin_right = 180.0
46
-margin_bottom = 20.0
47
-hint_tooltip = "Add a new node to the graph."
48
-text = "Add Node"
49
-
50
-[node name="VSeparator2" type="VSeparator" parent="VBoxContainer/VBoxContainer"]
51
-margin_left = 184.0
52
-margin_right = 188.0
53
-margin_bottom = 20.0
54
-
55
-[node name="Human_Readable_LBL" type="Label" parent="VBoxContainer/VBoxContainer"]
56
-margin_left = 192.0
57
-margin_top = 3.0
58
-margin_right = 378.0
59
-margin_bottom = 17.0
60
-text = "Human Readable Description"
61
-
62
-[node name="GraphEdit" type="GraphEdit" parent="VBoxContainer"]
63
-margin_top = 24.0
64
-margin_right = 1024.0
65
-margin_bottom = 600.0
66
-size_flags_horizontal = 3
67
-size_flags_vertical = 3
68
-right_disconnects = true
69
-__meta__ = {
70
-"_edit_use_anchors_": false
71
-}
72
-[connection signal="pressed" from="VBoxContainer/VBoxContainer/Close_BTN" to="." method="_on_Close_BTN_pressed"]
73
-[connection signal="pressed" from="VBoxContainer/VBoxContainer/Back_BTN" to="." method="_on_Back_BTN_pressed"]
74
-[connection signal="pressed" from="VBoxContainer/VBoxContainer/Add_Node_BTN" to="." method="_on_Add_Node_BTN_pressed"]
75
-[connection signal="connection_request" from="VBoxContainer/GraphEdit" to="." method="_on_GraphEdit_connection_request"]
76
-[connection signal="disconnection_request" from="VBoxContainer/GraphEdit" to="." method="_on_GraphEdit_disconnection_request"]

+ 0
- 52
addons/EXP-System-Dialog/Dialog Editor/Editor/Editor.tscn View File

@@ -1,52 +0,0 @@
1
-[gd_scene load_steps=2 format=2]
2
-
3
-[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Editor/editor.gd" type="Script" id=1]
4
-
5
-[node name="WindowDialog" type="WindowDialog"]
6
-anchor_left = 0.5
7
-anchor_top = 0.5
8
-anchor_right = 0.5
9
-anchor_bottom = 0.5
10
-margin_left = -540.0
11
-margin_top = -384.0
12
-margin_right = 540.0
13
-margin_bottom = 384.0
14
-window_title = "Node Editor"
15
-resizable = true
16
-script = ExtResource( 1 )
17
-__meta__ = {
18
-"_edit_use_anchors_": false
19
-}
20
-
21
-[node name="VBoxContainer" type="VBoxContainer" parent="."]
22
-anchor_right = 1.0
23
-anchor_bottom = 1.0
24
-margin_left = 13.0
25
-margin_top = 13.0
26
-margin_right = -13.0
27
-margin_bottom = -13.0
28
-__meta__ = {
29
-"_edit_use_anchors_": false
30
-}
31
-
32
-[node name="TextEdit" type="TextEdit" parent="VBoxContainer"]
33
-margin_right = 1054.0
34
-margin_bottom = 718.0
35
-size_flags_horizontal = 3
36
-size_flags_vertical = 3
37
-smooth_scrolling = true
38
-__meta__ = {
39
-"_edit_use_anchors_": false
40
-}
41
-
42
-[node name="OK_BTN" type="Button" parent="VBoxContainer"]
43
-margin_left = 503.0
44
-margin_top = 722.0
45
-margin_right = 550.0
46
-margin_bottom = 742.0
47
-hint_tooltip = "Close the node editor."
48
-size_flags_horizontal = 4
49
-size_flags_vertical = 0
50
-text = "Close"
51
-[connection signal="text_changed" from="VBoxContainer/TextEdit" to="." method="_on_TextEdit_text_changed"]
52
-[connection signal="pressed" from="VBoxContainer/OK_BTN" to="." method="_on_OK_BTN_pressed"]

+ 0
- 21
addons/EXP-System-Dialog/Dialog Editor/Editor/editor.gd View File

@@ -1,21 +0,0 @@
1
-tool
2
-extends WindowDialog
3
-
4
-onready var _Text_Editor = self.get_node("VBoxContainer/TextEdit")
5
-
6
-var _Target_Node
7
-
8
-#Public Methods
9
-
10
-func set_target_node(node):
11
-	self._Target_Node = node
12
-	self._Text_Editor.text = node.get_text()
13
-
14
-#Callback Methods
15
-
16
-func _on_OK_BTN_pressed():
17
-	self.visible = false
18
-
19
-
20
-func _on_TextEdit_text_changed():
21
-	self._Target_Node.set_text(self._Text_Editor.text)

+ 0
- 64
addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/Choice/Choice.gd View File

@@ -1,64 +0,0 @@
1
-tool
2
-extends VBoxContainer
3
-
4
-class_name Choice
5
-
6
-signal choice_changed(index, new_json_structure)
7
-signal choice_removed(index)
8
-
9
-onready var _ChoiceTitleLineEdit: LineEdit = self.get_node("HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer/ChoiceTitleLineEdit")
10
-onready var _ChoiceLabel: Label = self.get_node("HBoxContainer/MarginContainer/VBoxContainer/ChoiceLabel")
11
-onready var _Infobox: Infobox = self.get_node("HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/Infobox")
12
-onready var _ConditionsList: ConditionsList = self.get_node("HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/MarginContainer/ConditionsList")
13
-
14
-var _id : int = 0;
15
-
16
-var _json_structure := {
17
-	"title": "",
18
-	"conditions": []
19
-}
20
-
21
-#Callback Methods
22
-
23
-func _on_ChoiceTitleLineEdit_text_changed(new_text):
24
-	_json_structure.title = new_text
25
-	_emit_changed_signal()
26
-
27
-
28
-func _on_ChoiceRemoveButton_pressed():
29
-	emit_signal("choice_removed", _id)
30
-
31
-
32
-func _on_ConditionsList_conditions_changed(new_json_structure):
33
-	_json_structure.conditions = new_json_structure
34
-	_emit_changed_signal()
35
-
36
-
37
-func _on_Infobox_infobox_removed():
38
-	_json_structure.erase("infobox")
39
-	_emit_changed_signal()
40
-
41
-
42
-func _on_Infobox_infobox_changed(new_json_structure):
43
-	_json_structure.infobox = new_json_structure
44
-	_emit_changed_signal()
45
-
46
-
47
-#Public Methods
48
-
49
-func set_structure(new_json_structure):
50
-	_json_structure = new_json_structure
51
-	_ChoiceTitleLineEdit.set_text(_json_structure.title)
52
-	if ("infobox" in _json_structure):
53
-		_Infobox.set_structure(_json_structure.infobox)
54
-	_ConditionsList.set_structure(_json_structure.conditions)
55
-	
56
-
57
-func set_id(new_id):
58
-	self._id = new_id;
59
-	_ChoiceLabel.set_text("Choice #" + str(new_id + 1))
60
-
61
-#Private Methods
62
-
63
-func _emit_changed_signal():
64
-	emit_signal("choice_changed", _id, _json_structure)

+ 0
- 107
addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/Choice/Choice.tscn View File

@@ -1,107 +0,0 @@
1
-[gd_scene load_steps=4 format=2]
2
-
3
-[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/Choice/Choice.gd" type="Script" id=1]
4
-[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/ConditionsList.tscn" type="PackedScene" id=2]
5
-[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Infobox/Infobox.tscn" type="PackedScene" id=3]
6
-
7
-[node name="Choice" type="VBoxContainer"]
8
-margin_right = 272.0
9
-margin_bottom = 156.0
10
-script = ExtResource( 1 )
11
-__meta__ = {
12
-"_edit_use_anchors_": false
13
-}
14
-
15
-[node name="HBoxContainer" type="HBoxContainer" parent="."]
16
-margin_right = 272.0
17
-margin_bottom = 230.0
18
-
19
-[node name="MarginContainer" type="MarginContainer" parent="HBoxContainer"]
20
-margin_right = 272.0
21
-margin_bottom = 230.0
22
-size_flags_horizontal = 3
23
-custom_constants/margin_right = 5
24
-custom_constants/margin_top = 5
25
-custom_constants/margin_left = 5
26
-custom_constants/margin_bottom = 5
27
-__meta__ = {
28
-"_edit_use_anchors_": false
29
-}
30
-
31
-[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/MarginContainer"]
32
-margin_left = 5.0
33
-margin_top = 5.0
34
-margin_right = 267.0
35
-margin_bottom = 225.0
36
-size_flags_horizontal = 3
37
-__meta__ = {
38
-"_edit_use_anchors_": false
39
-}
40
-
41
-[node name="ChoiceLabel" type="Label" parent="HBoxContainer/MarginContainer/VBoxContainer"]
42
-margin_right = 262.0
43
-margin_bottom = 14.0
44
-text = "Choice #1"
45
-align = 1
46
-
47
-[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/MarginContainer/VBoxContainer"]
48
-margin_top = 18.0
49
-margin_right = 262.0
50
-margin_bottom = 220.0
51
-
52
-[node name="HBoxContainer2" type="HBoxContainer" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer"]
53
-margin_right = 262.0
54
-margin_bottom = 202.0
55
-
56
-[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2"]
57
-margin_right = 238.0
58
-margin_bottom = 202.0
59
-size_flags_horizontal = 3
60
-
61
-[node name="HBoxContainer" type="HBoxContainer" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
62
-margin_right = 238.0
63
-margin_bottom = 24.0
64
-size_flags_horizontal = 3
65
-
66
-[node name="ChoiceTitleLabel" type="Label" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer"]
67
-margin_top = 5.0
68
-margin_right = 32.0
69
-margin_bottom = 19.0
70
-text = "Title:"
71
-
72
-[node name="ChoiceTitleLineEdit" type="LineEdit" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer"]
73
-margin_left = 36.0
74
-margin_right = 238.0
75
-margin_bottom = 24.0
76
-size_flags_horizontal = 3
77
-
78
-[node name="Infobox" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer" instance=ExtResource( 3 )]
79
-margin_bottom = 164.0
80
-
81
-[node name="MarginContainer" type="MarginContainer" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
82
-margin_top = 168.0
83
-margin_right = 238.0
84
-margin_bottom = 202.0
85
-custom_constants/margin_right = 5
86
-custom_constants/margin_top = 5
87
-custom_constants/margin_left = 5
88
-custom_constants/margin_bottom = 5
89
-
90
-[node name="ConditionsList" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/MarginContainer" instance=ExtResource( 2 )]
91
-margin_bottom = 29.0
92
-
93
-[node name="ChoiceRemoveButton" type="Button" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2"]
94
-margin_left = 242.0
95
-margin_right = 262.0
96
-margin_bottom = 202.0
97
-text = "X"
98
-
99
-[node name="HSeparator" type="HSeparator" parent="."]
100
-margin_top = 234.0
101
-margin_right = 272.0
102
-margin_bottom = 238.0
103
-[connection signal="text_changed" from="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer/ChoiceTitleLineEdit" to="." method="_on_ChoiceTitleLineEdit_text_changed"]
104
-[connection signal="infobox_changed" from="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/Infobox" to="." method="_on_Infobox_infobox_changed"]
105
-[connection signal="infobox_removed" from="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/Infobox" to="." method="_on_Infobox_infobox_removed"]
106
-[connection signal="conditions_changed" from="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/MarginContainer/ConditionsList" to="." method="_on_ConditionsList_conditions_changed"]
107
-[connection signal="pressed" from="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/ChoiceRemoveButton" to="." method="_on_ChoiceRemoveButton_pressed"]

+ 0
- 74
addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/ChoicesList.gd View File

@@ -1,74 +0,0 @@
1
-tool
2
-extends VBoxContainer
3
-
4
-class_name ChoicesList
5
-
6
-signal choices_changed(new_json_structure)
7
-
8
-var _choice_scene = preload("res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/Choice/Choice.tscn")
9
-
10
-onready var _VBoxContainer: VBoxContainer = self.get_node("VBoxContainer")
11
-
12
-var _json_structure: Array = []
13
-var _nodes: Array = []
14
-
15
-#Callback Methods
16
-
17
-func _on_choice_changed(index, new_structure):
18
-	_json_structure[index] = new_structure
19
-	_emit_changed_signal()
20
-
21
-func _on_choice_removed(index):
22
-	_json_structure.remove(index)
23
-	_remove_choice_node(index)
24
-	_emit_changed_signal()
25
-
26
-func _on_ChoiceAddButton_pressed():
27
-	add_choice()
28
-
29
-
30
-#Public Methods
31
-
32
-func add_choice():
33
-	_json_structure.append({
34
-		"title": "",
35
-		"conditions": []
36
-	})
37
-	_add_choice_node(_json_structure.size() - 1)
38
-	_emit_changed_signal()
39
-
40
-func set_structure(new_json_structure):
41
-	_json_structure = new_json_structure
42
-	_clear_choice_nodes()
43
-	for i in range(0, _json_structure.size()):
44
-		var node: Choice = _add_choice_node(i)
45
-		node.set_structure(_json_structure[i])
46
-
47
-#Private Methods
48
-
49
-func _emit_changed_signal():
50
-	emit_signal("choices_changed", _json_structure)
51
-
52
-func _add_choice_node(id: int):
53
-	var node: Choice = _choice_scene.instance()
54
-	_VBoxContainer.add_child(node)
55
-	node.set_id(id)
56
-	_nodes.append(node)
57
-	node.connect("choice_changed", self, "_on_choice_changed")
58
-	node.connect("choice_removed", self, "_on_choice_removed")
59
-	return node
60
-
61
-func _remove_choice_node(index):
62
-	# Remove the node
63
-	if (index >= 0 and index < _nodes.size()):
64
-		_nodes[index].queue_free()
65
-		_nodes.remove(index)
66
-		# Update remaining nodes indexes
67
-		for i in range(0, _nodes.size()):
68
-			_nodes[i].set_id(i)
69
-
70
-
71
-func _clear_choice_nodes():
72
-	_nodes.clear()
73
-	for node in _VBoxContainer.get_children():
74
-		node.queue_free()

+ 0
- 23
addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/ChoicesList.tscn View File

@@ -1,23 +0,0 @@
1
-[gd_scene load_steps=2 format=2]
2
-
3
-[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/ChoicesList.gd" type="Script" id=2]
4
-
5
-[node name="ChoicesList" type="VBoxContainer"]
6
-margin_top = 242.0
7
-margin_right = 272.0
8
-margin_bottom = 422.0
9
-script = ExtResource( 2 )
10
-__meta__ = {
11
-"_edit_use_anchors_": false
12
-}
13
-
14
-[node name="VBoxContainer" type="VBoxContainer" parent="."]
15
-margin_right = 272.0
16
-size_flags_horizontal = 3
17
-
18
-[node name="ChoiceAddButton" type="Button" parent="."]
19
-margin_top = 4.0
20
-margin_right = 272.0
21
-margin_bottom = 24.0
22
-text = "Add choice"
23
-[connection signal="pressed" from="ChoiceAddButton" to="." method="_on_ChoiceAddButton_pressed"]

+ 0
- 47
addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/Condition/Condition.gd View File

@@ -1,47 +0,0 @@
1
-tool
2
-extends VBoxContainer
3
-
4
-class_name Condition
5
-
6
-signal condition_changed(index, new_json_structure)
7
-signal condition_removed(index)
8
-
9
-onready var _ConditionLabel: Label = self.get_node("ContitionLabel")
10
-onready var _ContitionNameLineEdit: LineEdit = self.get_node("HBoxContainer2/ContitionNameLineEdit")
11
-onready var _ContitionValueSpinBox: SpinBox = self.get_node("HBoxContainer2/ContitionValueSpinBox")
12
-
13
-var _id : int = 0;
14
-
15
-var _json_structure = {
16
-	"id": "",
17
-	"value": 0
18
-}
19
-
20
-#Callback Methods
21
-
22
-func _on_ContitionNameLineEdit_text_changed(new_text):
23
-	_json_structure.id = new_text
24
-	emit_signal("condition_changed", _id, _json_structure)
25
-
26
-
27
-func _on_ContitionValueSpinBox_value_changed(value):
28
-	_json_structure.value = value
29
-	emit_signal("condition_changed", _id, _json_structure)
30
-
31
-
32
-func _on_ContitionRemoveButton_pressed():
33
-	emit_signal("condition_removed", _id)
34
-
35
-#Public Methods
36
-
37
-func set_structure(new_json_structure):
38
-	_json_structure = new_json_structure
39
-	_ContitionNameLineEdit.text = _json_structure.id
40
-	_ContitionValueSpinBox.value = _json_structure.value
41
-	
42
-
43
-
44
-func set_id(new_id):
45
-	self._id = new_id;
46
-	_ConditionLabel.set_text("Condition #" + str(new_id + 1))
47
-

+ 0
- 50
addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/Condition/Condition.tscn View File

@@ -1,50 +0,0 @@
1
-[gd_scene load_steps=2 format=2]
2
-
3
-[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/Condition/Condition.gd" type="Script" id=1]
4
-
5
-[node name="Condition" type="VBoxContainer"]
6
-margin_right = 228.0
7
-margin_bottom = 50.0
8
-size_flags_horizontal = 3
9
-script = ExtResource( 1 )
10
-__meta__ = {
11
-"_edit_use_anchors_": false
12
-}
13
-
14
-[node name="HSeparator2" type="HSeparator" parent="."]
15
-margin_right = 228.0
16
-margin_bottom = 4.0
17
-__meta__ = {
18
-"_edit_use_anchors_": false
19
-}
20
-
21
-[node name="ContitionLabel" type="Label" parent="."]
22
-margin_top = 8.0
23
-margin_right = 228.0
24
-margin_bottom = 22.0
25
-text = "Condition #1"
26
-
27
-[node name="HBoxContainer2" type="HBoxContainer" parent="."]
28
-margin_top = 26.0
29
-margin_right = 228.0
30
-margin_bottom = 50.0
31
-size_flags_horizontal = 3
32
-
33
-[node name="ContitionNameLineEdit" type="LineEdit" parent="HBoxContainer2"]
34
-margin_right = 127.0
35
-margin_bottom = 24.0
36
-size_flags_horizontal = 3
37
-
38
-[node name="ContitionValueSpinBox" type="SpinBox" parent="HBoxContainer2"]
39
-margin_left = 131.0
40
-margin_right = 205.0
41
-margin_bottom = 24.0
42
-
43
-[node name="ContitionRemoveButton" type="Button" parent="HBoxContainer2"]
44
-margin_left = 209.0
45
-margin_right = 228.0
46
-margin_bottom = 24.0
47
-text = "x"
48
-[connection signal="text_changed" from="HBoxContainer2/ContitionNameLineEdit" to="." method="_on_ContitionNameLineEdit_text_changed"]
49
-[connection signal="value_changed" from="HBoxContainer2/ContitionValueSpinBox" to="." method="_on_ContitionValueSpinBox_value_changed"]
50
-[connection signal="pressed" from="HBoxContainer2/ContitionRemoveButton" to="." method="_on_ContitionRemoveButton_pressed"]

+ 0
- 69
addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/ConditionsList.gd View File

@@ -1,69 +0,0 @@
1
-tool
2
-extends VBoxContainer
3
-
4
-class_name ConditionsList
5
-
6
-signal conditions_changed(new_json_structure)
7
-
8
-var _condition_scene = preload("res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/Condition/Condition.tscn")
9
-
10
-onready var _VBoxContainer = self.get_node("VBoxContainer")
11
-
12
-var _json_structure = []
13
-var _nodes = []
14
-
15
-#Callback Methods
16
-
17
-func _on_condition_changed(index, new_structure):
18
-	_json_structure[index] = new_structure
19
-	_emit_changed_signal()
20
-
21
-func _on_condition_removed(index):
22
-	_json_structure.remove(index)
23
-	_remove_choice_node(index)
24
-	_emit_changed_signal()
25
-
26
-func _on_ContitionAddButton_pressed():
27
-	add_condition(
28
-		{
29
-			"id": "",
30
-			"value": 0
31
-		}, 
32
-		_json_structure.size() - 1
33
-	)
34
-
35
-#Public Methods
36
-
37
-func set_structure(new_json_structure):
38
-	_json_structure = new_json_structure
39
-	for i in range(0, _json_structure.size()):
40
-		add_condition(_json_structure[0], i)
41
-
42
-
43
-func add_condition(structure: Dictionary, id: int):
44
-	_json_structure.append(structure)
45
-	_add_choice_node(structure, id)
46
-	_emit_changed_signal()
47
-
48
-#Private Methods
49
-
50
-func _emit_changed_signal():
51
-	emit_signal("conditions_changed", _json_structure)
52
-
53
-func _add_choice_node(structure: Dictionary, id: int):
54
-	var node: Condition = _condition_scene.instance()
55
-	_VBoxContainer.add_child(node)
56
-	node.set_id(id)
57
-	node.set_structure(structure)
58
-	_nodes.append(node)
59
-	node.connect("condition_changed", self, "_on_condition_changed")
60
-	node.connect("condition_removed", self, "_on_condition_removed")
61
-	return node
62
-
63
-func _remove_choice_node(index):
64
-	# Remove the node
65
-	_nodes[index].queue_free()
66
-	_nodes.remove(index)
67
-	# Update remaining nodes indexes
68
-	for i in range(0, _nodes.size()):
69
-		_nodes[i].set_id(i)

+ 0
- 25
addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/ConditionsList.tscn View File

@@ -1,25 +0,0 @@
1
-[gd_scene load_steps=2 format=2]
2
-
3
-[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/ConditionsList.gd" type="Script" id=1]
4
-
5
-[node name="ConditionsList" type="VBoxContainer"]
6
-margin_left = 5.0
7
-margin_top = 5.0
8
-margin_right = 233.0
9
-margin_bottom = 79.0
10
-size_flags_horizontal = 3
11
-script = ExtResource( 1 )
12
-__meta__ = {
13
-"_edit_use_anchors_": false
14
-}
15
-
16
-[node name="VBoxContainer" type="VBoxContainer" parent="."]
17
-margin_right = 228.0
18
-size_flags_horizontal = 3
19
-
20
-[node name="ContitionAddButton" type="Button" parent="."]
21
-margin_top = 4.0
22
-margin_right = 228.0
23
-margin_bottom = 24.0
24
-text = "Add condition"
25
-[connection signal="pressed" from="ContitionAddButton" to="." method="_on_ContitionAddButton_pressed"]

+ 0
- 68
addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Infobox/Infobox.gd View File

@@ -1,68 +0,0 @@
1
-tool
2
-extends VBoxContainer
3
-
4
-class_name Infobox
5
-
6
-signal infobox_changed(new_json_structure)
7
-signal infobox_removed()
8
-
9
-onready var _TextEdit: TextEdit = self.get_node("HBoxContainer/VBoxContainer/TextEdit")
10
-onready var _CreateButton: Button = self.get_node("CreateButton")
11
-onready var _HBoxContainer: HBoxContainer = self.get_node("HBoxContainer")
12
-onready var _ConditionsList: ConditionsList = self.get_node("HBoxContainer/VBoxContainer/ConditionsList")
13
-
14
-var _json_structure = {
15
-	"text": "",
16
-	"conditions": []
17
-}
18
-
19
-#Virtual Methods
20
-
21
-func _ready():
22
-	_CreateButton.show()
23
-	_HBoxContainer.hide()
24
-
25
-
26
-#Callback Methods
27
-
28
-func _on_RemoveInfoboxButton_pressed():
29
-	_disable_infobox()
30
-	emit_signal("infobox_removed")
31
-
32
-func _on_ConditionsList_conditions_changed(new_json_structure):
33
-	_json_structure.conditions = new_json_structure
34
-	_emit_changed_signal()
35
-
36
-func _on_TextEdit_text_changed():
37
-	_json_structure.text = self._TextEdit.get_text()
38
-	_emit_changed_signal()
39
-
40
-
41
-func _on_CreateButton_pressed():
42
-	_enable_infobox()
43
-	_emit_changed_signal()
44
-
45
-#Public Methods
46
-
47
-func set_structure(new_json_structure):
48
-	_json_structure = new_json_structure
49
-	_TextEdit.set_text(_json_structure.text)
50
-	_ConditionsList.set_structure(_json_structure.conditions)
51
-	_enable_infobox()
52
-
53
-#Private Methods
54
-
55
-func _enable_infobox():
56
-	_CreateButton.hide()
57
-	_HBoxContainer.show()
58
-
59
-
60
-func _disable_infobox():
61
-	_CreateButton.show()
62
-	_HBoxContainer.hide()
63
-
64
-
65
-func _emit_changed_signal():
66
-	emit_signal("infobox_changed", _json_structure)
67
-
68
-

+ 0
- 67
addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Infobox/Infobox.tscn View File

@@ -1,67 +0,0 @@
1
-[gd_scene load_steps=3 format=2]
2
-
3
-[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Infobox/Infobox.gd" type="Script" id=1]
4
-[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/ConditionsList.tscn" type="PackedScene" id=2]
5
-
6
-[node name="Infobox" type="VBoxContainer"]
7
-margin_top = 28.0
8
-margin_right = 238.0
9
-margin_bottom = 112.0
10
-script = ExtResource( 1 )
11
-__meta__ = {
12
-"_edit_use_anchors_": false
13
-}
14
-
15
-[node name="HBoxContainer" type="HBoxContainer" parent="."]
16
-margin_right = 238.0
17
-margin_bottom = 112.0
18
-
19
-[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"]
20
-margin_right = 215.0
21
-margin_bottom = 112.0
22
-size_flags_horizontal = 3
23
-
24
-[node name="HSeparator" type="HSeparator" parent="HBoxContainer/VBoxContainer"]
25
-margin_right = 215.0
26
-margin_bottom = 4.0
27
-
28
-[node name="Label" type="Label" parent="HBoxContainer/VBoxContainer"]
29
-margin_top = 8.0
30
-margin_right = 215.0
31
-margin_bottom = 22.0
32
-text = "Infobox"
33
-align = 1
34
-
35
-[node name="TextEdit" type="TextEdit" parent="HBoxContainer/VBoxContainer"]
36
-margin_top = 26.0
37
-margin_right = 215.0
38
-margin_bottom = 76.0
39
-rect_min_size = Vector2( 0, 50 )
40
-size_flags_horizontal = 3
41
-
42
-[node name="ConditionsList" parent="HBoxContainer/VBoxContainer" instance=ExtResource( 2 )]
43
-margin_left = 0.0
44
-margin_top = 80.0
45
-margin_right = 215.0
46
-margin_bottom = 104.0
47
-
48
-[node name="HSeparator2" type="HSeparator" parent="HBoxContainer/VBoxContainer"]
49
-margin_top = 108.0
50
-margin_right = 215.0
51
-margin_bottom = 112.0
52
-
53
-[node name="RemoveInfoboxButton" type="Button" parent="HBoxContainer"]
54
-margin_left = 219.0
55
-margin_right = 238.0
56
-margin_bottom = 112.0
57
-text = "x"
58
-
59
-[node name="CreateButton" type="Button" parent="."]
60
-margin_top = 116.0
61
-margin_right = 238.0
62
-margin_bottom = 136.0
63
-text = "Create Infobox"
64
-[connection signal="text_changed" from="HBoxContainer/VBoxContainer/TextEdit" to="." method="_on_TextEdit_text_changed"]
65
-[connection signal="conditions_changed" from="HBoxContainer/VBoxContainer/ConditionsList" to="." method="_on_ConditionsList_conditions_changed"]
66
-[connection signal="pressed" from="HBoxContainer/RemoveInfoboxButton" to="." method="_on_RemoveInfoboxButton_pressed"]
67
-[connection signal="pressed" from="CreateButton" to="." method="_on_CreateButton_pressed"]

+ 0
- 201
addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Line_Node.tscn View File

@@ -1,201 +0,0 @@
1
-[gd_scene load_steps=4 format=2]
2
-
3
-[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/line_node.gd" type="Script" id=1]
4
-[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/icon_distraction_free.svg" type="Texture" id=2]
5
-[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/ChoicesList.tscn" type="PackedScene" id=3]
6
-
7
-[node name="Line" type="GraphNode"]
8
-margin_right = 324.0
9
-margin_bottom = 375.0
10
-rect_min_size = Vector2( 324, 137 )
11
-title = "Line"
12
-offset = Vector2( 40, 40 )
13
-show_close = true
14
-resizable = true
15
-slot/0/left_enabled = true
16
-slot/0/left_type = 0
17
-slot/0/left_color = Color( 1, 1, 1, 1 )
18
-slot/0/right_enabled = true
19
-slot/0/right_type = 0
20
-slot/0/right_color = Color( 1, 1, 1, 1 )
21
-slot/1/left_enabled = false
22
-slot/1/left_type = 0
23
-slot/1/left_color = Color( 1, 1, 1, 1 )
24
-slot/1/right_enabled = false
25
-slot/1/right_type = 0
26
-slot/1/right_color = Color( 1, 1, 1, 1 )
27
-script = ExtResource( 1 )
28
-__meta__ = {
29
-"_edit_use_anchors_": false
30
-}
31
-
32
-[node name="MarginContainer" type="MarginContainer" parent="."]
33
-margin_left = 16.0
34
-margin_top = 39.0
35
-margin_right = 308.0
36
-margin_bottom = 329.0
37
-custom_constants/margin_right = 10
38
-custom_constants/margin_top = 10
39
-custom_constants/margin_left = 10
40
-custom_constants/margin_bottom = 10
41
-
42
-[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
43
-margin_left = 10.0
44
-margin_top = 10.0
45
-margin_right = 282.0
46
-margin_bottom = 280.0
47
-size_flags_horizontal = 3
48
-size_flags_vertical = 3
49
-__meta__ = {
50
-"_edit_use_anchors_": false
51
-}
52
-
53
-[node name="HBoxContainer3" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
54
-margin_right = 272.0
55
-margin_bottom = 70.0
56
-
57
-[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer3"]
58
-margin_right = 272.0
59
-margin_bottom = 70.0
60
-size_flags_horizontal = 3
61
-
62
-[node name="SpeakerLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer"]
63
-margin_right = 272.0
64
-margin_bottom = 14.0
65
-text = "Speaker"
66
-align = 1
67
-
68
-[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer"]
69
-margin_left = 89.0
70
-margin_top = 18.0
71
-margin_right = 183.0
72
-margin_bottom = 42.0
73
-size_flags_horizontal = 4
74
-
75
-[node name="SpeakerIdLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer"]
76
-margin_top = 5.0
77
-margin_right = 16.0
78
-margin_bottom = 19.0
79
-text = "id:"
80
-
81
-[node name="SpeakerIdSpinBox" type="SpinBox" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer"]
82
-margin_left = 20.0
83
-margin_right = 94.0
84
-margin_bottom = 24.0
85
-
86
-[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer"]
87
-margin_top = 46.0
88
-margin_right = 272.0
89
-margin_bottom = 70.0
90
-
91
-[node name="SpeakerEmotionLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer2"]
92
-margin_top = 5.0
93
-margin_right = 57.0
94
-margin_bottom = 19.0
95
-text = "Emotion:"
96
-
97
-[node name="SpeakerEmotionLineEdit" type="LineEdit" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer2"]
98
-margin_left = 61.0
99
-margin_right = 272.0
100
-margin_bottom = 24.0
101
-size_flags_horizontal = 3
102
-
103
-[node name="HSeparator" type="HSeparator" parent="MarginContainer/VBoxContainer"]
104
-margin_top = 74.0
105
-margin_right = 272.0
106
-margin_bottom = 78.0
107
-
108
-[node name="HBoxContainer4" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
109
-margin_top = 82.0
110
-margin_right = 272.0
111
-margin_bottom = 124.0
112
-
113
-[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer4"]
114
-margin_right = 272.0
115
-margin_bottom = 42.0
116
-size_flags_horizontal = 3
117
-
118
-[node name="SceneLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer"]
119
-margin_right = 272.0
120
-margin_bottom = 14.0
121
-text = "Scene"
122
-align = 1
123
-
124
-[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer"]
125
-margin_left = 89.0
126
-margin_top = 18.0
127
-margin_right = 183.0
128
-margin_bottom = 42.0
129
-size_flags_horizontal = 4
130
-
131
-[node name="SceneIdLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/HBoxContainer"]
132
-margin_top = 5.0
133
-margin_right = 16.0
134
-margin_bottom = 19.0
135
-text = "id:"
136
-
137
-[node name="SceneIdSpinBox" type="SpinBox" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/HBoxContainer"]
138
-margin_left = 20.0
139
-margin_right = 94.0
140
-margin_bottom = 24.0
141
-
142
-[node name="HSeparator2" type="HSeparator" parent="MarginContainer/VBoxContainer"]
143
-margin_top = 128.0
144
-margin_right = 272.0
145
-margin_bottom = 132.0
146
-
147
-[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
148
-margin_top = 136.0
149
-margin_right = 272.0
150
-margin_bottom = 234.0
151
-
152
-[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
153
-margin_right = 272.0
154
-margin_bottom = 98.0
155
-size_flags_horizontal = 3
156
-
157
-[node name="DialogLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
158
-margin_right = 272.0
159
-margin_bottom = 14.0
160
-text = "Message"
161
-align = 1
162
-
163
-[node name="MessageTextEdit" type="TextEdit" parent="MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
164
-margin_top = 18.0
165
-margin_right = 272.0
166
-margin_bottom = 98.0
167
-rect_min_size = Vector2( 256, 80 )
168
-size_flags_horizontal = 3
169
-size_flags_vertical = 3
170
-smooth_scrolling = true
171
-
172
-[node name="Editor_BTN" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
173
-visible = false
174
-margin_left = 260.0
175
-margin_right = 292.0
176
-margin_bottom = 82.0
177
-rect_min_size = Vector2( 32, 0 )
178
-hint_tooltip = "Expand this node's text editor."
179
-icon = ExtResource( 2 )
180
-expand_icon = true
181
-
182
-[node name="HSeparator3" type="HSeparator" parent="MarginContainer/VBoxContainer"]
183
-margin_top = 238.0
184
-margin_right = 272.0
185
-margin_bottom = 242.0
186
-__meta__ = {
187
-"_edit_use_anchors_": false
188
-}
189
-
190
-[node name="ChoicesList" parent="MarginContainer/VBoxContainer" instance=ExtResource( 3 )]
191
-margin_top = 246.0
192
-margin_bottom = 270.0
193
-[connection signal="close_request" from="." to="." method="_on_Line_close_request"]
194
-[connection signal="offset_changed" from="." to="." method="_on_Line_offset_changed"]
195
-[connection signal="resize_request" from="." to="." method="_on_Line_resize_request"]
196
-[connection signal="value_changed" from="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer/SpeakerIdSpinBox" to="." method="_on_SpeakerIdSpinBox_value_changed"]
197
-[connection signal="text_changed" from="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer2/SpeakerEmotionLineEdit" to="." method="_on_SpeakerEmotionLineEdit_text_changed"]
198
-[connection signal="value_changed" from="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/HBoxContainer/SceneIdSpinBox" to="." method="_on_SceneIdSpinBox_value_changed"]
199
-[connection signal="text_changed" from="MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer/MessageTextEdit" to="." method="_on_MessageTextEdit_text_changed"]
200
-[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer2/Editor_BTN" to="." method="_on_Editor_BTN_pressed"]
201
-[connection signal="choices_changed" from="MarginContainer/VBoxContainer/ChoicesList" to="." method="_on_ChoicesList_choices_changed"]

+ 0
- 1
addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/icon_distraction_free.svg View File

@@ -1 +0,0 @@
1
-<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>

+ 0
- 34
addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/icon_distraction_free.svg.import View File

@@ -1,34 +0,0 @@
1
-[remap]
2
-
3
-importer="texture"
4
-type="StreamTexture"
5
-path="res://.import/icon_distraction_free.svg-5120bf5545890a3868c1108c903f7cd9.stex"
6
-metadata={
7
-"vram_texture": false
8
-}
9
-
10
-[deps]
11
-
12
-source_file="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/icon_distraction_free.svg"
13
-dest_files=[ "res://.import/icon_distraction_free.svg-5120bf5545890a3868c1108c903f7cd9.stex" ]
14
-
15
-[params]
16
-
17
-compress/mode=0
18
-compress/lossy_quality=0.7
19
-compress/hdr_mode=0
20
-compress/bptc_ldr=0
21
-compress/normal_map=0
22
-flags/repeat=0
23
-flags/filter=true
24
-flags/mipmaps=false
25
-flags/anisotropic=false
26
-flags/srgb=2
27
-process/fix_alpha_border=true
28
-process/premult_alpha=false
29
-process/HDR_as_SRGB=false
30
-process/invert_color=false
31
-stream=false
32
-size_limit=0
33
-detect_3d=true
34
-svg/scale=1.0

+ 0
- 184
addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/line_node.gd View File

@@ -1,184 +0,0 @@
1
-tool
2
-extends GraphNode
3
-
4
-class_name LineNode
5
-
6
-signal changed_offset(nid, vec2)
7
-signal changed_size(this)
8
-signal changed_slots(this)
9
-signal erased(this)
10
-signal pressed_editor(this)
11
-signal pressed_load(this)
12
-signal pressed_save(this)
13
-signal text_changed(nid, new_text)
14
-
15
-
16
-onready var _SpeakerIdSpinBox: SpinBox = self.get_node("MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer/SpeakerIdSpinBox")
17
-onready var _SpeakerEmotionLineEdit: LineEdit = self.get_node("MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer2/SpeakerEmotionLineEdit")
18
-onready var _SceneIdSpinBox: SpinBox = self.get_node("MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/HBoxContainer/SceneIdSpinBox")
19
-onready var _MessageTextEdit : TextEdit= self.get_node("MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer/MessageTextEdit")
20
-onready var _ChoicesList: ChoicesList = self.get_node("MarginContainer/VBoxContainer/ChoicesList")
21
-
22
-var _nid : int = 0
23
-var _slot_amount : int = 1
24
-
25
-var json_structure = {
26
-	"speaker": {
27
-		"id": 0,
28
-		"emotion": "happy"
29
-	},
30
-	"scene": {
31
-		"id": 0
32
-	},
33
-	"dialog": {
34
-		"message": "",
35
-		"choices_multiple": []
36
-	}
37
-}
38
-
39
-
40
-#Virtual Methods
41
-
42
-func _ready():
43
-	self._update_slots()
44
-
45
-#Callback Methods
46
-
47
-func _on_Editor_BTN_pressed():
48
-	self.emit_signal("pressed_editor", self)
49
-
50
-
51
-func _on_Line_close_request():
52
-	self.emit_signal("erased", self)
53
-
54
-
55
-func _on_Line_offset_changed():
56
-	self.emit_signal("changed_offset", self._nid, self.offset)
57
-
58
-
59
-func _on_Line_resize_request(new_minsize):
60
-	self.rect_size = new_minsize
61
-	self.emit_signal("changed_size", self)
62
-
63
-
64
-func _on_Load_BTN_pressed():
65
-	self.emit_signal("pressed_load", self)
66
-
67
-
68
-func _on_Save_BTN_pressed():
69
-	self.emit_signal("pressed_save", self)
70
-
71
-
72
-func _on_MessageTextEdit_text_changed():
73
-	json_structure.dialog.message = self._MessageTextEdit.text
74
-	_emit_text()
75
-
76
-func _on_SceneIdSpinBox_value_changed(value):
77
-	json_structure.scene.id = value
78
-	_emit_text()
79
-
80
-
81
-func _on_SpeakerEmotionLineEdit_text_changed(new_text):
82
-	json_structure.speaker.emotion = new_text
83
-	_emit_text()
84
-
85
-
86
-func _on_SpeakerIdSpinBox_value_changed(value):
87
-	json_structure.speaker.id = value
88
-	_emit_text()
89
-
90
-func _on_ChoicesList_choices_changed(new_json_structure):
91
-	json_structure.dialog.choices_multiple = new_json_structure
92
-	var slot_number = json_structure.dialog.choices_multiple.size()
93
-	# Always have at least one slot
94
-	if slot_number == 0:
95
-		slot_number = 1
96
-	if (self.get_slot_amount() != slot_number):
97
-		self.set_slot_amount(slot_number)
98
-		self._update_slots()
99
-		self.emit_signal("changed_slots", self)
100
-	else:
101
-		_update_slots_labels()
102
-	_emit_text()
103
-
104
-
105
-#Public Methods
106
-
107
-func get_nid() -> int:
108
-	return self._nid
109
-
110
-
111
-func get_slot_amount() -> int:
112
-	return self._slot_amount
113
-
114
-
115
-func get_text() -> String:
116
-	return JSON.print(json_structure, "\t")
117
-
118
-
119
-func set_nid(new_nid):
120
-	self._nid = new_nid
121
-	var new_name = "NID " + str(new_nid)
122
-	self.title = new_name
123
-	self.name = new_name
124
-
125
-
126
-func set_slot_amount(new_amount : int):
127
-	self._slot_amount = new_amount
128
-
129
-
130
-func set_text(new_text : String):
131
-	json_structure = JSON.parse(new_text).get_result()
132
-	_update_components()
133
-	_emit_text()
134
-
135
-#Private Methods
136
-
137
-func _update_components():
138
-	_SpeakerIdSpinBox.set_value(json_structure.speaker.id)
139
-	_SpeakerEmotionLineEdit.set_text(json_structure.speaker.emotion);
140
-	_SceneIdSpinBox.set_value(json_structure.scene.id)
141
-	_MessageTextEdit.set_text(json_structure.dialog.message)
142
-	_ChoicesList.set_structure(json_structure.dialog.choices_multiple)
143
-
144
-func _emit_text():
145
-	self.emit_signal("text_changed", self._nid, get_text())
146
-	
147
-
148
-func _clear_link_labels():
149
-	var children = self.get_children()
150
-	for child in children:
151
-		if child is Label:
152
-			child.queue_free()
153
-
154
-
155
-func _update_slots_labels():
156
-	for slot in range(0, self.get_slot_amount()):
157
-		var output_link_label = self.get_children()[slot]
158
-		if (output_link_label is Label):
159
-			output_link_label.text = self._get_choice_name(slot)
160
-
161
-func _get_choice_name(index):
162
-	var choices: Array = json_structure.dialog.choices_multiple;
163
-	if (choices.size() > 0):
164
-		return choices[index].title
165
-	else:
166
-		return "Next"
167
-
168
-func _update_slots():
169
-	self.clear_all_slots()
170
-	self._clear_link_labels()
171
-	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)
172
-	var base_link_label = Label.new()
173
-	base_link_label.text = self._get_choice_name(0)
174
-	base_link_label.align = Label.ALIGN_RIGHT
175
-	self.add_child(base_link_label)
176
-	self.move_child(base_link_label, 0)
177
-	var last_output_link_label = base_link_label
178
-	for slot in range(1, self._slot_amount):
179
-		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)
180
-		var output_link_label = Label.new()
181
-		output_link_label.text = self._get_choice_name(slot)
182
-		output_link_label.align = Label.ALIGN_RIGHT
183
-		self.add_child_below_node(last_output_link_label, output_link_label)
184
-		last_output_link_label = output_link_label

+ 0
- 224
addons/EXP-System-Dialog/Dialog Editor/dialog_editor.gd View File

@@ -1,224 +0,0 @@
1
-tool
2
-extends Control
3
-
4
-signal back_BTN_pressed
5
-signal close_BTN_pressed
6
-
7
-onready var _Graph = self.get_node("VBoxContainer/GraphEdit")
8
-onready var _Human_Readable_LBL = self.get_node("VBoxContainer/VBoxContainer/Human_Readable_LBL")
9
-
10
-var _Editor_TSCN = preload("res://addons/EXP-System-Dialog/Dialog Editor/Editor/Editor.tscn")
11
-var _LineNode = preload("res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Line_Node.tscn")
12
-var _NodeTemplate= preload("res://addons/EXP-System-Dialog/Resource_NodeTemplate/EXP_NodeTemplate.gd")
13
-
14
-var _did : int = -1
15
-var _Editor
16
-var _Load_Template : EditorFileDialog
17
-var _Save_Template_As : EditorFileDialog
18
-var _Story_Editor
19
-var _Target_Node
20
-
21
-#Virtual Methods
22
-
23
-func _ready():
24
-	self._setup_dialogs()
25
-	self._Editor = _Editor_TSCN.instance()
26
-	self.add_child(self._Editor)
27
-
28
-#Callback Methods
29
-
30
-func _on_Add_Node_BTN_pressed():
31
-	var new_nid = self._Story_Editor.create_node(self._did, "line")
32
-	var new_line_node = self._LineNode.instance()
33
-	new_line_node.offset += self._Graph.scroll_offset
34
-	new_line_node.set_nid(new_nid)
35
-	new_line_node.connect("erased", self, "_on_Node_erased")
36
-	new_line_node.connect("changed_offset", self, "_on_Node_changed_offset")
37
-	new_line_node.connect("text_changed", self, "_on_Node_text_changed")
38
-	new_line_node.connect("pressed_save", self, "_on_Node_pressed_save")
39
-	new_line_node.connect("pressed_load", self, "_on_Node_pressed_load")
40
-	new_line_node.connect("pressed_editor", self, "_on_Node_pressed_editor")
41
-	new_line_node.connect("changed_slots", self, "_on_Node_changed_slots")
42
-	new_line_node.connect("changed_size", self, "_on_Node_changed_size")
43
-	var slot_count = self._Story_Editor.get_node_property(self._did, new_nid, "slot_amount")
44
-	self._Story_Editor.set_node_property(self._did, new_nid, "rect_size", new_line_node.rect_size)
45
-	new_line_node.set_slot_amount(slot_count)
46
-	self._Graph.add_child(new_line_node)
47
-
48
-
49
-func _on_Back_BTN_pressed():
50
-	self.emit_signal("back_BTN_pressed")
51
-
52
-
53
-func _on_Close_BTN_pressed():
54
-	self.emit_signal("close_BTN_pressed")
55
-
56
-
57
-func _on_GraphEdit_connection_request(from, from_slot, to, to_slot):
58
-	self._Graph.connect_node(from, from_slot, to, to_slot)
59
-	var from_node = self._Graph.get_node(from)
60
-	var to_node = self._Graph.get_node(to)
61
-	var from_node_nid = from_node.get_nid()
62
-	var to_node_nid = to_node.get_nid()
63
-	self._Story_Editor.set_link(self._did, from_node_nid, from_slot, to_node_nid)
64
-
65
-
66
-func _on_GraphEdit_disconnection_request(from, from_slot, to, to_slot):
67
-	self._Graph.disconnect_node(from, from_slot, to, to_slot)
68
-	var from_node = self._Graph.get_node(from)
69
-	var from_node_nid = from_node.get_nid()
70
-	self._Story_Editor.erase_link(self._did, from_node_nid, from_slot)
71
-
72
-
73
-func _on_Load_Template_file_selected(filename):
74
-	var file_data = load(filename)
75
-	if not file_data.TYPE == "EXP_Dialog_Node_Template_editor":
76
-		return
77
-	
78
-	self._Target_Node.set_text(file_data.template)
79
-
80
-
81
-func _on_Node_changed_offset(nid, new_offset):
82
-	self._Story_Editor.set_node_property(self._did, nid, "graph_offset", new_offset)
83
-
84
-
85
-func _on_Node_changed_size(changed_node):
86
-	var changed_node_nid = changed_node.get_nid()
87
-	self._Story_Editor.set_node_property(self._did, changed_node_nid, "rect_size", changed_node.rect_size)
88
-
89
-
90
-func _on_Node_changed_slots(changed_node):
91
-	var changed_node_nid = changed_node.get_nid()
92
-	self._unlink_nid_from_story(changed_node_nid)
93
-	self._disconnect_all_from(changed_node)
94
-	self._Story_Editor.set_node_property(self._did, changed_node_nid, "slot_amount",
95
-		changed_node.get_slot_amount())
96
-
97
-
98
-func _on_Node_erased(deleted_node):
99
-	var deleted_nid = deleted_node.get_nid()
100
-	self._unlink_nid_from_story(deleted_nid)
101
-	self._Story_Editor.erase_node(self._did, deleted_nid)
102
-	self._disconnect_all_from(deleted_node)
103
-	deleted_node.queue_free()
104
-
105
-
106
-func _on_Node_pressed_editor(node):
107
-	self._Editor.set_target_node(node)
108
-	self._Editor.visible = true
109
-
110
-
111
-func _on_Node_pressed_load(node):
112
-	self._Target_Node = node
113
-	self._Load_Template.popup_centered_ratio(0.7)
114
-
115
-
116
-func _on_Node_pressed_save(node):
117
-	self._Target_Node = node
118
-	self._Save_Template_As.popup_centered_ratio(0.7)
119
-
120
-
121
-func _on_Node_text_changed(nid, new_text):
122
-	self._Story_Editor.set_node_property(self._did, nid, "text", new_text)
123
-
124
-
125
-func _on_Save_Template_As_file_selected(filename):
126
-	var save_file = _NodeTemplate.new()
127
-	save_file.template = self._Target_Node.get_text()
128
-	ResourceSaver.save(filename, save_file)
129
-
130
-
131
-func _on_Story_Editor_dialog_edit_pressed(story_editor, did : int):
132
-	self._Story_Editor = story_editor
133
-	self._did = did
134
-	self._Human_Readable_LBL.text = self._Story_Editor.get_dialog_property(self._did, "human_readable_description")
135
-	self._clear_nodes()
136
-	self._populate_graph()
137
-	self._link_node_connections()
138
-
139
-#Private Methods
140
-
141
-func _clear_nodes():
142
-	self._Graph.clear_connections()
143
-	var children = self._Graph.get_children()
144
-	for child in children:
145
-		if child is GraphNode:
146
-			child.free()
147
-
148
-
149
-func _disconnect_all_from(node):
150
-	var node_name = node.name
151
-	var connection_list = self._Graph.get_connection_list()
152
-	for connection in connection_list:
153
-		if connection["from"] == node.name or connection["to"] == node.name:
154
-			self._Graph.disconnect_node(connection["from"], connection["from_port"],
155
-				connection["to"], connection["to_port"])
156
-
157
-
158
-func _link_node_connections():
159
-	var node_IDs = self._Story_Editor.get_nids(self._did)
160
-	for nID in node_IDs:
161
-		var slots = self._Story_Editor.get_link_slots(self._did, nID)
162
-		for slot in slots:
163
-			var to_node_nid = self._Story_Editor.get_nid_link_from(self._did, nID, slot)
164
-			var to = "NID " + str(to_node_nid)
165
-			var from = "NID " + str(nID)
166
-			self._Graph.connect_node(from, slot, to, 0)
167
-
168
-
169
-func _populate_graph():
170
-	var node_IDs = self._Story_Editor.get_nids(self._did)
171
-	for nID in node_IDs:
172
-		var new_node : GraphNode
173
-		match self._Story_Editor.get_node_property(self._did, nID, "type"):
174
-			"line":
175
-				new_node = _LineNode.instance()
176
-				var slot_count = self._Story_Editor.get_node_property(self._did, nID, "slot_amount")
177
-				new_node.set_slot_amount(slot_count)
178
-				self._Graph.add_child(new_node)
179
-				new_node.connect("erased", self, "_on_Node_erased")
180
-				var new_text = self._Story_Editor.get_node_property(self._did, nID, "text")
181
-				var new_rect_size = self._Story_Editor.get_node_property(self._did, nID, "rect_size")
182
-				new_node.rect_size = new_rect_size
183
-				new_node.set_text(new_text)
184
-				new_node.connect("text_changed", self, "_on_Node_text_changed")
185
-				new_node.connect("pressed_save", self, "_on_Node_pressed_save")
186
-				new_node.connect("pressed_load", self, "_on_Node_pressed_load")
187
-				new_node.connect("pressed_editor", self, "_on_Node_pressed_editor")
188
-				new_node.connect("changed_slots", self, "_on_Node_changed_slots")
189
-				new_node.connect("changed_size", self, "_on_Node_changed_size")
190
-		
191
-		new_node.set_nid(nID)
192
-		new_node.offset = self._Story_Editor.get_node_property(self._did, nID, "graph_offset")
193
-		new_node.connect("changed_offset", self, "_on_Node_changed_offset")
194
-
195
-
196
-func _setup_dialogs():
197
-	self._Load_Template = EditorFileDialog.new()
198
-	self._Load_Template.mode = EditorFileDialog.MODE_OPEN_FILE
199
-	self._Load_Template.add_filter("*.res ; Template files")
200
-	self._Load_Template.resizable = true
201
-	self._Load_Template.access = EditorFileDialog.ACCESS_RESOURCES
202
-	self._Load_Template.current_dir = "res://"
203
-	self._Load_Template.connect("file_selected", self, "_on_Load_Template_file_selected")
204
-	self.add_child(self._Load_Template)
205
-	
206
-	self._Save_Template_As = EditorFileDialog.new()
207
-	self._Save_Template_As.mode = EditorFileDialog.MODE_SAVE_FILE
208
-	self._Save_Template_As.add_filter("*.res ; Template files")
209
-	self._Save_Template_As.resizable = true
210
-	self._Save_Template_As.access = EditorFileDialog.ACCESS_RESOURCES
211
-	self._Save_Template_As.current_dir = "res://"
212
-	self._Save_Template_As.connect("file_selected", self, "_on_Save_Template_As_file_selected")
213
-	self.add_child(self._Save_Template_As)
214
-
215
-
216
-func _unlink_nid_from_story(removed_nid):
217
-	self._Story_Editor.erase_all_links(self._did, removed_nid)
218
-	var nIDs = self._Story_Editor.get_nids(self._did)
219
-	for nID in nIDs:
220
-		var node_slots = self._Story_Editor.get_link_slots(self._did, nID)
221
-		for slot in node_slots:
222
-			var to_node_nid = self._Story_Editor.get_nid_link_from(self._did, nID, slot)
223
-			if to_node_nid == removed_nid:
224
-				self._Story_Editor.erase_link(self._did, nID, slot)

BIN
addons/EXP-System-Dialog/Images/de.png View File


+ 0
- 34
addons/EXP-System-Dialog/Images/de.png.import View File

@@ -1,34 +0,0 @@
1
-[remap]
2
-
3
-importer="texture"
4
-type="StreamTexture"
5
-path="res://.import/de.png-fbe4565917c56d102e03dea598024725.stex"
6
-metadata={
7
-"vram_texture": false
8
-}
9
-
10
-[deps]
11
-
12
-source_file="res://addons/EXP-System-Dialog/Images/de.png"
13
-dest_files=[ "res://.import/de.png-fbe4565917c56d102e03dea598024725.stex" ]
14
-
15
-[params]
16
-
17
-compress/mode=0
18
-compress/lossy_quality=0.7
19
-compress/hdr_mode=0
20
-compress/bptc_ldr=0
21
-compress/normal_map=0
22
-flags/repeat=0
23
-flags/filter=true
24
-flags/mipmaps=false
25
-flags/anisotropic=false
26
-flags/srgb=2
27
-process/fix_alpha_border=true
28
-process/premult_alpha=false
29
-process/HDR_as_SRGB=false
30
-process/invert_color=false
31
-stream=false
32
-size_limit=0
33
-detect_3d=true
34
-svg/scale=1.0

BIN
addons/EXP-System-Dialog/Images/icon.png View File


+ 0
- 34
addons/EXP-System-Dialog/Images/icon.png.import View File

@@ -1,34 +0,0 @@
1
-[remap]
2
-
3
-importer="texture"
4
-type="StreamTexture"
5
-path="res://.import/icon.png-47dc6e8cad94817cb2e2b72e131ff5fa.stex"
6
-metadata={
7
-"vram_texture": false
8
-}
9
-
10
-[deps]
11
-
12
-source_file="res://addons/EXP-System-Dialog/Images/icon.png"
13
-dest_files=[ "res://.import/icon.png-47dc6e8cad94817cb2e2b72e131ff5fa.stex" ]
14
-
15
-[params]
16
-
17
-compress/mode=0
18
-compress/lossy_quality=0.7
19
-compress/hdr_mode=0
20
-compress/bptc_ldr=0
21
-compress/normal_map=0
22
-flags/repeat=0
23
-flags/filter=true
24
-flags/mipmaps=false
25
-flags/anisotropic=false
26
-flags/srgb=2
27
-process/fix_alpha_border=true
28
-process/premult_alpha=false
29
-process/HDR_as_SRGB=false
30
-process/invert_color=false
31
-stream=false
32
-size_limit=0
33
-detect_3d=true
34
-svg/scale=1.0

BIN
addons/EXP-System-Dialog/Images/se.png View File


+ 0
- 34
addons/EXP-System-Dialog/Images/se.png.import View File

@@ -1,34 +0,0 @@
1
-[remap]
2
-
3
-importer="texture"
4
-type="StreamTexture"
5
-path="res://.import/se.png-e2b4f76b280be2edfdda792d18e61fd1.stex"
6
-metadata={
7
-"vram_texture": false
8
-}
9
-
10
-[deps]
11
-
12
-source_file="res://addons/EXP-System-Dialog/Images/se.png"
13
-dest_files=[ "res://.import/se.png-e2b4f76b280be2edfdda792d18e61fd1.stex" ]
14
-
15
-[params]
16
-
17
-compress/mode=0
18
-compress/lossy_quality=0.7
19
-compress/hdr_mode=0
20
-compress/bptc_ldr=0
21
-compress/normal_map=0
22
-flags/repeat=0
23
-flags/filter=true
24
-flags/mipmaps=false
25
-flags/anisotropic=false
26
-flags/srgb=2
27
-process/fix_alpha_border=true
28
-process/premult_alpha=false
29
-process/HDR_as_SRGB=false
30
-process/invert_color=false
31
-stream=false
32
-size_limit=0
33
-detect_3d=true
34
-svg/scale=1.0

+ 0
- 83
addons/EXP-System-Dialog/Reference_StoryReader/EXP_StoryReader.gd View File

@@ -1,83 +0,0 @@
1
-extends Reference
2
-
3
-var _story : Dictionary = {}
4
-var _names : Dictionary = {}
5
-
6
-
7
-func get_dids() -> Array:
8
-	return self._story.keys()
9
-
10
-
11
-func get_did_via_record_name(name : String) -> int:
12
-	assert(self._names.has(name))
13
-	return self._names[name]
14
-
15
-
16
-func get_nid_from_slot(did : int, nid : int, slot : int) -> int:
17
-	assert(self.has_did(did))
18
-	assert(self.has_nid(did, nid))
19
-	assert(self.has_slot(did, nid, slot))
20
-	return self._story[did]["nodes"][nid]["links"][slot]
21
-
22
-
23
-func get_nid_via_exact_text(did : int, query : String) -> int:
24
-	assert(self.has_did(did))
25
-	
26
-	for nid in self._story[did]["nodes"].keys():
27
-		if self._story[did]["nodes"][nid]["text"] == query:
28
-			return nid
29
-	return -1
30
-
31
-
32
-func get_nids(did : int) -> Array:
33
-	assert(self.has_did(did))
34
-	return self._story[did]["nodes"].keys()
35
-
36
-
37
-func get_slot_count(did : int, nid : int) -> int:
38
-	assert(self.has_did(did))
39
-	assert(self.has_nid(did, nid))
40
-	return self._story[did]["nodes"][nid]["links"].size()
41
-
42
-
43
-func get_slots(did : int, nid : int) -> Array:
44
-	assert(self.has_did(did))
45
-	assert(self.has_nid(did, nid))
46
-	return self._story[did]["nodes"][nid]["links"].keys()
47
-
48
-
49
-func get_text(did : int, nid : int) -> String:
50
-	assert(self.has_did(did))
51
-	assert(self.has_nid(did, nid))
52
-	return self._story[did]["nodes"][nid]["text"]
53
-
54
-
55
-func has_did(did : int) -> bool:
56
-	return self._story.has(did)
57
-
58
-
59
-func has_nid(did : int, nid : int) -> bool:
60
-	assert(self.has_did(did))
61
-	return self._story[did]["nodes"].has(nid)
62
-
63
-
64
-func has_record_name(name : String) -> bool:
65
-	return self._names.has(name)
66
-
67
-
68
-func has_slot(did: int, nid : int, slot : int) -> bool:
69
-	assert(self.has_did(did))
70
-	assert(self.has_nid(did, nid))
71
-	return self._story[did]["nodes"][nid]["links"].has(slot)
72
-
73
-
74
-func read(file):
75
-	if not "TYPE" in file:
76
-		print_debug("Story reader failed to open file: ", str(file.filename))
77
-		return
78
-	if not file.TYPE == "EXP_Baked_Story" or file.TYPE == "EXP_Story_editor":
79
-		print_debug("Story reader failed to open file: ", str(file.filename))
80
-		return
81
-	
82
-	self._story = file.story
83
-	self._names = file.names

+ 0
- 6
addons/EXP-System-Dialog/Resource_BakedStory/EXP_BakedStory.gd View File

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

+ 0
- 9
addons/EXP-System-Dialog/Resource_EditorStory/EXP_EditorStory.gd View File

@@ -1,9 +0,0 @@
1
-tool
2
-extends Resource
3
-
4
-export(String) var TYPE = "EXP_Story_editor"
5
-
6
-export(Dictionary) var names : Dictionary
7
-export(Dictionary) var story : Dictionary
8
-export(Array) var available_dids : Array
9
-export(Array) var groups : Array

+ 0
- 6
addons/EXP-System-Dialog/Resource_NodeTemplate/EXP_NodeTemplate.gd View File

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

+ 0
- 109
addons/EXP-System-Dialog/Story Editor/Dialog Record/Dialog_Record.tscn View File

@@ -1,109 +0,0 @@
1
-[gd_scene load_steps=4 format=2]
2
-
3
-[ext_resource path="res://addons/EXP-System-Dialog/Story Editor/Dialog Record/dialog_record.gd" type="Script" id=1]
4
-
5
-[sub_resource type="StyleBoxFlat" id=1]
6
-bg_color = Color( 0.6, 0.6, 0.6, 0 )
7
-border_color = Color( 0.8, 0.8, 0.8, 0 )
8
-shadow_color = Color( 0, 0, 0, 0 )
9
-
10
-[sub_resource type="StyleBoxFlat" id=2]
11
-bg_color = Color( 0.6, 0.6, 0.6, 0 )
12
-border_color = Color( 0.8, 0.8, 0.8, 0 )
13
-shadow_color = Color( 0, 0, 0, 0 )
14
-
15
-[node name="Dialog_Record" type="Control"]
16
-anchor_right = 1.0
17
-rect_min_size = Vector2( 0, 28 )
18
-script = ExtResource( 1 )
19
-__meta__ = {
20
-"_edit_use_anchors_": false
21
-}
22
-
23
-[node name="ColorRect" type="ColorRect" parent="."]
24
-anchor_right = 1.0
25
-anchor_bottom = 1.0
26
-rect_min_size = Vector2( 0, 24 )
27
-size_flags_horizontal = 3
28
-color = Color( 1, 1, 1, 0.12549 )
29
-__meta__ = {
30
-"_edit_use_anchors_": false
31
-}
32
-
33
-[node name="HBoxContainer" type="HBoxContainer" parent="ColorRect"]
34
-anchor_right = 1.0
35
-anchor_bottom = 1.0
36
-__meta__ = {
37
-"_edit_use_anchors_": false
38
-}
39
-
40
-[node name="CheckBox" type="CheckBox" parent="ColorRect/HBoxContainer"]
41
-margin_right = 24.0
42
-margin_bottom = 28.0
43
-
44
-[node name="DID_LBL" type="Label" parent="ColorRect/HBoxContainer"]
45
-margin_left = 28.0
46
-margin_top = 7.0
47
-margin_right = 85.0
48
-margin_bottom = 21.0
49
-text = "DID: 101"
50
-
51
-[node name="VSeparator" type="VSeparator" parent="ColorRect/HBoxContainer"]
52
-margin_left = 89.0
53
-margin_right = 93.0
54
-margin_bottom = 28.0
55
-
56
-[node name="Edit_BTN" type="Button" parent="ColorRect/HBoxContainer"]
57
-margin_left = 97.0
58
-margin_right = 138.0
59
-margin_bottom = 28.0
60
-hint_tooltip = "Edit this dialog record in the Dialog Editor."
61
-text = "EDIT"
62
-flat = true
63
-
64
-[node name="VSeparator4" type="VSeparator" parent="ColorRect/HBoxContainer"]
65
-margin_left = 142.0
66
-margin_right = 146.0
67
-margin_bottom = 28.0
68
-
69
-[node name="Name_BTN" type="Button" parent="ColorRect/HBoxContainer"]
70
-margin_left = 150.0
71
-margin_right = 200.0
72
-margin_bottom = 28.0
73
-hint_tooltip = "Edit this dialog record in the Dialog Editor."
74
-text = "NAME"
75
-flat = true
76
-
77
-[node name="VSeparator2" type="VSeparator" parent="ColorRect/HBoxContainer"]
78
-margin_left = 204.0
79
-margin_right = 208.0
80
-margin_bottom = 28.0
81
-
82
-[node name="Group_BTN" type="OptionButton" parent="ColorRect/HBoxContainer"]
83
-margin_left = 212.0
84
-margin_right = 274.0
85
-margin_bottom = 28.0
86
-hint_tooltip = "View groups applied to this dialog record."
87
-text = "TAGS"
88
-flat = true
89
-
90
-[node name="VSeparator3" type="VSeparator" parent="ColorRect/HBoxContainer"]
91
-margin_left = 278.0
92
-margin_right = 282.0
93
-margin_bottom = 28.0
94
-
95
-[node name="Human_Readable_LineEdit" type="LineEdit" parent="ColorRect/HBoxContainer"]
96
-margin_left = 286.0
97
-margin_right = 476.0
98
-margin_bottom = 28.0
99
-custom_styles/focus = SubResource( 1 )
100
-custom_styles/normal = SubResource( 2 )
101
-text = "Human Readable Description"
102
-expand_to_text_length = true
103
-context_menu_enabled = false
104
-[connection signal="toggled" from="ColorRect/HBoxContainer/CheckBox" to="." method="_on_CheckBox_toggled"]
105
-[connection signal="pressed" from="ColorRect/HBoxContainer/Edit_BTN" to="." method="_on_Edit_BTN_pressed"]
106
-[connection signal="pressed" from="ColorRect/HBoxContainer/Name_BTN" to="." method="_on_Name_BTN_pressed"]
107
-[connection signal="pressed" from="ColorRect/HBoxContainer/Group_BTN" to="." method="_on_Group_BTN_pressed"]
108
-[connection signal="focus_exited" from="ColorRect/HBoxContainer/Human_Readable_LineEdit" to="." method="_on_Human_Readable_LineEdit_focus_exited"]
109
-[connection signal="text_changed" from="ColorRect/HBoxContainer/Human_Readable_LineEdit" to="." method="_on_Human_Readable_LineEdit_text_changed"]

+ 0
- 91
addons/EXP-System-Dialog/Story Editor/Dialog Record/dialog_record.gd View File

@@ -1,91 +0,0 @@
1
-tool
2
-extends Control
3
-
4
-signal changed_human_readable_text(did, text)
5
-signal checked(this)
6
-signal edit_pressed(did)
7
-signal rename_pressed(this)
8
-signal unchecked(this)
9
-
10
-onready var _DID_LBL = self.get_node("ColorRect/HBoxContainer/DID_LBL")
11
-onready var _Human_Readable_LineEdit = self.get_node("ColorRect/HBoxContainer/Human_Readable_LineEdit")
12
-onready var _Group_List = self.get_node("ColorRect/HBoxContainer/Group_BTN")
13
-onready var _Name_BTN = self.get_node("ColorRect/HBoxContainer/Name_BTN")
14
-onready var _Select_CheckBox = self.get_node("ColorRect/HBoxContainer/CheckBox")
15
-
16
-var _did : int = -1
17
-var _Story_Editor
18
-
19
-#Virtual Methods
20
-
21
-func _ready():
22
-	self.update_human_readable_description("Human Readable Description")
23
-
24
-#Callback Methods
25
-
26
-func _on_CheckBox_toggled(button_pressed):
27
-	if button_pressed:
28
-		self.emit_signal("checked", self)
29
-	else:
30
-		self.emit_signal("unchecked", self)
31
-
32
-
33
-func _on_Edit_BTN_pressed():
34
-	self.emit_signal("edit_pressed", self._did)
35
-
36
-
37
-func _on_Group_BTN_pressed():
38
-	var groups = self._Story_Editor.dialog_get_groups(self._did)
39
-	self._Group_List.clear()
40
-	self._Group_List.text = "TAGS"
41
-	for group in groups:
42
-		self._Group_List.get_popup().add_item(group)
43
-	for idx in range(self._Group_List.get_item_count()):
44
-		self._Group_List.set_item_disabled(idx, true)
45
-
46
-
47
-func _on_Human_Readable_LineEdit_focus_exited():
48
-	self._Human_Readable_LineEdit.deselect()
49
-
50
-
51
-func _on_Human_Readable_LineEdit_text_changed(new_text):
52
-	self.emit_signal("changed_human_readable_text", self._did, new_text)
53
-
54
-
55
-func _on_Name_BTN_pressed():
56
-	emit_signal("rename_pressed", self)
57
-
58
-#Public Methods
59
-
60
-func check():
61
-	self._Select_CheckBox.pressed = true
62
-
63
-
64
-func get_did():
65
-	return self._did
66
-
67
-
68
-func get_record_name():
69
-	return self._Name_BTN.text
70
-
71
-
72
-func set_did(new_did : int):
73
-	self._did = new_did
74
-	self._DID_LBL.text = "DID: " + str(new_did)
75
-
76
-
77
-func set_record_name(rename : String):
78
-	self._Name_BTN.text = rename
79
-
80
-
81
-func set_story_editor(editor):
82
-	self._Story_Editor = editor
83
-
84
-
85
-func uncheck():
86
-	self._Select_CheckBox.pressed = false
87
-
88
-
89
-func update_human_readable_description(new_text):
90
-	self._Human_Readable_LineEdit.text = new_text
91
-	self.emit_signal("changed_human_readable_text", self._did, new_text)

+ 0
- 92
addons/EXP-System-Dialog/Story Editor/Rename Record Box/Rename_Record_Box.tscn View File

@@ -1,92 +0,0 @@
1
-[gd_scene load_steps=2 format=2]
2
-
3
-[ext_resource path="res://addons/EXP-System-Dialog/Story Editor/Rename Record Box/rename_record_box.gd" type="Script" id=1]
4
-
5
-[node name="Record_Rename_Box" type="WindowDialog"]
6
-anchor_left = 0.5
7
-anchor_top = 0.5
8
-anchor_right = 0.5
9
-anchor_bottom = 0.5
10
-margin_left = -193.0
11
-margin_top = -64.0
12
-margin_right = 193.0
13
-margin_bottom = 52.0
14
-rect_min_size = Vector2( 386, 116 )
15
-size_flags_horizontal = 3
16
-size_flags_vertical = 3
17
-window_title = "Rename Dialog Record"
18
-script = ExtResource( 1 )
19
-__meta__ = {
20
-"_edit_use_anchors_": false
21
-}
22
-
23
-[node name="MarginContainer" type="MarginContainer" parent="."]
24
-anchor_right = 1.0
25
-anchor_bottom = 1.0
26
-margin_left = 8.0
27
-margin_top = 8.0
28
-margin_right = -8.0
29
-margin_bottom = -8.0
30
-size_flags_horizontal = 3
31
-size_flags_vertical = 3
32
-__meta__ = {
33
-"_edit_use_anchors_": false
34
-}
35
-
36
-[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
37
-margin_right = 370.0
38
-margin_bottom = 100.0
39
-size_flags_horizontal = 3
40
-size_flags_vertical = 3
41
-__meta__ = {
42
-"_edit_use_anchors_": false
43
-}
44
-
45
-[node name="Name_LBL" type="Label" parent="MarginContainer/VBoxContainer"]
46
-margin_right = 370.0
47
-margin_bottom = 14.0
48
-text = "Name:"
49
-
50
-[node name="Spacer2" type="Control" parent="MarginContainer/VBoxContainer"]
51
-margin_top = 18.0
52
-margin_right = 370.0
53
-margin_bottom = 22.0
54
-rect_min_size = Vector2( 0, 4 )
55
-
56
-[node name="Name_LineEdit" type="LineEdit" parent="MarginContainer/VBoxContainer"]
57
-margin_top = 26.0
58
-margin_right = 370.0
59
-margin_bottom = 50.0
60
-
61
-[node name="Spacer3" type="Control" parent="MarginContainer/VBoxContainer"]
62
-margin_top = 54.0
63
-margin_right = 370.0
64
-margin_bottom = 58.0
65
-rect_min_size = Vector2( 0, 4 )
66
-
67
-[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
68
-margin_top = 62.0
69
-margin_right = 370.0
70
-margin_bottom = 82.0
71
-alignment = 1
72
-
73
-[node name="Cancel_BTN" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
74
-margin_left = 106.0
75
-margin_right = 160.0
76
-margin_bottom = 20.0
77
-text = "Cancel"
78
-
79
-[node name="Spacer" type="Control" parent="MarginContainer/VBoxContainer/HBoxContainer"]
80
-margin_left = 164.0
81
-margin_right = 196.0
82
-margin_bottom = 20.0
83
-rect_min_size = Vector2( 32, 0 )
84
-
85
-[node name="Rename_BTN" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
86
-margin_left = 200.0
87
-margin_right = 264.0
88
-margin_bottom = 20.0
89
-text = "Rename"
90
-[connection signal="text_entered" from="MarginContainer/VBoxContainer/Name_LineEdit" to="." method="_on_Name_LineEdit_text_entered"]
91
-[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/Cancel_BTN" to="." method="_on_Cancel_BTN_pressed"]
92
-[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/Rename_BTN" to="." method="_on_Rename_BTN_pressed"]

+ 0
- 32
addons/EXP-System-Dialog/Story Editor/Rename Record Box/rename_record_box.gd View File

@@ -1,32 +0,0 @@
1
-tool
2
-extends WindowDialog
3
-
4
-signal rename_BTN_pressed(text)
5
-
6
-onready var _Name_LineEdit = self.get_node("MarginContainer/VBoxContainer/Name_LineEdit")
7
-
8
-var _Target_Record = null
9
-
10
-#Public Methods
11
-
12
-func get_target_record():
13
-	return self._Target_Record
14
-
15
-
16
-func set_target_record(record):
17
-	self._Target_Record = record
18
-	self._Name_LineEdit.text = record.get_record_name()
19
-
20
-#Callback Methods
21
-
22
-func _on_Cancel_BTN_pressed():
23
-	self.visible = false
24
-
25
-
26
-func _on_Rename_BTN_pressed():
27
-	self.visible = false
28
-	self.emit_signal("rename_BTN_pressed", self._Name_LineEdit.text)
29
-
30
-
31
-func _on_Name_LineEdit_text_entered(new_text):
32
-	self._on_Rename_BTN_pressed()

+ 0
- 268
addons/EXP-System-Dialog/Story Editor/Story_Editor.tscn View File

@@ -1,268 +0,0 @@
1
-[gd_scene load_steps=2 format=2]
2
-
3
-[ext_resource path="res://addons/EXP-System-Dialog/Story Editor/story_editor.gd" type="Script" id=1]
4
-
5
-[node name="Story_Editor" type="Control"]
6
-anchor_right = 1.0
7
-anchor_bottom = 1.0
8
-rect_min_size = Vector2( 0, 256 )
9
-script = ExtResource( 1 )
10
-__meta__ = {
11
-"_edit_use_anchors_": false
12
-}
13
-
14
-[node name="VBoxContainer" type="VBoxContainer" parent="."]
15
-anchor_right = 1.0
16
-anchor_bottom = 1.0
17
-__meta__ = {
18
-"_edit_use_anchors_": false
19
-}
20
-
21
-[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
22
-margin_right = 1024.0
23
-margin_bottom = 20.0
24
-
25
-[node name="Close_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
26
-margin_right = 47.0
27
-margin_bottom = 20.0
28
-text = "Close"
29
-
30
-[node name="VSeparator5" type="VSeparator" parent="VBoxContainer/HBoxContainer"]
31
-margin_left = 51.0
32
-margin_right = 55.0
33
-margin_bottom = 20.0
34
-
35
-[node name="Story" type="MenuButton" parent="VBoxContainer/HBoxContainer"]
36
-margin_left = 59.0
37
-margin_right = 103.0
38
-margin_bottom = 20.0
39
-text = "Story"
40
-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 ]
41
-
42
-[node name="VSeparator" type="VSeparator" parent="VBoxContainer/HBoxContainer"]
43
-margin_left = 107.0
44
-margin_right = 111.0
45
-margin_bottom = 20.0
46
-
47
-[node name="Label2" type="Label" parent="VBoxContainer/HBoxContainer"]
48
-margin_left = 115.0
49
-margin_top = 3.0
50
-margin_right = 163.0
51
-margin_bottom = 17.0
52
-text = "Dialog: "
53
-
54
-[node name="Create_Dialog_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
55
-margin_left = 167.0
56
-margin_right = 220.0
57
-margin_bottom = 20.0
58
-hint_tooltip = "Create a new dialog record."
59
-text = "Create"
60
-
61
-[node name="Delete_Dialog_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
62
-margin_left = 224.0
63
-margin_right = 279.0
64
-margin_bottom = 20.0
65
-hint_tooltip = "Delete all checked dialog records."
66
-text = "Delete"
67
-
68
-[node name="Check_All_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
69
-margin_left = 283.0
70
-margin_right = 354.0
71
-margin_bottom = 20.0
72
-hint_tooltip = "Check all currently visible dialog records."
73
-text = "Check All"
74
-
75
-[node name="UnCheck_All_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
76
-margin_left = 358.0
77
-margin_right = 447.0
78
-margin_bottom = 20.0
79
-hint_tooltip = "Uncheck all currently visible dialog records."
80
-text = "UnCheck All"
81
-
82
-[node name="VSeparator2" type="VSeparator" parent="VBoxContainer/HBoxContainer"]
83
-margin_left = 451.0
84
-margin_right = 455.0
85
-margin_bottom = 20.0
86
-
87
-[node name="Label3" type="Label" parent="VBoxContainer/HBoxContainer"]
88
-margin_left = 459.0
89
-margin_top = 3.0
90
-margin_right = 495.0
91
-margin_bottom = 17.0
92
-text = "Tags: "
93
-
94
-[node name="Group_Manager_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
95
-margin_left = 499.0
96
-margin_right = 590.0
97
-margin_bottom = 20.0
98
-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."
99
-toggle_mode = true
100
-text = "Tag Manager"
101
-
102
-[node name="VSeparator3" type="VSeparator" parent="VBoxContainer/HBoxContainer"]
103
-margin_left = 594.0
104
-margin_right = 598.0
105
-margin_bottom = 20.0
106
-
107
-[node name="Apply_Group_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
108
-margin_left = 602.0
109
-margin_right = 650.0
110
-margin_bottom = 20.0
111
-hint_tooltip = "Apply the group selected in the Group selector menu to all checked dialog records."
112
-text = "Apply"
113
-
114
-[node name="Remove_Group_BTN" type="Button" parent="VBoxContainer/HBoxContainer"]
115
-margin_left = 654.0
116
-margin_right = 718.0
117
-margin_bottom = 20.0
118
-hint_tooltip = "Remove the group selected in the Group selector menu from all checked dialog records if the group is applied to them."
119
-text = "Remove"
120
-
121
-[node name="Group_Selector_BTN" type="OptionButton" parent="VBoxContainer/HBoxContainer"]
122
-margin_left = 722.0
123
-margin_right = 779.0
124
-margin_bottom = 20.0
125
-hint_tooltip = "Select a group to apply or remove from dialog records."
126
-text = "Tags"
127
-
128
-[node name="VSeparator4" type="VSeparator" parent="VBoxContainer/HBoxContainer"]
129
-margin_left = 783.0
130
-margin_right = 787.0
131
-margin_bottom = 20.0
132
-
133
-[node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer"]
134
-margin_top = 24.0
135
-margin_right = 1024.0
136
-margin_bottom = 572.0
137
-size_flags_horizontal = 3
138
-size_flags_vertical = 3
139
-
140
-[node name="Panel" type="Panel" parent="VBoxContainer/HBoxContainer3"]
141
-margin_right = 1024.0
142
-margin_bottom = 548.0
143
-size_flags_horizontal = 3
144
-size_flags_vertical = 3
145
-
146
-[node name="VScrollBar" type="ScrollContainer" parent="VBoxContainer/HBoxContainer3/Panel"]
147
-anchor_right = 1.0
148
-anchor_bottom = 1.0
149
-rect_min_size = Vector2( 0, 128 )
150
-size_flags_vertical = 3
151
-__meta__ = {
152
-"_edit_use_anchors_": false
153
-}
154
-
155
-[node name="Dialog_Record_Root" type="VBoxContainer" parent="VBoxContainer/HBoxContainer3/Panel/VScrollBar"]
156
-margin_right = 1024.0
157
-margin_bottom = 548.0
158
-rect_min_size = Vector2( 0, 128 )
159
-size_flags_horizontal = 3
160
-size_flags_vertical = 3
161
-__meta__ = {
162
-"_edit_use_anchors_": false
163
-}
164
-
165
-[node name="Group_Manager" type="VBoxContainer" parent="VBoxContainer/HBoxContainer3"]
166
-visible = false
167
-margin_left = 824.0
168
-margin_right = 1080.0
169
-margin_bottom = 716.0
170
-rect_min_size = Vector2( 256, 0 )
171
-__meta__ = {
172
-"_edit_use_anchors_": false
173
-}
174
-
175
-[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/HBoxContainer3/Group_Manager"]
176
-margin_right = 256.0
177
-margin_bottom = 24.0
178
-
179
-[node name="Add_Group_LineEdit" type="LineEdit" parent="VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer"]
180
-margin_right = 156.0
181
-margin_bottom = 24.0
182
-rect_min_size = Vector2( 128, 0 )
183
-size_flags_horizontal = 3
184
-
185
-[node name="Add_Group_BTN" type="Button" parent="VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer"]
186
-margin_left = 160.0
187
-margin_right = 197.0
188
-margin_bottom = 24.0
189
-hint_tooltip = "Add a group to this story project."
190
-text = "Add"
191
-__meta__ = {
192
-"_edit_use_anchors_": false
193
-}
194
-
195
-[node name="Delete_Group_BTN" type="Button" parent="VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer"]
196
-margin_left = 201.0
197
-margin_right = 256.0
198
-margin_bottom = 24.0
199
-hint_tooltip = "Remove the selected group from this story project."
200
-text = "Delete"
201
-
202
-[node name="Group_ItemList" type="ItemList" parent="VBoxContainer/HBoxContainer3/Group_Manager"]
203
-margin_top = 28.0
204
-margin_right = 256.0
205
-margin_bottom = 716.0
206
-size_flags_vertical = 3
207
-
208
-[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
209
-margin_top = 576.0
210
-margin_right = 1024.0
211
-margin_bottom = 600.0
212
-rect_min_size = Vector2( 0, 24 )
213
-
214
-[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer2"]
215
-margin_top = 5.0
216
-margin_right = 65.0
217
-margin_bottom = 19.0
218
-text = "Search by "
219
-
220
-[node name="Search_OptionButton" type="OptionButton" parent="VBoxContainer/HBoxContainer2"]
221
-margin_left = 69.0
222
-margin_right = 233.0
223
-margin_bottom = 24.0
224
-text = "Human Readable LBL"
225
-items = [ "Human Readable LBL", null, false, 0, null, "DID", null, false, 1, null ]
226
-selected = 0
227
-
228
-[node name="Search_LineEdit" type="LineEdit" parent="VBoxContainer/HBoxContainer2"]
229
-margin_left = 237.0
230
-margin_right = 493.0
231
-margin_bottom = 24.0
232
-rect_min_size = Vector2( 256, 0 )
233
-
234
-[node name="Filter_MenuButton" type="MenuButton" parent="VBoxContainer/HBoxContainer2"]
235
-margin_left = 497.0
236
-margin_right = 537.0
237
-margin_bottom = 24.0
238
-hint_tooltip = "Select the groups that appear listed in the story editor."
239
-keep_pressed_outside = true
240
-text = "Tags"
241
-flat = false
242
-items = [ "-No Tags-", null, 1, true, false, 0, 0, null, "", false ]
243
-
244
-[node name="VSeparator" type="VSeparator" parent="VBoxContainer/HBoxContainer2"]
245
-margin_left = 541.0
246
-margin_right = 545.0
247
-margin_bottom = 24.0
248
-
249
-[node name="Filename_LBL" type="Label" parent="VBoxContainer/HBoxContainer2"]
250
-margin_left = 549.0
251
-margin_top = 5.0
252
-margin_right = 640.0
253
-margin_bottom = 19.0
254
-text = "Unsaved Story"
255
-[connection signal="pressed" from="VBoxContainer/HBoxContainer/Close_BTN" to="." method="_on_Close_BTN_pressed"]
256
-[connection signal="pressed" from="VBoxContainer/HBoxContainer/Create_Dialog_BTN" to="." method="_on_Create_Dialog_BTN_pressed"]
257
-[connection signal="pressed" from="VBoxContainer/HBoxContainer/Delete_Dialog_BTN" to="." method="_on_Delete_Dialog_BTN_pressed"]
258
-[connection signal="pressed" from="VBoxContainer/HBoxContainer/Check_All_BTN" to="." method="_on_Check_All_BTN_pressed"]
259
-[connection signal="pressed" from="VBoxContainer/HBoxContainer/UnCheck_All_BTN" to="." method="_on_Uncheck_All_BTN_pressed"]
260
-[connection signal="toggled" from="VBoxContainer/HBoxContainer/Group_Manager_BTN" to="." method="_on_Group_Manager_BTN_toggled"]
261
-[connection signal="pressed" from="VBoxContainer/HBoxContainer/Apply_Group_BTN" to="." method="_on_Apply_Group_BTN_pressed"]
262
-[connection signal="pressed" from="VBoxContainer/HBoxContainer/Remove_Group_BTN" to="." method="_on_Remove_Group_BTN_pressed"]
263
-[connection signal="pressed" from="VBoxContainer/HBoxContainer/Group_Selector_BTN" to="." method="_on_Group_Selector_BTN_pressed"]
264
-[connection signal="text_entered" from="VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer/Add_Group_LineEdit" to="." method="_on_Add_Group_LineEdit_text_entered"]
265
-[connection signal="pressed" from="VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer/Add_Group_BTN" to="." method="_on_Add_Group_BTN_pressed"]
266
-[connection signal="pressed" from="VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer/Delete_Group_BTN" to="." method="_on_Delete_Group_BTN_pressed"]
267
-[connection signal="item_selected" from="VBoxContainer/HBoxContainer2/Search_OptionButton" to="." method="_on_Search_OptionButton_item_selected"]
268
-[connection signal="text_changed" from="VBoxContainer/HBoxContainer2/Search_LineEdit" to="." method="_on_Search_LineEdit_text_changed"]

+ 0
- 753
addons/EXP-System-Dialog/Story Editor/story_editor.gd View File

@@ -1,753 +0,0 @@
1
-tool
2
-extends Control
3
-
4
-signal changed_story
5
-signal close_pressed
6
-signal dialog_edit_pressed(story, did)
7
-
8
-onready var _Dialog_Record_Root = self.get_node("VBoxContainer/HBoxContainer3/Panel/VScrollBar/Dialog_Record_Root")
9
-onready var _Dir = Directory.new()
10
-onready var _Filename_LBL = self.get_node("VBoxContainer/HBoxContainer2/Filename_LBL")
11
-onready var _Filter_Menu = self.get_node("VBoxContainer/HBoxContainer2/Filter_MenuButton")
12
-onready var _Group_List = self.get_node("VBoxContainer/HBoxContainer3/Group_Manager/Group_ItemList")
13
-onready var _Group_Manager_Panel = self.get_node("VBoxContainer/HBoxContainer3/Group_Manager")
14
-onready var _Group_Selector = self.get_node("VBoxContainer/HBoxContainer/Group_Selector_BTN")
15
-onready var _New_Group_LineEdit = self.get_node("VBoxContainer/HBoxContainer3/Group_Manager/HBoxContainer/Add_Group_LineEdit")
16
-onready var _Search_LineEdit = self.get_node("VBoxContainer/HBoxContainer2/Search_LineEdit")
17
-onready var _Search_Option_BTN = self.get_node("VBoxContainer/HBoxContainer2/Search_OptionButton")
18
-onready var _Story_Menu = self.get_node("VBoxContainer/HBoxContainer/Story")
19
-
20
-var _Dialog_Record = preload("res://addons/EXP-System-Dialog/Story Editor/Dialog Record/Dialog_Record.tscn")
21
-var _EXP_Baked_Story = preload("res://addons/EXP-System-Dialog/Resource_BakedStory/EXP_BakedStory.gd")
22
-var _EXP_Story = preload("res://addons/EXP-System-Dialog/Resource_EditorStory/EXP_EditorStory.gd")
23
-var _Record_Rename_Box_TSCN = preload("res://addons/EXP-System-Dialog/Story Editor/Rename Record Box/Rename_Record_Box.tscn")
24
-
25
-var _available_dids : Array
26
-var _Bake_Story_As : EditorFileDialog
27
-var _checked_dialogs : Array = []
28
-var _groups : Array
29
-var _Load_CSV : EditorFileDialog
30
-var _Load_Story : EditorFileDialog
31
-var _record_names : Dictionary
32
-var _Record_Rename_Box
33
-var _Save_CSV_As : EditorFileDialog
34
-var _Save_Story_As : EditorFileDialog
35
-var _story : Dictionary
36
-
37
-#Virtual Methods
38
-
39
-func _ready():
40
-	self._create_rename_box()
41
-	self._populate_story_menu()
42
-	self._setup_dialogs()
43
-	self._Filter_Menu.get_popup().connect("index_pressed", self, "_on_Filter_Menu_index_pressed")
44
-	self._Filter_Menu.get_popup().hide_on_checkable_item_selection = false
45
-	self._populate_filter_menu()
46
-	self._populate_searchby_menu()
47
-
48
-#Callback Methods
49
-
50
-func _on_Add_Group_BTN_pressed():
51
-	self._add_group()
52
-
53
-
54
-func _on_Add_Group_LineEdit_text_entered(new_text):
55
-	self._add_group()
56
-
57
-
58
-func _on_Apply_Group_BTN_pressed():
59
-	var id = self._Group_Selector.get_selected_id()
60
-	if id == -1:
61
-		return
62
-	
63
-	var idx = self._Group_Selector.get_item_index(id)
64
-	var group = self._Group_Selector.get_popup().get_item_text(idx)
65
-	for record in self._checked_dialogs.duplicate():
66
-		var did = record.get_did()
67
-		self._dialog_apply_group(did, group)
68
-		record.uncheck()
69
-	self.emit_signal("changed_story")
70
-
71
-
72
-func _on_Bake_Story_As_file_selected(filename : String):
73
-	self._bake_data_to(filename)
74
-
75
-
76
-func _on_Bake_Story_BTN_pressed():
77
-	self._Bake_Story_As.popup_centered_ratio(0.7)
78
-
79
-
80
-func _on_Check_All_BTN_pressed():
81
-	var records = self._Dialog_Record_Root.get_children()
82
-	for record in records:
83
-		if record.visible:
84
-			record.check()
85
-
86
-
87
-func _on_Close_BTN_pressed():
88
-	self.emit_signal("close_pressed")
89
-
90
-
91
-func _on_Create_Dialog_BTN_pressed():
92
-	self._create_dialog_record()
93
-
94
-
95
-func _on_Delete_Dialog_BTN_pressed():
96
-	self._delete_checked_dialogs()
97
-
98
-
99
-func _on_Delete_Group_BTN_pressed():
100
-	var idxs = self._Group_List.get_selected_items()
101
-	var group
102
-	for idx in idxs:
103
-		group = self._Group_List.get_item_text(idx)
104
-		self._Group_List.remove_item(idx)
105
-		self._delete_group(group)
106
-	self._populate_group_selector()
107
-	self._populate_filter_menu()
108
-	
109
-
110
-func _on_Dialog_changed_human_readable_text(did : int, new_text : String):
111
-	self.set_dialog_property(did, "human_readable_description", new_text)
112
-	self.emit_signal("changed_story")
113
-
114
-
115
-func _on_Dialog_checked(dialog):
116
-	self._checked_dialogs.push_front(dialog)
117
-
118
-
119
-func _on_Dialog_edit_pressed(did : int):
120
-	self.emit_signal("dialog_edit_pressed", self, did)
121
-
122
-
123
-func _on_Dialog_unchecked(dialog):
124
-	self._checked_dialogs.erase(dialog)
125
-
126
-
127
-func _on_Filter_Menu_index_pressed(idx):
128
-	var checked = self._Filter_Menu.get_popup().is_item_checked(idx)
129
-	if not checked:
130
-		self._Filter_Menu.get_popup().set_item_checked(idx, true)
131
-	else:
132
-		self._Filter_Menu.get_popup().set_item_checked(idx, false)
133
-	self._update_filter()
134
-
135
-
136
-func _on_Group_Manager_BTN_toggled(button_pressed : bool):
137
-	if button_pressed:
138
-		self._Group_Manager_Panel.visible = true
139
-	else:
140
-		self._Group_Manager_Panel.visible = false
141
-
142
-
143
-func _on_Group_Selector_BTN_pressed():
144
-	self._populate_group_selector()
145
-
146
-
147
-func _on_Load_CSV_BTN_pressed():
148
-	self._Load_CSV.popup_centered_ratio(0.7)
149
-
150
-
151
-func _on_Load_CSV_file_selected(filepath : String):
152
-	var csv_file = File.new()
153
-	var status = csv_file.open(filepath, File.READ)
154
-	
155
-	if not status == OK:
156
-		print_debug("EXP_Story_Editor: Error loading file \"" + filepath + "\".")
157
-		return
158
-	
159
-	csv_file.get_csv_line()
160
-	
161
-	while not csv_file.eof_reached():
162
-		var line = csv_file.get_csv_line()
163
-		
164
-		if line.empty():
165
-			continue
166
-		
167
-		var did = int(line[0])
168
-		var nid = int(line[1])
169
-		var dialog = String(line[2])
170
-		
171
-		if not self._story.has(did):
172
-			continue
173
-		if not self._story[did]["nodes"].has(nid):
174
-			continue
175
-		
176
-		self._story[did]["nodes"][nid]["text"] = dialog
177
-	
178
-	csv_file.close()
179
-
180
-
181
-func _on_Load_Story_BTN_pressed():
182
-	self._Load_Story.popup_centered_ratio(0.7)
183
-
184
-
185
-func _on_Load_Story_file_selected(filename : String):
186
-	var file_data = load(filename)
187
-	if not file_data.TYPE == "EXP_Story_editor":
188
-		return
189
-	
190
-	self._clear_story()
191
-	self._load_data_from(file_data)
192
-	self._Filename_LBL.text = filename.get_file()
193
-	
194
-	for group in self._groups:
195
-		self._Group_List.add_item(group)
196
-	self._populate_filter_menu()
197
-	
198
-	for did in self.get_dids():
199
-		var new_dialog_record = _Dialog_Record.instance()
200
-		self._Dialog_Record_Root.add_child(new_dialog_record)
201
-		new_dialog_record.set_story_editor(self)
202
-		new_dialog_record.connect("checked", self, "_on_Dialog_checked")
203
-		new_dialog_record.connect("unchecked", self, "_on_Dialog_unchecked")
204
-		new_dialog_record.connect("changed_human_readable_text", self,
205
-			"_on_Dialog_changed_human_readable_text")
206
-		new_dialog_record.connect("edit_pressed", self, "_on_Dialog_edit_pressed")
207
-		new_dialog_record.connect("rename_pressed", self, "_on_Record_Rename_pressed")
208
-		
209
-		new_dialog_record.set_did(did)
210
-		var human_readable_description = self.get_dialog_property(did, "human_readable_description")
211
-		new_dialog_record.update_human_readable_description(human_readable_description)
212
-		
213
-		if self._story[did].has("name"):
214
-			var record_name = self._story[did]["name"]
215
-			new_dialog_record.set_record_name(record_name)
216
-
217
-
218
-func _on_New_Story_BTN_pressed():
219
-	self._clear_story()
220
-
221
-
222
-func _on_Record_Rename_pressed(record):
223
-	self._Record_Rename_Box.set_target_record(record)
224
-	self._Record_Rename_Box.visible = true
225
-
226
-
227
-func _on_Remove_Group_BTN_pressed():
228
-	var id = self._Group_Selector.get_selected_id()
229
-	if id == -1:
230
-		return
231
-		
232
-	var idx = self._Group_Selector.get_item_index(id)
233
-	var group = self._Group_Selector.get_popup().get_item_text(idx)
234
-	for record in self._checked_dialogs.duplicate():
235
-		var did = record.get_did()
236
-		self._dialog_remove_group(did, group)
237
-		record.uncheck()
238
-	self.emit_signal("changed_story")
239
-
240
-
241
-func _on_Rename_Box_Rename(rename : String):
242
-	var record = self._Record_Rename_Box.get_target_record()
243
-	var old_name = record.get_record_name()
244
-	var record_did = record.get_did()
245
-	
246
-	if rename.empty() or rename == "NAME":
247
-		record.set_record_name("NAME")
248
-		self._story[record_did].erase("name")
249
-		self._record_names.erase(old_name)
250
-		return
251
-	
252
-	if self._record_names.has(rename):
253
-		return
254
-	
255
-	self._record_names.erase(old_name)
256
-	
257
-	self._record_names[rename] = record_did
258
-	self._story[record_did]["name"] = rename
259
-	record.set_record_name(rename)
260
-
261
-
262
-func _on_Save_CSV_BTN_pressed():
263
-	self._Save_CSV_As.popup_centered_ratio(0.7)
264
-
265
-
266
-func _on_Save_CVS_As_file_selected(filepath : String):
267
-	var csv_file = File.new()
268
-	var status = csv_file.open(filepath, File.WRITE)
269
-	
270
-	if not status == OK:
271
-		print_debug("EXP_Story_Editor: Error saving csv file \"" + filepath + "\".")
272
-		return
273
-	
274
-	csv_file.store_csv_line(["DID", "NID", "Dialog"], ",")
275
-	
276
-	for did in self._story.keys():
277
-		for nid in self._story[did]["nodes"].keys():
278
-			var dialog = self._story[did]["nodes"][nid]["text"]
279
-			csv_file.store_csv_line([did, nid, dialog], ",")
280
-	
281
-	csv_file.close()
282
-
283
-
284
-func _on_Save_Story_As_file_selected(filename : String):
285
-	self._save_data_to(filename)
286
-	self._Filename_LBL.text = filename.get_file()
287
-
288
-
289
-func _on_Save_Story_BTN_pressed():
290
-	self._Save_Story_As.popup_centered_ratio(0.7)
291
-
292
-
293
-func _on_Search_LineEdit_text_changed(new_text : String):
294
-	self._update_filter()
295
-
296
-
297
-func _on_Search_OptionButton_item_selected(id):
298
-	self._update_filter()
299
-
300
-
301
-func _on_story_menu_option_pressed(id):
302
-	match id:
303
-		0:
304
-			self._on_New_Story_BTN_pressed()
305
-		1:
306
-			self._on_Load_Story_BTN_pressed()
307
-		2:
308
-			self._on_Save_Story_BTN_pressed()
309
-		3:
310
-			self._on_Bake_Story_BTN_pressed()
311
-		4:
312
-			self._on_Save_CSV_BTN_pressed()
313
-		5:
314
-			self._on_Load_CSV_BTN_pressed()
315
-
316
-
317
-func _on_Uncheck_All_BTN_pressed():
318
-	var records = self._Dialog_Record_Root.get_children()
319
-	for record in records:
320
-		if record.visible:
321
-			record.uncheck()
322
-
323
-#Public Methods
324
-
325
-func create_node(did : int, type : String) -> int:
326
-	var new_nid = self._generate_nid(did)
327
-	var node_data = {"type": type, "text": "", "graph_offset": Vector2(40, 40),
328
-	"rect_size": Vector2(0,0) ,"links": {}, "slot_amount": 1}
329
-	self._story[did]["nodes"][new_nid] = node_data
330
-	return new_nid
331
-
332
-func dialog_get_groups(did : int):
333
-	return self._story[did]["groups"]
334
-
335
-
336
-func erase_all_links(did: int, nid : int):
337
-	self._story[did]["nodes"][nid]["links"].clear()
338
-
339
-
340
-func erase_dialog(did : int):
341
-	self._story.erase(did)
342
-	self._make_did_available(did)
343
-
344
-
345
-func erase_link(did : int, nid : int, slot : int):
346
-	self._story[did]["nodes"][nid]["links"].erase(slot)
347
-
348
-
349
-func erase_node(did :int, nid :int):
350
-	self._story[did]["nodes"].erase(nid)
351
-	self._make_nid_available(did, nid)
352
-
353
-
354
-func get_dialog_property(did : int, property: String):
355
-	return self._story[did][property]
356
-
357
-
358
-func get_dids():
359
-	return self._story.keys()
360
-
361
-
362
-func get_link_slots(did : int, nid : int):
363
-	return self._story[did]["nodes"][nid]["links"].keys()
364
-
365
-
366
-func get_nid_link_from(did : int, nid: int, slot : int):
367
-	return self._story[did]["nodes"][nid]["links"][slot]
368
-
369
-
370
-func get_nids(did : int):
371
-	return self._story[did]["nodes"].keys()
372
-
373
-
374
-func get_node_property(did : int, nid : int, property: String):
375
-	return self._story[did]["nodes"][nid][property]
376
-
377
-
378
-func set_dialog_property(did : int, property : String , data):
379
-	self._story[did][property] = data
380
-
381
-
382
-func set_link(did : int, this_nid : int, slot : int, that_nid : int):
383
-	self._story[did]["nodes"][this_nid]["links"][slot] = that_nid
384
-
385
-
386
-func set_node_property(did : int, nid : int, property : String , data):
387
-	self._story[did]["nodes"][nid][property] = data
388
-
389
-
390
-func set_node_slot_count(did : int, nid : int, amount : int):
391
-	self._story[did]["nodes"][nid]["slot_amount"] = amount
392
-
393
-#Private Methods
394
-
395
-func _add_group():
396
-	var new_group_name = self._New_Group_LineEdit.text
397
-	if new_group_name == "" or self._groups.has(new_group_name):
398
-		return
399
-	
400
-	self._groups.push_back(new_group_name)
401
-	self._New_Group_LineEdit.text = ""
402
-	self._Group_List.add_item(new_group_name)
403
-	self._populate_filter_menu()
404
-	
405
-	var sort_list : Array
406
-	for idx in range(self._Group_List.get_item_count()):
407
-		var group = self._Group_List.get_item_text(idx)
408
-		sort_list.push_back(group)
409
-	sort_list.sort()
410
-	self._Group_List.clear()
411
-	for group in sort_list:
412
-		self._Group_List.add_item(group)
413
-
414
-
415
-func _bake_data() :
416
-	var baked_story = self._story.duplicate(true)
417
-	for did in baked_story.keys():
418
-		baked_story[did].erase("name")
419
-		baked_story[did].erase("groups")
420
-		baked_story[did].erase("available_nid")
421
-		baked_story[did].erase("human_readable_description")
422
-		for nid in baked_story[did]["nodes"].keys():
423
-			baked_story[did]["nodes"][nid].erase("type")
424
-			baked_story[did]["nodes"][nid].erase("graph_offset")
425
-			baked_story[did]["nodes"][nid].erase("rect_size")
426
-			baked_story[did]["nodes"][nid].erase("slot_amount")
427
-	return baked_story.duplicate(true)
428
-
429
-
430
-func _bake_data_to(filename):
431
-	var file_data
432
-	if self._Dir.file_exists(filename):
433
-		file_data = load(filename)
434
-		if file_data.TYPE == "EXP_Baked_Story":
435
-			file_data.story = self._bake_data()
436
-			file_data.names = self._record_names.duplicate(true)
437
-			ResourceSaver.save(filename, file_data)
438
-	else:
439
-		file_data = _EXP_Baked_Story.new()
440
-		file_data.story = self._bake_data()
441
-		file_data.names = self._record_names.duplicate(true)
442
-		ResourceSaver.save(filename, file_data)
443
-
444
-
445
-func _clear_group_manager():
446
-	self._groups.clear()
447
-	for idx in range(self._Group_List.get_item_count()):
448
-		self._Group_List.remove_item(0)
449
-		self._populate_group_selector()
450
-		self._Filter_Menu.get_popup().clear()
451
-
452
-
453
-func _clear_story():
454
-	self._remove_all_records()
455
-	self._clear_group_manager()
456
-	self._populate_filter_menu()
457
-	self._story.clear()
458
-	self._available_dids.clear()
459
-	self._checked_dialogs.clear()
460
-	self._record_names.clear()
461
-	self._Filename_LBL.text = "Unsaved Story"
462
-	self.emit_signal("changed_story")
463
-
464
-
465
-func _create_dialog() -> int:
466
-	var new_did = self._generate_did()
467
-	var dialog_data = {"human_readable_description":
468
-		"New Dialog - Enter Human Readable Description",
469
-		"groups": [],
470
-		"available_nid": [],
471
-		"nodes": {}}
472
-	self._story[new_did] = dialog_data
473
-	return new_did
474
-
475
-
476
-func _create_dialog_record():
477
-	var new_did = self._create_dialog()
478
-	
479
-	var new_dialog_record = _Dialog_Record.instance()
480
-	self._Dialog_Record_Root.add_child(new_dialog_record)
481
-	new_dialog_record.set_story_editor(self)
482
-	
483
-	new_dialog_record.connect("checked", self, "_on_Dialog_checked")
484
-	new_dialog_record.connect("unchecked", self, "_on_Dialog_unchecked")
485
-	new_dialog_record.connect("changed_human_readable_text", self,
486
-		"_on_Dialog_changed_human_readable_text")
487
-	new_dialog_record.connect("edit_pressed", self, "_on_Dialog_edit_pressed")
488
-	new_dialog_record.connect("rename_pressed", self, "_on_Record_Rename_pressed")
489
-	
490
-	new_dialog_record.set_did(new_did)
491
-	new_dialog_record.update_human_readable_description(
492
-		"New Dialog - Enter Human Readable Description.")
493
-
494
-
495
-func _create_rename_box():
496
-	self._Record_Rename_Box = _Record_Rename_Box_TSCN.instance()
497
-	self._Record_Rename_Box.connect("rename_BTN_pressed", self, "_on_Rename_Box_Rename")
498
-	self.add_child(self._Record_Rename_Box)
499
-
500
-
501
-func _delete_checked_dialogs():
502
-	for dialog in self._checked_dialogs:
503
-		self._delete_dialog(dialog)
504
-	self._checked_dialogs.clear()
505
-	self.emit_signal("changed_story")
506
-
507
-
508
-func _delete_dialog(dialog):
509
-	var did = dialog.get_did()
510
-	self.erase_dialog(did)
511
-	self._remove_record(dialog)
512
-
513
-
514
-func _delete_group(group):
515
-	self._groups.erase(group)
516
-	self._remove_group_from_story(group)
517
-
518
-
519
-func _dialog_apply_group(did : int, group : String):
520
-	if not self._story[did]["groups"].has(group):
521
-		self._story[did]["groups"].push_back(group)
522
-
523
-
524
-func _dialog_remove_group(did : int, group : String):
525
-	if self._story[did]["groups"].has(group):
526
-		self._story[did]["groups"].erase(group)
527
-
528
-
529
-func _generate_did() -> int:
530
-	if not self._available_dids.empty():
531
-		return self._available_dids.pop_front()
532
-	else:
533
-		return self._story.size() + 1
534
-
535
-
536
-func _generate_nid(did : int) -> int:
537
-	if not self._story[did]["available_nid"].empty():
538
-		return self._story[did]["available_nid"].pop_front()
539
-	else:
540
-		return self._story[did]["nodes"].size() + 1
541
-
542
-
543
-func _load_data_from(new_story):
544
-	self._story = new_story.story.duplicate(true)
545
-	self._available_dids = new_story.available_dids.duplicate(true)
546
-	self._groups = new_story.groups.duplicate(true)
547
-	self._record_names = new_story.names.duplicate(true)
548
-	
549
-
550
-
551
-func _make_did_available(did : int):
552
-	self._available_dids.push_front(did)
553
-	self._available_dids.sort()
554
-
555
-
556
-func _make_nid_available(did : int, nid : int):
557
-	self._story[did]["available_nid"].push_front(nid)
558
-	self._story[did]["available_nid"].sort()
559
-
560
-
561
-func _make_records_visible():
562
-	var children = self._Dialog_Record_Root.get_children()
563
-	for child in children:
564
-		child.visible = true
565
-
566
-
567
-func _populate_filter_menu():
568
-	self._Filter_Menu.get_popup().clear()
569
-	self._Filter_Menu.get_popup().add_check_item("-No Tags-")
570
-	for group in self._groups:
571
-		self._Filter_Menu.get_popup().add_check_item(group)
572
-	for idx in range(self._Filter_Menu.get_popup().get_item_count()):
573
-		self._Filter_Menu.get_popup().set_item_checked(idx, true)
574
-
575
-
576
-func _populate_group_selector():
577
-	self._Group_Selector.clear()
578
-	self._Group_Selector.text = "Tags"
579
-	for group in self._groups:
580
-		self._Group_Selector.get_popup().add_item(group)
581
-
582
-
583
-func _populate_searchby_menu():
584
-	self._Search_Option_BTN.clear()
585
-	self._Search_Option_BTN.get_popup().add_item("Human Readable LBL", 0)
586
-	self._Search_Option_BTN.get_popup().add_item("DID", 1)
587
-	self._Search_Option_BTN.get_popup().add_item("Record Name", 2)
588
-	self._Search_Option_BTN.select(0)
589
-
590
-func _populate_story_menu():
591
-	self._Story_Menu.get_popup().clear()
592
-	self._Story_Menu.get_popup().add_item("New Story", 0)
593
-	self._Story_Menu.get_popup().add_item("Load Story", 1)
594
-	self._Story_Menu.get_popup().add_item("Save Story As", 2)
595
-	self._Story_Menu.get_popup().add_item("Bake Story As", 3)
596
-	self._Story_Menu.get_popup().add_item("Save CSV As", 4)
597
-	self._Story_Menu.get_popup().add_item("Load CSV", 5)
598
-	self._Story_Menu.get_popup().connect("id_pressed", self, "_on_story_menu_option_pressed")
599
-
600
-
601
-func _remove_all_records():
602
-	var dialog_records = self._Dialog_Record_Root.get_children()
603
-	for record in dialog_records:
604
-		self._remove_record(record)
605
-
606
-
607
-func _remove_group_from_story(group : String):
608
-	for did in self._story:
609
-		if self._story[did]["groups"].has(group):
610
-			self._story[did]["groups"].erase(group)
611
-
612
-
613
-func _remove_record(dialog_record):
614
-	dialog_record.disconnect("checked", self, "_on_Dialog_checked")
615
-	dialog_record.disconnect("unchecked", self, "_on_Dialog_unchecked")
616
-	dialog_record.disconnect("changed_human_readable_text", self,
617
-		"_on_Dialog_changed_human_readable_text")
618
-	dialog_record.disconnect("rename_pressed", self, "_on_Record_Rename_pressed")
619
-	var record_name = dialog_record.get_record_name()
620
-	if not record_name == "NAME":
621
-		self._record_names.erase(record_name)
622
-	
623
-	dialog_record.free()
624
-
625
-
626
-func _save_data_to(filename):
627
-	var file_data
628
-	if self._Dir.file_exists(filename):
629
-		file_data = load(filename)
630
-		if file_data.TYPE == "EXP_Story_editor":
631
-			file_data.names = self._record_names.duplicate(true)
632
-			file_data.story = self._story.duplicate(true)
633
-			file_data.available_dids = self._available_dids.duplicate(true)
634
-			file_data.groups = self._groups.duplicate(true)
635
-			ResourceSaver.save(filename, file_data)
636
-	else:
637
-		file_data = _EXP_Story.new()
638
-		file_data.names = self._record_names.duplicate(true)
639
-		file_data.story = self._story.duplicate(true)
640
-		file_data.available_dids = self._available_dids.duplicate(true)
641
-		file_data.groups = self._groups.duplicate(true)
642
-		ResourceSaver.save(filename, file_data)
643
-
644
-
645
-func _setup_dialogs():
646
-	self._Load_Story = EditorFileDialog.new()
647
-	self._Load_Story.mode = EditorFileDialog.MODE_OPEN_FILE
648
-	self._Load_Story.add_filter("*.tres ; Story files")
649
-	self._Load_Story.resizable = true
650
-	self._Load_Story.access = EditorFileDialog.ACCESS_RESOURCES
651
-	self._Load_Story.current_dir = "res://"
652
-	self._Load_Story.connect("file_selected", self, "_on_Load_Story_file_selected")
653
-	self.add_child(self._Load_Story)
654
-	
655
-	self._Save_Story_As = EditorFileDialog.new()
656
-	self._Save_Story_As.mode = EditorFileDialog.MODE_SAVE_FILE
657
-	self._Save_Story_As.add_filter("*.tres ; Story files")
658
-	self._Save_Story_As.resizable = true
659
-	self._Save_Story_As.access = EditorFileDialog.ACCESS_RESOURCES
660
-	self._Save_Story_As.current_dir = "res://"
661
-	self._Save_Story_As.connect("file_selected", self, "_on_Save_Story_As_file_selected")
662
-	self.add_child(self._Save_Story_As)
663
-	
664
-	self._Bake_Story_As = EditorFileDialog.new()
665
-	self._Bake_Story_As.mode = EditorFileDialog.MODE_SAVE_FILE
666
-	self._Bake_Story_As.add_filter("*.tres ; Baked Story files")
667
-	self._Bake_Story_As.resizable = true
668
-	self._Bake_Story_As.access = EditorFileDialog.ACCESS_RESOURCES
669
-	self._Bake_Story_As.current_dir = "res://"
670
-	self._Bake_Story_As.connect("file_selected", self, "_on_Bake_Story_As_file_selected")
671
-	self.add_child(self._Bake_Story_As)
672
-	
673
-	self._Save_CSV_As = EditorFileDialog.new()
674
-	self._Save_CSV_As.mode = EditorFileDialog.MODE_SAVE_FILE
675
-	self._Save_CSV_As.add_filter("*.csv ; CSV files")
676
-	self._Save_CSV_As.resizable = true
677
-	self._Save_CSV_As.access = EditorFileDialog.ACCESS_FILESYSTEM
678
-	self._Save_CSV_As.current_dir = "res://"
679
-	self._Save_CSV_As.connect("file_selected", self, "_on_Save_CVS_As_file_selected")
680
-	self.add_child(self._Save_CSV_As)
681
-	
682
-	self._Load_CSV  = EditorFileDialog.new()
683
-	self._Load_CSV .mode = EditorFileDialog.MODE_OPEN_FILE
684
-	self._Load_CSV .add_filter("*.csv ; CSV files")
685
-	self._Load_CSV .resizable = true
686
-	self._Load_CSV .access = EditorFileDialog.ACCESS_FILESYSTEM
687
-	self._Load_CSV .current_dir = "res://"
688
-	self._Load_CSV .connect("file_selected", self, "_on_Load_CSV_file_selected")
689
-	self.add_child(self._Load_CSV)
690
-
691
-
692
-func _update_filter():
693
-	var new_text = self._Search_LineEdit.text
694
-	self._make_records_visible()
695
-	
696
-	var filter_groups : Array
697
-	for idx in range(self._Filter_Menu.get_popup().get_item_count()):
698
-		if self._Filter_Menu.get_popup().is_item_checked(idx):
699
-			var group = self._Filter_Menu.get_popup().get_item_text(idx)
700
-			filter_groups.push_back(group)
701
-	
702
-	var children = self._Dialog_Record_Root.get_children()
703
-	
704
-	var search_option = self._Search_Option_BTN.selected
705
-	
706
-	match search_option:
707
-		0: #Human Readable Search
708
-			for child in children:
709
-				var did = child.get_did()
710
-				var human_readable_description = self.get_dialog_property(did, "human_readable_description")
711
-				if human_readable_description.find(new_text) == -1 and not new_text.empty():
712
-					child.visible = false
713
-				else:
714
-					child.visible = false
715
-					if self._Filter_Menu.get_popup().get_item_count() == 0:
716
-						child.visible = true
717
-					var dialog_groups = self.dialog_get_groups(did)
718
-					if dialog_groups.empty() and filter_groups.has("-No Tags-"):
719
-						child.visible = true
720
-					for group in dialog_groups:
721
-						if filter_groups.has(group):
722
-							child.visible = true
723
-		1: #DID Search
724
-			for child in children:
725
-				var did = child.get_did()
726
-				if not new_text == str(did) and not new_text.empty():
727
-					child.visible = false
728
-				else:
729
-					child.visible = false
730
-					if self._Filter_Menu.get_popup().get_item_count() == 0:
731
-						child.visible = true
732
-					var dialog_groups = self.dialog_get_groups(did)
733
-					if dialog_groups.empty() and filter_groups.has("-No Tags-"):
734
-						child.visible = true
735
-					for group in dialog_groups:
736
-						if filter_groups.has(group):
737
-							child.visible = true
738
-		2: #Record Name Search 
739
-			for child in children:
740
-				var did = child.get_did()
741
-				var record_name = child.get_record_name()
742
-				if record_name.find(new_text) == -1 and not new_text.empty():
743
-					child.visible = false
744
-				else:
745
-					child.visible = false
746
-					if self._Filter_Menu.get_popup().get_item_count() == 0:
747
-						child.visible = true
748
-					var dialog_groups = self.dialog_get_groups(did)
749
-					if dialog_groups.empty() and filter_groups.has("-No Tags-"):
750
-						child.visible = true
751
-					for group in dialog_groups:
752
-						if filter_groups.has(group):
753
-							child.visible = true

+ 0
- 7
addons/EXP-System-Dialog/plugin.cfg View File

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

+ 0
- 87
addons/EXP-System-Dialog/plugin.gd View File

@@ -1,87 +0,0 @@
1
-tool
2
-extends EditorPlugin
3
-
4
-var _Story_Editor = preload("res://addons/EXP-System-Dialog/Story Editor/Story_Editor.tscn")
5
-var _Story_Editor_Instance
6
-var _Story_Editor_BTN : ToolButton
7
-var _Dialog_Editor = preload("res://addons/EXP-System-Dialog/Dialog Editor/Dialog_Editor.tscn")
8
-var _Dialog_Editor_Instance
9
-var _Dialog_Editor_BTN : ToolButton
10
-
11
-
12
-func _enter_tree():
13
-	
14
-	self._Story_Editor_Instance = self._Story_Editor.instance()
15
-	self._Story_Editor_Instance.connect("close_pressed", self, "_on_StoryFile_Editor_close_pressed")
16
-	self._Story_Editor_BTN = self.add_control_to_bottom_panel(self._Story_Editor_Instance, "EXP StoryFile Editor")
17
-	self._Story_Editor_Instance.visible = false
18
-	self._Story_Editor_BTN.visible = false
19
-	self.add_tool_menu_item("EXP StoryFile Editor", self, "_on_StoryFile_Editor_opened")
20
-	
21
-	self._Dialog_Editor_Instance = self._Dialog_Editor.instance()
22
-	self._Dialog_Editor_BTN = self.add_control_to_bottom_panel(self._Dialog_Editor_Instance, "EXP Dialog Editor")
23
-	self._Dialog_Editor_BTN.visible = false
24
-	
25
-	self._Story_Editor_Instance.connect("dialog_edit_pressed",
26
-		self, "_on_Story_Editor_dialog_edit_pressed")
27
-	self._Story_Editor_Instance.connect("dialog_edit_pressed",
28
-		self._Dialog_Editor_Instance, "_on_Story_Editor_dialog_edit_pressed")
29
-	self._Dialog_Editor_Instance.connect("close_BTN_pressed", self,
30
-		"_on_Dialog_Editor_close_BTN_pressed")
31
-	self._Dialog_Editor_Instance.connect("back_BTN_pressed", self,
32
-		"_on_Dialog_Editor_back_BTN_pressed")
33
-	self._Story_Editor_Instance.connect("changed_story", self,
34
-		"_on_Story_Editor_changed_story")
35
-	
36
-	
37
-func _exit_tree():
38
-	
39
-	self._Story_Editor_Instance.disconnect("dialog_edit_pressed",
40
-		self, "_on_Story_Editor_dialog_edit_pressed")
41
-	self._Story_Editor_Instance.disconnect("dialog_edit_pressed",
42
-		self._Dialog_Editor_Instance, "_on_Story_Editor_dialog_edit_pressed")
43
-	self._Dialog_Editor_Instance.disconnect("close_BTN_pressed", self,
44
-		"_on_Dialog_Editor_close_BTN_pressed")
45
-	self._Dialog_Editor_Instance.disconnect("back_BTN_pressed", self,
46
-		"_on_Dialog_Editor_back_BTN_pressed")
47
-	self._Story_Editor_Instance.disconnect("changed_story", self,
48
-		"_on_Story_Editor_changed_story")
49
-		
50
-	self.remove_control_from_bottom_panel(self._Story_Editor_Instance)
51
-	self._Story_Editor_Instance.queue_free()
52
-	self.remove_control_from_bottom_panel(self._Dialog_Editor_Instance)
53
-	self._Dialog_Editor_Instance.queue_free()
54
-	self.remove_tool_menu_item("EXP StoryFile Editor")
55
-
56
-
57
-func _on_Story_Editor_dialog_edit_pressed(story, did):
58
-	self._Dialog_Editor_BTN.visible = true
59
-	self._Story_Editor_BTN.pressed = false
60
-	self._Dialog_Editor_BTN.pressed = true
61
-	self._Dialog_Editor_BTN.emit_signal("pressed")
62
-
63
-
64
-func _on_Dialog_Editor_close_BTN_pressed():
65
-	self._Dialog_Editor_BTN.pressed = false
66
-	self._Dialog_Editor_BTN.visible = false
67
-
68
-
69
-func _on_Story_Editor_changed_story():
70
-	self._Dialog_Editor_BTN.visible = false
71
-
72
-
73
-func _on_Dialog_Editor_back_BTN_pressed():
74
-	self._Story_Editor_BTN.pressed = true
75
-	self._Dialog_Editor_BTN.pressed = false
76
-	self._Story_Editor_BTN.emit_signal("pressed")
77
-
78
-
79
-func _on_StoryFile_Editor_opened(trash_parameter):
80
-	self._Story_Editor_BTN.visible = true
81
-
82
-
83
-func _on_StoryFile_Editor_close_pressed():
84
-	self._Story_Editor_Instance.visible = false
85
-	self._Story_Editor_BTN.visible = false
86
-	self._Dialog_Editor_Instance.visible = false
87
-	self._Dialog_Editor_BTN.visible = false

+ 5
- 16
addons/dialogic/Editor/CharacterEditor/CharacterEditor.gd View File

@@ -71,15 +71,7 @@ func create_character():
71 71
 		'default_speaker': false,
72 72
 		'portraits': []
73 73
 	}
74
-	var directory = Directory.new()
75
-	if not directory.dir_exists(DialogicUtil.get_path('WORKING_DIR')):
76
-		directory.make_dir(DialogicUtil.get_path('WORKING_DIR'))
77
-	if not directory.dir_exists(DialogicUtil.get_path('CHAR_DIR')):
78
-		directory.make_dir(DialogicUtil.get_path('CHAR_DIR'))
79
-	var file = File.new()
80
-	file.open(DialogicUtil.get_path('CHAR_DIR', character_file), File.WRITE)
81
-	file.store_line(to_json(character))
82
-	file.close()
74
+	DialogicResources.set_character(character)
83 75
 	character['metadata'] = {'file': character_file}
84 76
 	return character
85 77
 
@@ -118,19 +110,16 @@ func generate_character_data_to_save():
118 110
 
119 111
 
120 112
 func save_character():
121
-	var path = DialogicUtil.get_path('CHAR_DIR', nodes['file'].text)
122 113
 	var info_to_save = generate_character_data_to_save()
123 114
 	if info_to_save['id']:
124
-		var file = File.new()
125
-		file.open(path, File.WRITE)
126
-		file.store_line(to_json(info_to_save))
127
-		file.close()
115
+		DialogicResources.set_character(info_to_save)
128 116
 		opened_character_data = info_to_save
129 117
 
130 118
 
131
-func load_character(path):
132
-	var data = DialogicUtil.load_json(path)
119
+
120
+func load_character(filename: String):
133 121
 	clear_character_editor()
122
+	var data = DialogicResources.get_character_json(filename)
134 123
 	opened_character_data = data
135 124
 	nodes['file'].text = data['id']
136 125
 	nodes['default_speaker'].pressed = false

+ 1
- 1
addons/dialogic/Editor/CharacterEditor/PortraitEntry.gd View File

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

+ 9
- 29
addons/dialogic/Editor/DefinitionEditor/DefinitionEditor.gd View File

@@ -70,43 +70,23 @@ func show_sub_editor(type):
70 70
 		nodes['extra_editor'].visible = true
71 71
 
72 72
 
73
-func get_definition(key, default):
73
+func get_definition(key: String, default):
74 74
 	if current_section != '':
75
-		var config = ConfigFile.new()
76
-		config.load(DialogicUtil.get_path('DEFINITIONS_FILE'))
77
-		if config.has_section(current_section):
78
-			return config.get_value(current_section, key, default)
75
+		return DialogicResources.get_default_definition_key(current_section, key, default)
79 76
 	else:
80 77
 		return default
81 78
 
82 79
 
83 80
 func new_definition():
84
-	var config = ConfigFile.new()
85 81
 	var section = DialogicUtil.generate_random_id()
86
-	var err = config.load(DialogicUtil.get_path('DEFINITIONS_FILE'))
87
-	if err == OK:
88
-		config.set_value(section, 'name', 'New definition')
89
-		config.set_value(section, 'type', 0)
90
-		config.set_value(section, 'value', '')
91
-		config.save(DialogicUtil.get_path('DEFINITIONS_FILE'))
92
-		master_tree.add_definition({'section': section,'name': 'New definition', 'type': 0}, true)
93
-	else:
94
-		print('Error loading definitions')
82
+	DialogicResources.add_default_definition_variable(section, 'New definition', 0, '')
83
+	master_tree.add_definition({'section': section,'name': 'New definition', 'type': 0}, true)
95 84
 
96 85
 
97 86
 func save_definition():
98 87
 	if current_section != '':
99
-		var config = ConfigFile.new()
100
-		var err = config.load(DialogicUtil.get_path('DEFINITIONS_FILE'))
101
-		if err == OK:
102
-			config.set_value(current_section, 'name', nodes['name'].text)
103
-			var type = nodes['type'].selected
104
-			config.set_value(current_section, 'type', type)
105
-			if type == 0:
106
-				config.set_value(current_section, 'value', nodes['value'].text)
107
-			if type == 1:
108
-				config.set_value(current_section, 'extra_title', nodes['extra_title'].text)
109
-				config.set_value(current_section, 'extra_text', nodes['extra_text'].text)
110
-				config.set_value(current_section, 'extra_extra', nodes['extra_extra'].text)
111
-			
112
-			config.save(DialogicUtil.get_path('DEFINITIONS_FILE'))
88
+		var type: int = nodes['type'].selected
89
+		if type == 0:
90
+			DialogicResources.set_default_definition_variable(current_section, nodes['name'].text, nodes['value'].text)
91
+		if type == 1:
92
+			DialogicResources.set_default_definition_glossary(current_section, nodes['name'].text, nodes['extra_title'].text, nodes['extra_text'].text, nodes['extra_extra'].text)

+ 11
- 22
addons/dialogic/Editor/EditorView.gd View File

@@ -1,7 +1,6 @@
1 1
 tool
2 2
 extends Control
3 3
 
4
-var plugin_reference
5 4
 var debug_mode: bool = true # For printing info
6 5
 var editor_file_dialog # EditorFileDialog
7 6
 var file_picker_data: Dictionary = {'method': '', 'node': self}
@@ -59,7 +58,7 @@ func _ready():
59 58
 # Timeline context menu
60 59
 func _on_TimelinePopupMenu_id_pressed(id):
61 60
 	if id == 0: # View files
62
-		OS.shell_open(ProjectSettings.globalize_path(DialogicUtil.get_path('TIMELINE_DIR')))
61
+		OS.shell_open(ProjectSettings.globalize_path(DialogicResources.get_path('TIMELINE_DIR')))
63 62
 	if id == 1: # Copy to clipboard
64 63
 		OS.set_clipboard($MainPanel/TimelineEditor.timeline_name)
65 64
 	if id == 2: # Remove
@@ -78,7 +77,7 @@ func _on_RemoveTimelineConfirmation_confirmed():
78 77
 # Character context menu
79 78
 func _on_CharacterPopupMenu_id_pressed(id):
80 79
 	if id == 0:
81
-		OS.shell_open(ProjectSettings.globalize_path(DialogicUtil.get_path('CHAR_DIR')))
80
+		OS.shell_open(ProjectSettings.globalize_path(DialogicResources.get_path('CHAR_DIR')))
82 81
 	if id == 1:
83 82
 		$RemoveCharacterConfirmation.popup_centered()
84 83
 
@@ -86,7 +85,7 @@ func _on_CharacterPopupMenu_id_pressed(id):
86 85
 # Theme context menu
87 86
 func _on_ThemePopupMenu_id_pressed(id):
88 87
 	if id == 0:
89
-		OS.shell_open(ProjectSettings.globalize_path(DialogicUtil.get_path('THEME_DIR')))
88
+		OS.shell_open(ProjectSettings.globalize_path(DialogicResources.get_path('THEME_DIR')))
90 89
 	if id == 1:
91 90
 		$RemoveThemeConfirmation.popup_centered()
92 91
 
@@ -94,38 +93,28 @@ func _on_ThemePopupMenu_id_pressed(id):
94 93
 # Definition context menu
95 94
 func _on_DefinitionPopupMenu_id_pressed(id):
96 95
 	if id == 0:
97
-		OS.shell_open(ProjectSettings.globalize_path(DialogicUtil.get_path('DEFINITIONS_FILE')))
96
+		OS.shell_open(ProjectSettings.globalize_path(DialogicResources.get_path('DEFAULT_DEFINITIONS_FILE')))
98 97
 	if id == 1:
99 98
 		$RemoveDefinitionConfirmation.popup_centered()
100 99
 
101 100
 
102 101
 func _on_RemoveDefinitionConfirmation_confirmed():
103 102
 	var target = $MainPanel/DefinitionEditor.current_section
104
-	var config = ConfigFile.new()
105
-	var err = config.load(DialogicUtil.get_path('DEFINITIONS_FILE'))
106
-	if err == OK:
107
-		config.erase_section(target)
108
-		config.save(DialogicUtil.get_path('DEFINITIONS_FILE'))
109
-		$MainPanel/MasterTree.remove_selected()
110
-		$MainPanel/MasterTree.hide_all_editors(true)
111
-	else:
112
-		print('Error loading definitions')
103
+	DialogicResources.delete_default_definition(target)
104
+	$MainPanel/MasterTree.remove_selected()
105
+	$MainPanel/MasterTree.hide_all_editors(true)
113 106
 
114 107
 
115 108
 func _on_RemoveCharacterConfirmation_confirmed():
116
-	var dir = Directory.new()
117
-	print($MainPanel/CharacterEditor.opened_character_data)
118
-	var target = DialogicUtil.get_path('CHAR_DIR', $MainPanel/CharacterEditor.opened_character_data['id']) 
119
-	dir.remove(target)
109
+	var filename = DialogicResources.get_path('CHAR_DIR', $MainPanel/CharacterEditor.opened_character_data['id']) 
110
+	DialogicResources.delete_character(filename)
120 111
 	$MainPanel/MasterTree.remove_selected()
121 112
 	$MainPanel/MasterTree.hide_all_editors(true)
122 113
 
123 114
 
124 115
 func _on_RemoveThemeConfirmation_confirmed():
125
-	var dir = Directory.new()
126
-	var filepath = $MainPanel/MasterTree.get_selected().get_metadata(0)['file']
127
-	var target = DialogicUtil.get_path('THEME_DIR', filepath) 
128
-	dir.remove(target)
116
+	var filename = $MainPanel/MasterTree.get_selected().get_metadata(0)['file']
117
+	DialogicResources.delete_timeline(filename)
129 118
 	$MainPanel/MasterTree.remove_selected()
130 119
 	$MainPanel/MasterTree.hide_all_editors(true)
131 120
 

+ 4
- 4
addons/dialogic/Editor/MasterTree/MasterTree.gd View File

@@ -69,7 +69,7 @@ func _ready():
69 69
 		add_character(c)
70 70
 	
71 71
 	# Adding Definitions
72
-	for d in DialogicUtil.get_definition_list():
72
+	for d in DialogicUtil.get_default_definition_list():
73 73
 		add_definition(d)
74 74
 	
75 75
 	# Adding Themes
@@ -149,10 +149,10 @@ func _on_item_selected():
149 149
 	hide_all_editors()
150 150
 	if metadata['editor'] == 'Timeline':
151 151
 		timeline_editor.visible = true
152
-		timeline_editor.load_timeline(DialogicUtil.get_path('TIMELINE_DIR', metadata['file']))
152
+		timeline_editor.load_timeline(metadata['file'])
153 153
 	if metadata['editor'] == 'Character':
154 154
 		character_editor.visible = true
155
-		character_editor.load_character(DialogicUtil.get_path('CHAR_DIR', metadata['file']))
155
+		character_editor.load_character(metadata['file'])
156 156
 	if metadata['editor'] == 'Definition':
157 157
 		definition_editor.visible = true
158 158
 		definition_editor.load_definition(metadata['section'])
@@ -221,7 +221,7 @@ func _on_item_edited():
221 221
 	if metadata['editor'] == 'Timeline':
222 222
 		timeline_editor.timeline_name = item.get_text(0)
223 223
 	if metadata['editor'] == 'Theme':
224
-		DialogicUtil.set_theme_value(metadata['file'], 'settings', 'name', item.get_text(0))
224
+		DialogicResources.set_theme_value(metadata['file'], 'settings', 'name', item.get_text(0))
225 225
 	if metadata['editor'] == 'Character':
226 226
 		character_editor.nodes['name'].text = item.get_text(0)
227 227
 	if metadata['editor'] == 'Definition':

+ 1
- 4
addons/dialogic/Editor/Pieces/ChangeTimeline.gd View File

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

+ 1
- 1
addons/dialogic/Editor/Pieces/CharacterJoinBlock.gd View File

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

+ 1
- 1
addons/dialogic/Editor/Pieces/CharacterLeaveBlock.gd View File

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

+ 1
- 1
addons/dialogic/Editor/Pieces/Common/CharacterPicker.gd View File

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

+ 58
- 0
addons/dialogic/Editor/Pieces/Common/ConditionPicker.gd View File

@@ -0,0 +1,58 @@
1
+tool
2
+extends MenuButton
3
+
4
+var options = [
5
+	{
6
+		"text": "[ Equal to ]",
7
+		"condition": "=="
8
+	},
9
+	{
10
+		"text": "[ Different from ]",
11
+		"condition": "!="
12
+	},
13
+	{
14
+		"text": "[ Greater than ]",
15
+		"condition": ">"
16
+	},
17
+	{
18
+		"text": "[ Greater or equal to ]",
19
+		"condition": ">="
20
+	},
21
+	{
22
+		"text": "[ Less than ]",
23
+		"condition": "<"
24
+	},
25
+	{
26
+		"text": "[ Less or equal to ]",
27
+		"condition": "<="
28
+	}
29
+]
30
+
31
+func _ready():
32
+	get_popup().connect("index_pressed", self, '_on_entry_selected')
33
+	get_popup().clear()
34
+	connect("about_to_show", self, "_on_MenuButton_about_to_show")
35
+
36
+
37
+func _on_MenuButton_about_to_show():
38
+	get_popup().clear()
39
+	var index = 0
40
+	for o in options:
41
+		get_popup().add_item(o['text'])
42
+		get_popup().set_item_metadata(index, o)
43
+		index += 1
44
+
45
+
46
+func _on_entry_selected(index):
47
+	var _text = get_popup().get_item_text(index)
48
+	var metadata = get_popup().get_item_metadata(index)
49
+	text = _text
50
+
51
+
52
+func load_condition(condition):
53
+	if condition != '':
54
+		for o in options:
55
+			if (o['condition'] == condition):
56
+				text = o['text']
57
+	else:
58
+		text = options[0]['text']

+ 13
- 0
addons/dialogic/Editor/Pieces/Common/ConditionPicker.tscn View File

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

+ 2
- 2
addons/dialogic/Editor/Pieces/Common/DefinitionPicker.gd View File

@@ -12,7 +12,7 @@ func _ready():
12 12
 func _on_MenuButton_about_to_show():
13 13
 	get_popup().clear()
14 14
 	var index = 0
15
-	for d in DialogicUtil.get_definition_list():
15
+	for d in DialogicUtil.get_default_definition_list():
16 16
 		if d['type'] == 0:
17 17
 			get_popup().add_item(d['name'])
18 18
 			get_popup().set_item_metadata(index, {
@@ -29,7 +29,7 @@ func _on_entry_selected(index):
29 29
 
30 30
 func load_definition(section):
31 31
 	if section != '':
32
-		for d in DialogicUtil.get_definition_list():
32
+		for d in DialogicUtil.get_default_definition_list():
33 33
 			if d['section'] == section:
34 34
 				text = d['name']
35 35
 	else:

+ 23
- 1
addons/dialogic/Editor/Pieces/Common/DragController.gd View File

@@ -2,10 +2,12 @@ tool
2 2
 extends Control
3 3
 
4 4
 var moving
5
+var hover = false
5 6
 
6 7
 func _ready():
7 8
 	get_parent().connect("gui_input", self, '_on_gui_input')
8
-
9
+	get_parent().connect("mouse_entered", self, '_on_mouse_entered')
10
+	get_parent().connect("mouse_exited", self, '_on_mouse_exited')
9 11
 
10 12
 func _process(delta):
11 13
 	if moving:
@@ -17,6 +19,18 @@ func _process(delta):
17 19
 			get_parent().get_node("PanelContainer/VBoxContainer/Header/OptionButton")._on_OptionSelected(0)
18 20
 		if current_position.y > node_position + height:
19 21
 			get_parent().get_node("PanelContainer/VBoxContainer/Header/OptionButton")._on_OptionSelected(1)
22
+	
23
+	# TODO: I have to figure out a way to modify only an instance's theme. 
24
+	# This code modifies the custom theme of all the same kind of scenes.
25
+	
26
+	#if hover:
27
+	#	get_parent().get_node("PanelContainer").self_modulate = Color("#dd42ff")
28
+	#	var panel = get_parent().get_node("PanelContainer").get('custom_styles/panel')
29
+	#	panel.set('border_color', '#ffffff')
30
+	#else:
31
+	#	get_parent().get_node("PanelContainer").self_modulate = Color("#ffffff")
32
+	#	var panel = get_parent().get_node("PanelContainer").get('custom_styles/panel')
33
+	#	panel.set('border_color', '#202020')
20 34
 
21 35
 
22 36
 func _on_gui_input(event):
@@ -25,3 +39,11 @@ func _on_gui_input(event):
25 39
 			moving = false
26 40
 		else:
27 41
 			moving = true
42
+
43
+
44
+func _on_mouse_entered():
45
+	hover = true
46
+
47
+
48
+func _on_mouse_exited():
49
+	hover = false

+ 9
- 1
addons/dialogic/Editor/Pieces/IfCondition.gd View File

@@ -7,17 +7,19 @@ var editorPopup
7 7
 
8 8
 # This is the information of this event and it will get parsed and saved to the JSON file.
9 9
 var event_data = {
10
-	'condition': '',
10
+	'condition': '==',
11 11
 	'definition': '',
12 12
 	'value': ''
13 13
 }
14 14
 
15 15
 onready var nodes = {
16 16
 	'definition_picker': $PanelContainer/VBoxContainer/Header/DefinitionPicker,
17
+	'condition_picker': $PanelContainer/VBoxContainer/Header/ConditionPicker,
17 18
 }
18 19
 
19 20
 func _ready():
20 21
 	nodes['definition_picker'].get_popup().connect("index_pressed", self, '_on_definition_entry_selected')
22
+	nodes['condition_picker'].get_popup().connect("index_pressed", self, '_on_condition_entry_selected')
21 23
 	$PanelContainer/VBoxContainer/Header/CustomLineEdit.connect("text_changed", self, '_on_text_changed')
22 24
 
23 25
 
@@ -29,8 +31,14 @@ func load_data(data):
29 31
 	event_data = data
30 32
 	$PanelContainer/VBoxContainer/Header/CustomLineEdit.text = event_data['value']
31 33
 	nodes['definition_picker'].load_definition(data['definition'])
34
+	nodes['condition_picker'].load_condition(data['condition'])
32 35
 
33 36
 
34 37
 func _on_definition_entry_selected(index):
35 38
 	var metadata = nodes['definition_picker'].get_popup().get_item_metadata(index)
36 39
 	event_data['definition'] = metadata['section']
40
+
41
+
42
+func _on_condition_entry_selected(index):
43
+	var metadata = nodes['condition_picker'].get_popup().get_item_metadata(index)
44
+	event_data['condition'] = metadata['condition']

+ 3
- 6
addons/dialogic/Editor/Pieces/IfCondition.tscn View File

@@ -1,7 +1,8 @@
1
-[gd_scene load_steps=8 format=2]
1
+[gd_scene load_steps=9 format=2]
2 2
 
3 3
 [ext_resource path="res://addons/dialogic/Images/condition.svg" type="Texture" id=1]
4 4
 [ext_resource path="res://addons/dialogic/Editor/Pieces/IfCondition.gd" type="Script" id=2]
5
+[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/ConditionPicker.tscn" type="PackedScene" id=3]
5 6
 [ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
6 7
 [ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DragController.tscn" type="PackedScene" id=5]
7 8
 [ext_resource path="res://addons/dialogic/Editor/Pieces/Common/CustomLineEdit.tscn" type="PackedScene" id=6]
@@ -70,11 +71,7 @@ margin_left = 26.0
70 71
 margin_right = 169.0
71 72
 margin_bottom = 28.0
72 73
 
73
-[node name="MenuButton2" type="MenuButton" parent="PanelContainer/VBoxContainer/Header"]
74
-margin_left = 173.0
75
-margin_right = 252.0
76
-margin_bottom = 28.0
77
-text = "[ Equal to ]"
74
+[node name="ConditionPicker" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 3 )]
78 75
 
79 76
 [node name="CustomLineEdit" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 6 )]
80 77
 margin_left = 256.0

+ 2
- 7
addons/dialogic/Editor/SettingsEditor/SettingsEditor.gd View File

@@ -17,7 +17,7 @@ func _ready():
17 17
 
18 18
 
19 19
 func update_data():
20
-	var settings = DialogicUtil.get_settings()
20
+	var settings = DialogicResources.get_settings_config()
21 21
 	refresh_themes(settings)
22 22
 	dialog_options(settings)
23 23
 
@@ -71,9 +71,4 @@ func _on_auto_color_names_toggled(value):
71 71
 
72 72
 # Reading and saving data to the settings file
73 73
 func set_value(section, key, value):
74
-	var config = ConfigFile.new()
75
-	var file = DialogicUtil.get_path('SETTINGS_FILE')
76
-	var err = config.load(file)
77
-	if err == OK:
78
-		config.set_value(section, key, value)
79
-		config.save(file)
74
+	DialogicResources.set_settings_value(section, key, value)

+ 54
- 47
addons/dialogic/Editor/ThemeEditor/ThemeEditor.gd View File

@@ -62,16 +62,16 @@ func _ready():
62 62
 
63 63
 func load_theme(filename):
64 64
 	current_theme = filename
65
-	var theme = DialogicUtil.get_theme(filename) 
65
+	var theme = DialogicResources.get_theme_config(filename) 
66 66
 	# Settings
67 67
 	n['theme_action_key'].text = theme.get_value('settings', 'action_key', 'ui_accept')
68 68
 	
69 69
 	# Background
70
-	n['theme_background_image'].text = DialogicUtil.get_filename_from_path(theme.get_value('background', 'image', 'res://addons/dialogic/Images/background/background-2.png'))
70
+	n['theme_background_image'].text = DialogicResources.get_filename_from_path(theme.get_value('background', 'image', 'res://addons/dialogic/Images/background/background-2.png'))
71 71
 	n['background_texture_button_visible'].pressed = theme.get_value('background', 'use_image', true)
72 72
 	n['theme_background_color'].color = Color(theme.get_value('background', 'color', '#ff000000'))
73 73
 	n['theme_background_color_visible'].pressed = theme.get_value('background', 'use_color', false)
74
-	n['theme_next_image'].text = DialogicUtil.get_filename_from_path(theme.get_value('next_indicator', 'image', 'res://addons/dialogic/Images/next-indicator.png'))
74
+	n['theme_next_image'].text = DialogicResources.get_filename_from_path(theme.get_value('next_indicator', 'image', 'res://addons/dialogic/Images/next-indicator.png'))
75 75
 	
76 76
 	var size_value = theme.get_value('box', 'size', Vector2(910, 167))
77 77
 	n['size_w'].value = size_value.x
@@ -84,7 +84,7 @@ func load_theme(filename):
84 84
 	n['button_text_color'].color = Color(theme.get_value('buttons', 'text_color', "#ffffffff"))
85 85
 	n['button_background'].color = Color(theme.get_value('buttons', 'background_color', "#ff000000"))
86 86
 	n['button_background_visible'].pressed = theme.get_value('buttons', 'use_background_color', false)
87
-	n['button_image'].text = DialogicUtil.get_filename_from_path(theme.get_value('buttons', 'image', 'res://addons/dialogic/Images/background/background-2.png'))
87
+	n['button_image'].text = DialogicResources.get_filename_from_path(theme.get_value('buttons', 'image', 'res://addons/dialogic/Images/background/background-2.png'))
88 88
 	n['button_image_visible'].pressed = theme.get_value('buttons', 'use_image', true)
89 89
 	n['button_offset_x'].value = theme.get_value('buttons', 'padding', Vector2(5,5)).x
90 90
 	n['button_offset_y'].value = theme.get_value('buttons', 'padding', Vector2(5,5)).y
@@ -92,11 +92,11 @@ func load_theme(filename):
92 92
 	
93 93
 	# Definitions
94 94
 	n['glossary_color'].color = Color(theme.get_value('definitions', 'color', "#ffffffff"))
95
-	n['glossary_font'].text = DialogicUtil.get_filename_from_path(theme.get_value('definitions', 'font', "res://addons/dialogic/Fonts/GlossaryFont.tres"))
95
+	n['glossary_font'].text = DialogicResources.get_filename_from_path(theme.get_value('definitions', 'font', "res://addons/dialogic/Fonts/GlossaryFont.tres"))
96 96
 	
97 97
 	# Text
98 98
 	n['theme_text_speed'].value = theme.get_value('text','speed', 2)
99
-	n['theme_font'].text = DialogicUtil.get_filename_from_path(theme.get_value('text', 'font', 'res://addons/dialogic/Fonts/DefaultFont.tres'))
99
+	n['theme_font'].text = DialogicResources.get_filename_from_path(theme.get_value('text', 'font', 'res://addons/dialogic/Fonts/DefaultFont.tres'))
100 100
 	n['theme_text_color'].color = Color(theme.get_value('text', 'color', '#ffffffff'))
101 101
 	n['theme_text_shadow'].pressed = theme.get_value('text', 'shadow', false)
102 102
 	n['theme_text_shadow_color'].color = Color(theme.get_value('text', 'shadow_color', '#9e000000'))
@@ -112,11 +112,14 @@ func load_theme(filename):
112 112
 			n['alignment'].select(1)
113 113
 		'Right':
114 114
 			n['alignment'].select(2)
115
-
115
+	
116
+	# Preview text
117
+	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]')
118
+	
116 119
 
117 120
 func new_theme():
118 121
 	var theme_file = 'theme-' + str(OS.get_unix_time()) + '.cfg'
119
-	DialogicUtil.create_empty_file(DialogicUtil.get_path('THEME_DIR', theme_file))
122
+	DialogicResources.add_theme(theme_file)
120 123
 	master_tree.add_theme({'file': theme_file, 'name': theme_file})
121 124
 	load_theme(theme_file)
122 125
 	# Check if it is the only theme to set as default
@@ -131,8 +134,8 @@ func _on_BackgroundTextureButton_pressed():
131 134
 
132 135
 
133 136
 func _on_background_selected(path, target):
134
-	DialogicUtil.set_theme_value(current_theme, 'background','image', path)
135
-	n['theme_background_image'].text = DialogicUtil.get_filename_from_path(path)
137
+	DialogicResources.set_theme_value(current_theme, 'background','image', path)
138
+	n['theme_background_image'].text = DialogicResources.get_filename_from_path(path)
136 139
 
137 140
 
138 141
 func _on_NextIndicatorButton_pressed():
@@ -141,24 +144,24 @@ func _on_NextIndicatorButton_pressed():
141 144
 
142 145
 
143 146
 func _on_indicator_selected(path, target):
144
-	DialogicUtil.set_theme_value(current_theme, 'next_indicator','image', path)
145
-	n['theme_next_image'].text = DialogicUtil.get_filename_from_path(path)
147
+	DialogicResources.set_theme_value(current_theme, 'next_indicator','image', path)
148
+	n['theme_next_image'].text = DialogicResources.get_filename_from_path(path)
146 149
 
147 150
 
148 151
 func _on_ColorPickerButton_color_changed(color):
149
-	DialogicUtil.set_theme_value(current_theme, 'text','color', '#' + color.to_html())
152
+	DialogicResources.set_theme_value(current_theme, 'text','color', '#' + color.to_html())
150 153
 
151 154
 
152 155
 func _on_ColorPickerButtonShadow_color_changed(color):
153
-	DialogicUtil.set_theme_value(current_theme, 'text','shadow_color', '#' + color.to_html())
156
+	DialogicResources.set_theme_value(current_theme, 'text','shadow_color', '#' + color.to_html())
154 157
 
155 158
 
156 159
 func _on_CheckBoxShadow_toggled(button_pressed):
157
-	DialogicUtil.set_theme_value(current_theme, 'text','shadow', button_pressed)
160
+	DialogicResources.set_theme_value(current_theme, 'text','shadow', button_pressed)
158 161
 
159 162
 
160 163
 func _on_ShadowOffset_value_changed(_value):
161
-	DialogicUtil.set_theme_value(current_theme, 'text','shadow_offset', Vector2(n['theme_shadow_offset_x'].value,n['theme_shadow_offset_y'].value))
164
+	DialogicResources.set_theme_value(current_theme, 'text','shadow_offset', Vector2(n['theme_shadow_offset_x'].value,n['theme_shadow_offset_y'].value))
162 165
 
163 166
 
164 167
 func _on_PreviewButton_pressed():
@@ -172,24 +175,24 @@ func _on_PreviewButton_pressed():
172 175
 	preview_dialog.dialog_script['events'] = [{
173 176
 		"character":"",
174 177
 		"portrait":"",
175
-		"text": n['text_preview'].text
178
+		"text": preview_dialog.parse_definitions(n['text_preview'].text)
176 179
 	}]
177 180
 	# Settings
178
-	preview_dialog.settings = DialogicUtil.get_settings()
181
+	preview_dialog.settings = DialogicResources.get_settings_config()
179 182
 	# Alignment
180
-	preview_dialog.dialog_script = preview_dialog.parse_definitions(preview_dialog.dialog_script)
181
-	preview_dialog.dialog_script = preview_dialog.parse_text_lines(preview_dialog.dialog_script)
182 183
 	n['preview_panel'].add_child(preview_dialog)
183 184
 	# Not sure why but I need to reload the theme again for it to work properly
184
-	preview_dialog.current_theme = preview_dialog.load_theme(current_theme)
185 185
 	preview_dialog.load_dialog()
186
+	preview_dialog.current_theme = preview_dialog.load_theme(current_theme)
186 187
 	
187 188
 	# maintaining the preview panel big enough for the dialog box
189
+
188 190
 	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)
189
-	n['preview_panel'].rect_size = Vector2(0,0)
191
+	n['preview_panel'].rect_size.y = 0
192
+
190 193
 
191 194
 func _on_ActionOptionButton_item_selected(index):
192
-	DialogicUtil.set_theme_value(current_theme, 'settings','action_key', n['theme_action_key'].text)
195
+	DialogicResources.set_theme_value(current_theme, 'settings','action_key', n['theme_action_key'].text)
193 196
 
194 197
 
195 198
 func _on_ActionOptionButton_pressed():
@@ -206,12 +209,12 @@ func _on_FontButton_pressed():
206 209
 
207 210
 
208 211
 func _on_Font_selected(path, target):
209
-	DialogicUtil.set_theme_value(current_theme, 'text','font', path)
210
-	n['theme_font'].text = DialogicUtil.get_filename_from_path(path)
212
+	DialogicResources.set_theme_value(current_theme, 'text','font', path)
213
+	n['theme_font'].text = DialogicResources.get_filename_from_path(path)
211 214
 
212 215
 
213 216
 func _on_textSpeed_value_changed(value):
214
-	DialogicUtil.set_theme_value(current_theme, 'text','speed', value)
217
+	DialogicResources.set_theme_value(current_theme, 'text','speed', value)
215 218
 
216 219
 
217 220
 func _on_TextMargin_value_changed(value):
@@ -219,27 +222,27 @@ func _on_TextMargin_value_changed(value):
219 222
 		n['theme_text_margin'].value,
220 223
 		n['theme_text_margin_h'].value
221 224
 	)
222
-	DialogicUtil.set_theme_value(current_theme, 'text', 'margin', final_vector)
225
+	DialogicResources.set_theme_value(current_theme, 'text', 'margin', final_vector)
223 226
 
224 227
 
225 228
 func _on_BackgroundColor_CheckBox_toggled(button_pressed):
226
-	DialogicUtil.set_theme_value(current_theme, 'background', 'use_color', button_pressed)
229
+	DialogicResources.set_theme_value(current_theme, 'background', 'use_color', button_pressed)
227 230
 
228 231
 
229 232
 func _on_BackgroundColor_ColorPickerButton_color_changed(color):
230
-	DialogicUtil.set_theme_value(current_theme, 'background', 'color', '#' + color.to_html())
233
+	DialogicResources.set_theme_value(current_theme, 'background', 'color', '#' + color.to_html())
231 234
 
232 235
 
233 236
 func _on_BackgroundTexture_CheckBox_toggled(button_pressed):
234
-	DialogicUtil.set_theme_value(current_theme, 'background', 'use_image', button_pressed)
237
+	DialogicResources.set_theme_value(current_theme, 'background', 'use_image', button_pressed)
235 238
 
236 239
 
237 240
 func _on_button_background_visible_toggled(button_pressed):
238
-	DialogicUtil.set_theme_value(current_theme, 'buttons', 'use_background_color', button_pressed)
241
+	DialogicResources.set_theme_value(current_theme, 'buttons', 'use_background_color', button_pressed)
239 242
 
240 243
 
241 244
 func _on_button_background_color_color_changed(color):
242
-	DialogicUtil.set_theme_value(current_theme, 'buttons', 'background_color', '#' + color.to_html())
245
+	DialogicResources.set_theme_value(current_theme, 'buttons', 'background_color', '#' + color.to_html())
243 246
 
244 247
 
245 248
 func _on_ButtonOffset_value_changed(value):
@@ -247,15 +250,15 @@ func _on_ButtonOffset_value_changed(value):
247 250
 		n['button_offset_x'].value,
248 251
 		n['button_offset_y'].value
249 252
 	)
250
-	DialogicUtil.set_theme_value(current_theme, 'buttons', 'padding', final_vector)
253
+	DialogicResources.set_theme_value(current_theme, 'buttons', 'padding', final_vector)
251 254
 
252 255
 
253 256
 func _on_VerticalSeparation_value_changed(value):
254
-	DialogicUtil.set_theme_value(current_theme, 'buttons', 'gap', n['button_separation'].value)
257
+	DialogicResources.set_theme_value(current_theme, 'buttons', 'gap', n['button_separation'].value)
255 258
 
256 259
 
257 260
 func _on_button_texture_toggled(button_pressed):
258
-	DialogicUtil.set_theme_value(current_theme, 'buttons', 'use_image', button_pressed)
261
+	DialogicResources.set_theme_value(current_theme, 'buttons', 'use_image', button_pressed)
259 262
 
260 263
 
261 264
 func _on_ButtonTextureButton_pressed():
@@ -264,20 +267,20 @@ func _on_ButtonTextureButton_pressed():
264 267
 
265 268
 
266 269
 func _on_button_texture_selected(path, target):
267
-	DialogicUtil.set_theme_value(current_theme, 'buttons', 'image', path)
268
-	n['button_image'].text = DialogicUtil.get_filename_from_path(path)
270
+	DialogicResources.set_theme_value(current_theme, 'buttons', 'image', path)
271
+	n['button_image'].text = DialogicResources.get_filename_from_path(path)
269 272
 
270 273
 
271 274
 func _on_ButtonTextColor_color_changed(color):
272
-	DialogicUtil.set_theme_value(current_theme, 'buttons', 'text_color', '#' + color.to_html())
275
+	DialogicResources.set_theme_value(current_theme, 'buttons', 'text_color', '#' + color.to_html())
273 276
 
274 277
 
275 278
 func _on_Custom_Button_Color_toggled(button_pressed):
276
-	DialogicUtil.set_theme_value(current_theme, 'buttons', 'text_color_enabled', button_pressed)
279
+	DialogicResources.set_theme_value(current_theme, 'buttons', 'text_color_enabled', button_pressed)
277 280
 
278 281
 
279 282
 func _on_GlossaryColorPicker_color_changed(color):
280
-	DialogicUtil.set_theme_value(current_theme, 'definitions', 'color', '#' + color.to_html())
283
+	DialogicResources.set_theme_value(current_theme, 'definitions', 'color', '#' + color.to_html())
281 284
 
282 285
 
283 286
 func _on_GlossaryFontButton_pressed():
@@ -285,8 +288,8 @@ func _on_GlossaryFontButton_pressed():
285 288
 	editor_reference.godot_dialog_connect(self, "_on_Glossary_Font_selected")
286 289
 
287 290
 func _on_Glossary_Font_selected(path, target):
288
-	DialogicUtil.set_theme_value(current_theme, 'definitions', 'font', path)
289
-	n['glossary_font'].text = DialogicUtil.get_filename_from_path(path)
291
+	DialogicResources.set_theme_value(current_theme, 'definitions', 'font', path)
292
+	n['glossary_font'].text = DialogicResources.get_filename_from_path(path)
290 293
 
291 294
 
292 295
 func _on_visibility_changed():
@@ -302,18 +305,22 @@ func _on_visibility_changed():
302 305
 
303 306
 func _on_BoxSize_value_changed(value):
304 307
 	var size_value = Vector2(n['size_w'].value, n['size_h'].value)
305
-	DialogicUtil.set_theme_value(current_theme, 'box', 'size', size_value)
308
+	DialogicResources.set_theme_value(current_theme, 'box', 'size', size_value)
306 309
 
307 310
 
308 311
 func _on_BottomGap_value_changed(value):
309
-	DialogicUtil.set_theme_value(current_theme, 'box', 'bottom_gap', value)
312
+	DialogicResources.set_theme_value(current_theme, 'box', 'bottom_gap', value)
310 313
 
311 314
 
312 315
 func _on_Alignment_item_selected(index):
313 316
 	if index == 0:
314
-		DialogicUtil.set_theme_value(current_theme, 'text', 'alignment', 'Left')
317
+		DialogicResources.set_theme_value(current_theme, 'text', 'alignment', 'Left')
315 318
 	elif index == 1:
316
-		DialogicUtil.set_theme_value(current_theme, 'text', 'alignment', 'Center')
319
+		DialogicResources.set_theme_value(current_theme, 'text', 'alignment', 'Center')
317 320
 	elif index == 2:
318
-		DialogicUtil.set_theme_value(current_theme, 'text', 'alignment', 'Right')
321
+		DialogicResources.set_theme_value(current_theme, 'text', 'alignment', 'Right')
322
+
323
+
319 324
 
325
+func _on_Preview_text_changed():
326
+	DialogicUtil.set_theme_value(current_theme, 'text', 'preview', n['text_preview'].text)

+ 9
- 8
addons/dialogic/Editor/ThemeEditor/ThemeEditor.tscn View File

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

+ 13
- 30
addons/dialogic/Editor/TimelineEditor/TimelineEditor.gd View File

@@ -2,9 +2,8 @@ tool
2 2
 extends HSplitContainer
3 3
 
4 4
 var editor_reference
5
-var timeline_name
6
-var working_timeline_file: String = ''
7
-
5
+var timeline_name: String = ''
6
+var timeline_file: String = ''
8 7
 var current_timeline: Dictionary = {}
9 8
 
10 9
 onready var master_tree = get_node('../MasterTree')
@@ -100,14 +99,14 @@ func indent_events() -> void:
100 99
 		starter = false
101 100
 
102 101
 
103
-func load_timeline(path):
102
+func load_timeline(filename: String):
104 103
 	print('---------------------------')
105
-	print('Loading: ',path)
104
+	print('Loading: ', filename)
106 105
 	clear_timeline()
107 106
 	var start_time = OS.get_system_time_msecs()
108
-	working_timeline_file = path
107
+	timeline_file = filename
109 108
 	
110
-	var data = DialogicUtil.load_json(path)
109
+	var data = DialogicResources.get_timeline_json(filename)
111 110
 	if data['metadata'].has('name'):
112 111
 		timeline_name = data['metadata']['name']
113 112
 	else:
@@ -177,9 +176,8 @@ func move_block(block, direction):
177 176
 	return false
178 177
 
179 178
 
180
-# Create timeline
181 179
 func create_timeline():
182
-	var timeline_file = 'timeline-' + str(OS.get_unix_time()) + '.json'
180
+	timeline_file = 'timeline-' + str(OS.get_unix_time()) + '.json'
183 181
 	var timeline = {
184 182
 		"events": [],
185 183
 		"metadata":{
@@ -187,15 +185,7 @@ func create_timeline():
187 185
 			"file": timeline_file
188 186
 		}
189 187
 	}
190
-	var directory = Directory.new()
191
-	if not directory.dir_exists(DialogicUtil.get_path('WORKING_DIR')):
192
-		directory.make_dir(DialogicUtil.get_path('WORKING_DIR'))
193
-	if not directory.dir_exists(DialogicUtil.get_path('TIMELINE_DIR')):
194
-		directory.make_dir(DialogicUtil.get_path('TIMELINE_DIR'))
195
-	var file = File.new()
196
-	file.open(DialogicUtil.get_path('TIMELINE_DIR') + '/' + timeline_file, File.WRITE)
197
-	file.store_line(to_json(timeline))
198
-	file.close()
188
+	DialogicResources.set_timeline(timeline)
199 189
 	return timeline
200 190
 
201 191
 
@@ -206,15 +196,11 @@ func new_timeline():
206 196
 
207 197
 # Saving
208 198
 func generate_save_data():
209
-	var t_name = timeline_name
210
-	var f_name = DialogicUtil.get_filename_from_path(working_timeline_file)
211
-	if t_name == '':
212
-		timeline_name = f_name
213 199
 	var info_to_save = {
214 200
 		'metadata': {
215 201
 			'dialogic-version': editor_reference.version_string,
216
-			'name': t_name,
217
-			'file': f_name
202
+			'name': timeline_name,
203
+			'file': timeline_file
218 204
 		},
219 205
 		'events': []
220 206
 	}
@@ -225,13 +211,10 @@ func generate_save_data():
225 211
 
226 212
 
227 213
 func save_timeline() -> void:
228
-	if working_timeline_file != '':
214
+	if timeline_file != '':
229 215
 		var info_to_save = generate_save_data()
230
-		var file = File.new()
231
-		file.open(working_timeline_file, File.WRITE)
232
-		file.store_line(to_json(info_to_save))
233
-		file.close()
234
-		#print('[+] Saving: ' , working_timeline_file)
216
+		DialogicResources.set_timeline(info_to_save)
217
+		#print('[+] Saving: ' , timeline_file)
235 218
 
236 219
 
237 220
 # Utilities

+ 7
- 3
addons/dialogic/Nodes/Portrait.gd View File

@@ -6,7 +6,12 @@ var character_data = {
6 6
 	'color': Color(0.973511, 1, 0.152344),
7 7
 	'file': ''
8 8
 }
9
-var positions = {'left': Vector2(-400,0), 'right': Vector2(+400,0), 'center': Vector2(0,0), 'center_right': Vector2(200,0), 'center_left': Vector2(-200,0)}
9
+var positions = {
10
+	'left': Vector2(-400,-130),
11
+	'right': Vector2(+400,-130),
12
+	'center': Vector2(0,-130),
13
+	'center_right': Vector2(200,-130),
14
+	'center_left': Vector2(-200,-130)}
10 15
 var direction = 'left'
11 16
 var debug = false
12 17
 
@@ -50,8 +55,7 @@ func set_portrait(expression: String) -> void:
50 55
 	var portraits = character_data['portraits']
51 56
 	for p in portraits:
52 57
 		if p['name'] == expression:
53
-			var directory = Directory.new();
54
-			if directory.file_exists(p['path']):
58
+			if ResourceLoader.exists(p['path']):
55 59
 				$TextureRect.texture = load(p['path'])
56 60
 			else:
57 61
 				$TextureRect.texture = Texture.new()

+ 72
- 41
addons/dialogic/Nodes/dialog_node.gd View File

@@ -17,6 +17,7 @@ var settings
17 17
 var current_theme
18 18
 
19 19
 export(String, "TimelineDropdown") var timeline: String
20
+export(bool) var reset_saves = true
20 21
 export(bool) var debug_mode = true
21 22
 signal event_start(type, event)
22 23
 signal event_end(type)
@@ -34,10 +35,12 @@ func _ready():
34 35
 	# Loading the config files
35 36
 	load_config_files()
36 37
 	
37
-
38
+	# Make sure saves are ready
39
+	DialogicResources.init_definitions_saves(reset_saves)
40
+	
38 41
 	# Checking if the dialog should read the code from a external file
39 42
 	if timeline != '':
40
-		dialog_script = set_current_dialog('/' + timeline + '.json')
43
+		dialog_script = set_current_dialog(timeline + '.json')
41 44
 
42 45
 	# Connecting resize signal
43 46
 	get_viewport().connect("size_changed", self, "resize_main")
@@ -58,7 +61,7 @@ func _ready():
58 61
 
59 62
 func load_config_files():
60 63
 	definitions = DialogicUtil.get_definition_list()
61
-	settings = DialogicUtil.get_settings()
64
+	settings = DialogicResources.get_settings_config()
62 65
 	var theme_file = 'res://addons/dialogic/Editor/ThemeEditor/default-theme.cfg'
63 66
 	if settings.has_section('theme'):
64 67
 		theme_file = settings.get_value('theme', 'default')
@@ -78,7 +81,7 @@ func resize_main():
78 81
 
79 82
 
80 83
 func set_current_dialog(dialog_path):
81
-	var dialog_script = DialogicUtil.load_json(DialogicUtil.get_path('TIMELINE_DIR', dialog_path))
84
+	var dialog_script = DialogicResources.get_timeline_json(dialog_path)
82 85
 	# All this parse events should be happening in the same loop ideally
83 86
 	# But until performance is not an issue I will probably stay lazy
84 87
 	# And keep adding different functions for each parsing operation.
@@ -89,7 +92,6 @@ func set_current_dialog(dialog_path):
89 92
 		dialog_script = parse_characters(dialog_script)
90 93
 	
91 94
 	dialog_script = parse_text_lines(dialog_script)
92
-	dialog_script = parse_definitions(dialog_script)
93 95
 	dialog_script = parse_branches(dialog_script)
94 96
 	return dialog_script
95 97
 
@@ -213,34 +215,40 @@ func parse_branches(dialog_script: Dictionary) -> Dictionary:
213 215
 	return dialog_script
214 216
 
215 217
 
216
-func parse_definitions(dialog_script):
218
+func parse_definitions(text: String):
217 219
 	var words = []
218 220
 	var definition_list = DialogicUtil.get_definition_list()
219 221
 	if Engine.is_editor_hint():
220 222
 		# Loading variables again to avoid issues in the preview dialog
221 223
 		load_config_files()
222
-		
223 224
 
224
-	for d in definitions:
225
-		if d['type'] == 1:
226
-			words.append(d)
225
+	var final_text: String;
226
+	final_text = _insert_variable_definitions(text)
227
+	final_text = _insert_glossary_definitions(final_text)
228
+	return final_text
227 229
 
230
+func _insert_variable_definitions(text: String):
231
+	var final_text := text;
232
+	for d in definitions:
233
+		if d['type'] == 0:
234
+			var name : String = d['name'];
235
+			var value = DialogicUtil.get_var(name)
236
+			final_text = final_text.replace('[' + name + ']', value)
237
+	return final_text;
238
+	
239
+	
240
+func _insert_glossary_definitions(text: String):
241
+	var color = self.current_theme.get_value('definitions', 'color', '#ffbebebe')
242
+	var final_text := text;
228 243
 	# I should use regex here, but this is way easier :)
229
-	if words.size() > 0:
230
-		var color = current_theme.get_value('definitions', 'color', '#ffbebebe')
231
-		var index = 0
232
-		for t in dialog_script['events']:
233
-			if t.has('text') and t.has('character') and t.has('portrait'):
234
-				for d in definitions:
235
-					if d['type'] == 1:
236
-						dialog_script['events'][index]['text'] = t['text'].replace(d['name'],
237
-							'[url=' + d['section'] + ']' +
238
-								'[color=' + color + ']' + d['name'] + '[/color]' +
239
-							'[/url]'
240
-						)
241
-			index += 1
242
-
243
-	return dialog_script
244
+	for d in definitions:
245
+		if d['type'] == 1:
246
+			final_text = final_text.replace(d['name'],
247
+				'[url=' + d['section'] + ']' +
248
+				'[color=' + color + ']' + d['name'] + '[/color]' +
249
+				'[/url]'
250
+			)
251
+	return final_text;
244 252
 
245 253
 
246 254
 func _process(_delta):
@@ -292,7 +300,7 @@ func update_name(character, color='#FFFFFF'):
292 300
 
293 301
 func update_text(text):
294 302
 	# Updating the text and starting the animation from 0
295
-	$TextBubble/RichTextLabel.bbcode_text = text
303
+	$TextBubble/RichTextLabel.bbcode_text = self.parse_definitions(text)
296 304
 	$TextBubble/RichTextLabel.percent_visible = 0
297 305
 
298 306
 	# The call to this function needs to be deferred.
@@ -338,6 +346,9 @@ func get_character(character_id):
338 346
 func event_handler(event: Dictionary):
339 347
 	# Handling an event and updating the available nodes accordingly.
340 348
 	reset_dialog_extras()
349
+	# Updating the settings and definitions in case that they were modified by a timelien
350
+	load_config_files()
351
+	
341 352
 	dprint('[D] Current Event: ', event)
342 353
 	match event:
343 354
 		{'text', 'character', 'portrait'}:
@@ -440,7 +451,7 @@ func event_handler(event: Dictionary):
440 451
 			wait_seconds(event['wait_seconds'])
441 452
 			waiting = true
442 453
 		{'change_timeline'}:
443
-			dialog_script = set_current_dialog('/' + event['change_timeline'])
454
+			dialog_script = set_current_dialog(event['change_timeline'])
444 455
 			dialog_index = -1
445 456
 			go_to_next_event()
446 457
 		{'condition', 'definition', 'value', 'question_id', ..}:
@@ -449,25 +460,21 @@ func event_handler(event: Dictionary):
449 460
 			var current_question = questions[event['question_id']]
450 461
 			for d in definitions:
451 462
 				if d['section'] == event['definition']:
452
-					#if d['config'].has_section('runtime_value'):
453
-					#	def_value = d['config'].get_value(event['definition'], 'runtime_value', null)
454
-					#else:
455
-						def_value = d['config'].get_value(event['definition'], 'value', null)
456
-			if def_value != null:
457
-				if def_value != event['value']:
458
-					current_question['answered'] = true # This will abort the current conditional branch
459
-
460
-			if current_question['answered']:
461
-				# If the option is for an answered question, skip to the end of it.
463
+					def_value = DialogicUtil.get_var(d['name'])
464
+			
465
+			var condition_met = self._compare_definitions(def_value, event['value'], event['condition']);
466
+			
467
+			current_question['answered'] = !condition_met
468
+			if !condition_met:
469
+				# condition not met, skipping branch
462 470
 				dialog_index = current_question['end_id']
463 471
 				load_dialog(true)
464 472
 			else:
465
-				# It should never get here, but if it does, go to the next place.
473
+				# condition met, entering branch
466 474
 				go_to_next_event()
467 475
 		{'set_value', 'definition'}:
468 476
 			emit_signal("event_start", "set_value", event)
469
-			#DialogicUtil.set_definition(event['definition'], 'runtime_value', event['set_value'])
470
-			DialogicUtil.set_definition(event['definition'], 'value', event['set_value'])
477
+			DialogicResources.set_saved_definition_variable_value(event['definition'], event['set_value'])
471 478
 			go_to_next_event()
472 479
 		_:
473 480
 			visible = false
@@ -617,7 +624,7 @@ func deferred_resize(current_size, result):
617 624
 		resize_main()
618 625
 
619 626
 func load_theme(filename):
620
-	var theme = DialogicUtil.get_theme(filename)
627
+	var theme = DialogicResources.get_theme_config(filename)
621 628
 
622 629
 	# Box size
623 630
 	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='' ):
726 733
 	# I ask myself the same question :')
727 734
 	if debug_mode:
728 735
 		print(str(string) + str(arg1) + str(arg2) + str(arg3) + str(arg4))
736
+
737
+
738
+func _compare_definitions(def_value: String, event_value: String, condition: String):
739
+	var condition_met = false;
740
+	if def_value != null and event_value != null:
741
+		var converted_def_value = def_value
742
+		var converted_event_value = event_value
743
+		if def_value.is_valid_float() and event_value.is_valid_float():
744
+			converted_def_value = float(def_value)
745
+			converted_event_value = float(event_value)
746
+		match condition:
747
+			"==":
748
+				condition_met = converted_def_value == converted_event_value
749
+			"!=":
750
+				condition_met = converted_def_value != converted_event_value
751
+			">":
752
+				condition_met = converted_def_value > converted_event_value
753
+			">=":
754
+				condition_met = converted_def_value >= converted_event_value
755
+			"<":
756
+				condition_met = converted_def_value < converted_event_value
757
+			"<=":
758
+				condition_met = converted_def_value <= converted_event_value
759
+	return condition_met

addons/dialogic/Other/dialogic_class.gd → addons/dialogic/Other/DialogicClass.gd View File

@@ -2,8 +2,8 @@ extends Node
2 2
 class_name Dialogic
3 3
 
4 4
 
5
-static func start(timeline: String, debug_mode=true):
6
-	var dialog = load("res://addons/dialogic/Dialog.tscn")
5
+static func start(timeline: String, dialog_scene_path: String="res://addons/dialogic/Dialog.tscn", debug_mode: bool=false):
6
+	var dialog = load(dialog_scene_path)
7 7
 	var d = dialog.instance()
8 8
 	d.debug_mode = debug_mode
9 9
 	for t in DialogicUtil.get_timeline_list():
@@ -17,12 +17,13 @@ static func start(timeline: String, debug_mode=true):
17 17
 	return d
18 18
 
19 19
 
20
+static func reset_saves():
21
+	DialogicResources.init_definitions_saves(true)
22
+
23
+
20 24
 static func get_var(variable: String):
21 25
 	return DialogicUtil.get_var(variable)
22 26
 
23 27
 
24 28
 static func set_var(variable: String, value):
25
-	for d in DialogicUtil.get_definition_list():
26
-		if d['name'] == variable:
27
-			DialogicUtil.set_definition(d['section'], 'value', value)
28
-	return value
29
+	DialogicUtil.set_var(variable, value)

+ 349
- 0
addons/dialogic/Other/DialogicResources.gd View File

@@ -0,0 +1,349 @@
1
+tool
2
+class_name DialogicResources
3
+
4
+
5
+const RESOURCES_DIR: String = "res://dialogic" # Readonly, used for static data
6
+const WORKING_DIR: String = "user://dialogic" # Readwrite, used for saves
7
+
8
+
9
+static func load_json(path: String) -> Dictionary:
10
+	# An easy function to load json files and handle common errors.
11
+	var file:File = File.new()
12
+	if file.open(path, File.READ) != OK:
13
+		file.close()
14
+		return {'error':'file read error'}
15
+	var data_text: String = file.get_as_text()
16
+	file.close()
17
+	var data_parse:JSONParseResult = JSON.parse(data_text)
18
+	if data_parse.error != OK:
19
+		return {'error':'data parse error'}
20
+
21
+	var final_data = data_parse.result
22
+	if typeof(final_data) == TYPE_DICTIONARY:
23
+		return final_data
24
+	
25
+	# If everything else fails
26
+	return {'error':'data parse error'}
27
+
28
+
29
+static func init_dialogic_files() -> void:
30
+	# This functions makes sure that the needed files and folders
31
+	# exists when the plugin is loaded. If they don't, we create 
32
+	# them.
33
+	# WARNING: only call while in the editor
34
+	var directory = Directory.new()
35
+	var paths = get_working_directories()
36
+	var files = get_config_files_paths()
37
+	# Create directories
38
+	for dir in paths:
39
+		if not directory.dir_exists(paths[dir]):
40
+			directory.make_dir_recursive(paths[dir])
41
+	# Create empty files
42
+	for f in files:
43
+		if not directory.file_exists(files[f]):
44
+			create_empty_file(files[f])
45
+
46
+
47
+static func get_working_directories() -> Dictionary:
48
+	return {
49
+		'RESOURCES_DIR': RESOURCES_DIR,
50
+		'WORKING_DIR': WORKING_DIR,
51
+		'TIMELINE_DIR': RESOURCES_DIR + "/timelines",
52
+		'THEME_DIR': RESOURCES_DIR + "/themes",
53
+		'CHAR_DIR': RESOURCES_DIR + "/characters",
54
+	}
55
+
56
+
57
+static func get_config_files_paths() -> Dictionary:
58
+	return {
59
+		'SETTINGS_FILE': RESOURCES_DIR + "/settings.cfg",
60
+		'DEFAULT_DEFINITIONS_FILE': RESOURCES_DIR + "/definitions.cfg",
61
+		'SAVED_DEFINITIONS_FILE': WORKING_DIR + "/definitions.cfg",
62
+	}
63
+
64
+
65
+static func init_definitions_saves(overwrite: bool=true):
66
+	var directory := Directory.new()
67
+	var source := File.new()
68
+	var sink := File.new()
69
+	var paths := get_config_files_paths()
70
+	
71
+	var err := directory.make_dir_recursive(get_working_directories()['WORKING_DIR'])
72
+	
73
+	if err == OK:
74
+		if not directory.file_exists(paths["SAVED_DEFINITIONS_FILE"]):
75
+			err = sink.open(paths["SAVED_DEFINITIONS_FILE"], File.WRITE)
76
+			print('Saved definitions not present, creating file: ' + str(err))
77
+			if err == OK:
78
+				sink.store_string('')
79
+				sink.close()
80
+			else:
81
+				print('Error opening saved definitions file: ' + str(err))
82
+		
83
+		err = sink.open(paths["SAVED_DEFINITIONS_FILE"], File.READ_WRITE)
84
+		if err == OK:
85
+			if overwrite or sink.get_len() == 0:
86
+				err = source.open(paths["DEFAULT_DEFINITIONS_FILE"], File.READ)
87
+				if err == OK:
88
+					sink.store_string(source.get_as_text())
89
+				else:
90
+					print('Error opening default definitions file: ' + str(err))
91
+			else:
92
+				print('Did not overwrite previous saved definitions')
93
+		else:
94
+			print('Error opening saved definitions file: ' + str(err))
95
+	else:
96
+		print('Error creating working directory: ' + str(err))
97
+	
98
+	source.close()
99
+	sink.close()
100
+
101
+
102
+static func get_path(name: String, extra: String ='') -> String:
103
+	var paths: Dictionary = get_working_directories()
104
+	if extra != '':
105
+		return paths[name] + '/' + extra
106
+	else:
107
+		return paths[name]
108
+
109
+
110
+static func get_filename_from_path(path: String, extension = false) -> String:
111
+	var file_name: String = path.split('/')[-1]
112
+	if extension == false:
113
+		file_name = file_name.split('.')[0]
114
+	return file_name
115
+
116
+
117
+static func listdir(path: String) -> Array:
118
+	# https://docs.godotengine.org/en/stable/classes/class_directory.html#description
119
+	var files: Array = []
120
+	var dir := Directory.new()
121
+	var err = dir.open(path)
122
+	if err == OK:
123
+		dir.list_dir_begin()
124
+		var file_name = dir.get_next()
125
+		while file_name != "":
126
+			if not dir.current_is_dir() and not file_name.begins_with("."):
127
+				files.append(file_name)
128
+			file_name = dir.get_next()
129
+		dir.list_dir_end()
130
+	else:
131
+		print("Error while accessing path " + path + " - Error: " + str(err))
132
+	return files
133
+
134
+
135
+static func create_empty_file(path):
136
+	var file = File.new()
137
+	file.open(path, File.WRITE)
138
+	file.store_string('')
139
+	file.close()
140
+
141
+
142
+# CONFIG UTIL
143
+
144
+
145
+static func get_config(id: String) -> ConfigFile:
146
+	var paths := get_config_files_paths()
147
+	var config := ConfigFile.new()
148
+	if id in paths.keys():
149
+		var err = config.load(paths[id])
150
+		if err != OK:
151
+			print("Error while opening config file " + paths[id] + ". Error: " + str(err))
152
+	return config
153
+
154
+
155
+# FILE UTIL
156
+
157
+
158
+static func remove_file(path: String):
159
+	var dir = Directory.new()
160
+	dir.remove(path)
161
+
162
+
163
+# JSON UTIL
164
+
165
+
166
+static func get_json(dir_id: String, path: String):
167
+	return load_json(get_path(dir_id, path))
168
+
169
+
170
+static func set_json(dir_id: String, path: String, data: Dictionary):
171
+	var directory = Directory.new()
172
+	var base_path := get_path(dir_id)
173
+	if not directory.dir_exists(base_path):
174
+		directory.make_dir_recursive(base_path)
175
+	var file = File.new()
176
+	file.open(get_path(dir_id, path), File.WRITE)
177
+	file.store_line(to_json(data))
178
+	file.close()
179
+
180
+
181
+# TIMELINE
182
+
183
+static func get_timeline_json(path: String):
184
+	return get_json('TIMELINE_DIR', path)
185
+
186
+
187
+static func set_timeline(timeline: Dictionary):
188
+	# WARNING: For use in the editor only
189
+	set_json('TIMELINE_DIR', timeline['metadata']['file'], timeline)
190
+
191
+
192
+static func delete_timeline(filename: String):
193
+	# WARNING: For use in the editor only
194
+	remove_file(get_path('TIMELINE_DIR', filename))
195
+
196
+
197
+# CHARACTER
198
+
199
+
200
+static func get_character_json(path: String):
201
+	return get_json('CHAR_DIR', path)
202
+
203
+
204
+static func set_character(character: Dictionary):
205
+	# WARNING: For use in the editor only
206
+	set_json('CHAR_DIR', character['id'], character)
207
+
208
+
209
+static func delete_character(filename: String):
210
+	# WARNING: For use in the editor only
211
+	remove_file(get_path('CHAR_DIR', filename))
212
+
213
+
214
+# THEME
215
+
216
+
217
+static func get_theme_config(filename: String):
218
+	var config = ConfigFile.new()
219
+	var path
220
+	if filename.begins_with('res://'):
221
+		path = filename
222
+	else:
223
+		path = get_path('THEME_DIR', filename)
224
+	var err = config.load(path)
225
+	if err == OK:
226
+		return config
227
+
228
+
229
+static func set_theme_value(filename, section, key, value):
230
+	# WARNING: For use in the editor only
231
+	print('=> theme update')
232
+	print(filename)
233
+	var config = get_theme_config(filename)
234
+	config.set_value(section, key, value)
235
+	config.save(get_path('THEME_DIR', filename))
236
+
237
+
238
+static func add_theme(filename: String):
239
+	create_empty_file(get_path('THEME_DIR', filename))
240
+
241
+
242
+# SETTINGS
243
+
244
+
245
+static func get_settings_config():
246
+	return get_config("SETTINGS_FILE")
247
+
248
+
249
+static func set_settings_value(section: String, key: String, value):
250
+	var config = get_settings_config()
251
+	config.set_value(section, key, value)
252
+	config.save(get_config_files_paths()['SETTINGS_FILE'])
253
+
254
+
255
+# DEFINITIONS UTIL
256
+# used by default and saved definitions
257
+
258
+static func get_definition_key(config_id: String, section: String, key: String, default):
259
+	var config = get_config(config_id)
260
+	if config.has_section(section):
261
+		return config.get_value(section, key, default)
262
+	else:
263
+		return default
264
+
265
+
266
+static func set_definition_variable(config_id: String, section: String, name: String,  value):
267
+	var config = get_config(config_id)
268
+	config.set_value(section, 'name', name)
269
+	config.set_value(section, 'type', 0)
270
+	config.set_value(section, 'value', str(value))
271
+	return config.save(get_config_files_paths()[config_id])
272
+
273
+
274
+static func set_definition_glossary(config_id: String, section: String, name: String,  extra_title: String,  extra_text: String,  extra_extra: String):
275
+	var config = get_config(config_id)
276
+	config.set_value(section, 'name', name)
277
+	config.set_value(section, 'type', 1)
278
+	config.set_value(section, 'extra_title', extra_title)
279
+	config.set_value(section, 'extra_text', extra_text)
280
+	config.set_value(section, 'extra_extra', extra_extra)
281
+	return config.save(get_config_files_paths()[config_id])
282
+
283
+
284
+static func add_definition_variable(config_id: String, section: String, name: String, type: int, value):
285
+	var config = get_config(config_id)
286
+	config.set_value(section, 'name', name)
287
+	config.set_value(section, 'type', type)
288
+	config.set_value(section, 'value', str(value))
289
+	return config.save(get_config_files_paths()[config_id])
290
+
291
+
292
+static func delete_definition(config_id: String, section: String):
293
+	var config = get_config(config_id)
294
+	config.erase_section(section)
295
+	return config.save(get_config_files_paths()[config_id])
296
+
297
+
298
+
299
+# DEFAULT DEFINITIONS
300
+# Can only be edited in the editor
301
+
302
+static func get_default_definitions_config():
303
+	return get_config('DEFAULT_DEFINITIONS_FILE')
304
+
305
+
306
+static func get_default_definition_key(section: String, key: String, default):
307
+	return get_definition_key('DEFAULT_DEFINITIONS_FILE', section, key, default)
308
+
309
+
310
+static func set_default_definition_variable(section: String, name: String,  value):
311
+	# WARNING: For use in the editor only
312
+	return set_definition_variable('DEFAULT_DEFINITIONS_FILE', section, name, value)
313
+
314
+
315
+static func set_default_definition_glossary(section: String, name: String,  extra_title: String,  extra_text: String,  extra_extra: String):
316
+	# WARNING: For use in the editor only
317
+	return set_definition_glossary('DEFAULT_DEFINITIONS_FILE', section, name, extra_title, extra_text, extra_extra)
318
+
319
+
320
+static func add_default_definition_variable(section: String, name: String, type: int, value):
321
+	# WARNING: For use in the editor only
322
+	return add_definition_variable('DEFAULT_DEFINITIONS_FILE', section, name, type, value)
323
+
324
+
325
+static func delete_default_definition(section: String):
326
+	# WARNING: For use in the editor only
327
+	return delete_definition('DEFAULT_DEFINITIONS_FILE', section)
328
+
329
+
330
+# SAVED DEFINITIONS
331
+# Can be edited at runtime, and will persist across runs
332
+
333
+
334
+static func get_saved_definitions_config():
335
+	return get_config("SAVED_DEFINITIONS_FILE")
336
+
337
+
338
+static func set_saved_definition_variable(section: String, name: String,  value):
339
+	return set_definition_variable('SAVED_DEFINITIONS_FILE', section, name, value)
340
+
341
+
342
+static func set_saved_definition_variable_value(section: String, value):
343
+	var config = get_saved_definitions_config()
344
+	return set_definition_variable('SAVED_DEFINITIONS_FILE', section, config.get_value(section, 'name', section), value)
345
+
346
+
347
+static func set_saved_definition_glossary(section: String, name: String,  extra_title: String,  extra_text: String,  extra_extra: String):
348
+	return set_definition_glossary('SAVED_DEFINITIONS_FILE', section, name, extra_title, extra_text, extra_extra)
349
+

+ 41
- 173
addons/dialogic/Other/DialogicUtil.gd View File

@@ -1,105 +1,12 @@
1 1
 tool
2 2
 class_name DialogicUtil
3 3
 
4
-# This class was initially for doing small things... but after a while
5
-# it ended up being one of the corner stones of the plugin. 
6
-# It should probably be split into several other classes and leave 
7
-# just the basic stuff here, but I'll keep working like this until I have
8
-# some extra time to burn. 
9
-# A good point to start would be to add a "resource manager" instead of
10
-# handling most of that here. But who knows? (:
11
-
12
-static func init_dialogic_files() -> void:
13
-	# This functions makes sure that the needed files and folders
14
-	# exists when the plugin is loaded. If they don't, we create 
15
-	# them.
16
-	var directory = Directory.new()
17
-	var paths = get_working_directories()
18
-	for dir in paths:
19
-		if 'settings.cfg' in paths[dir]:
20
-			if directory.file_exists(paths['SETTINGS_FILE']) == false:
21
-				create_empty_file(paths['SETTINGS_FILE'])
22
-		elif 'definitions.cfg' in paths[dir]:
23
-			if directory.file_exists(paths['DEFINITIONS_FILE']) == false:
24
-				create_empty_file(paths['DEFINITIONS_FILE'])
25
-		else:
26
-			if directory.dir_exists(paths[dir]) == false:
27
-				directory.make_dir(paths[dir])
28
-
29
-
30
-static func load_json(path: String) -> Dictionary:
31
-	# An easy function to load json files and handle common errors.
32
-	var file:File = File.new()
33
-	if file.open(path, File.READ) != OK:
34
-		file.close()
35
-		return {'error':'file read error'}
36
-	var data_text: String = file.get_as_text()
37
-	file.close()
38
-	var data_parse:JSONParseResult = JSON.parse(data_text)
39
-	if data_parse.error != OK:
40
-		return {'error':'data parse error'}
41
-
42
-	var final_data = data_parse.result
43
-	if typeof(final_data) == TYPE_DICTIONARY:
44
-		return final_data
45
-	
46
-	# If everything else fails
47
-	return {'error':'data parse error'}
48
-
49
-
50
-static func get_working_directories() -> Dictionary:
51
-	var WORKING_DIR: String = "res://dialogic"
52
-	var paths: Dictionary = {
53
-		'WORKING_DIR': WORKING_DIR,
54
-		'TIMELINE_DIR': WORKING_DIR + "/timelines",
55
-		'THEME_DIR': WORKING_DIR + "/themes",
56
-		'CHAR_DIR': WORKING_DIR + "/characters",
57
-		'DEFINITIONS_FILE': WORKING_DIR + "/definitions.cfg",
58
-		'SETTINGS_FILE': WORKING_DIR + "/settings.cfg",
59
-	}
60
-	return paths
61
-
62
-
63
-static func get_path(name: String, extra: String ='') -> String:
64
-	var paths: Dictionary = get_working_directories()
65
-	if extra != '':
66
-		return paths[name] + '/' + extra
67
-	else:
68
-		return paths[name]
69
-
70
-
71
-static func get_filename_from_path(path: String, extension = false) -> String:
72
-	var file_name: String = path.split('/')[-1]
73
-	if extension == false:
74
-		file_name = file_name.split('.')[0]
75
-	return file_name
76
-
77
-
78
-static func listdir(path: String) -> Array:
79
-	# https://godotengine.org/qa/5175/how-to-get-all-the-files-inside-a-folder
80
-	var files: Array = []
81
-	var dir: Directory = Directory.new()
82
-	dir.open(path)
83
-	dir.list_dir_begin()
84
-	while true:
85
-		var file = dir.get_next()
86
-		if file == "":
87
-			break
88
-		elif not file.begins_with("."):
89
-			files.append(file)
90
-	dir.list_dir_end()
91
-	return files
92
-
93 4
 
94 5
 static func get_character_list() -> Array:
95 6
 	var characters: Array = []
96
-	var directory = Directory.new();
97
-	if directory.dir_exists(get_path('CHAR_DIR')) == false:
98
-		return characters
99
-		
100
-	for file in listdir(get_path('CHAR_DIR')):
7
+	for file in DialogicResources.listdir(DialogicResources.get_path('CHAR_DIR')):
101 8
 		if '.json' in file:
102
-			var data: Dictionary     = load_json(get_path('CHAR_DIR', file))
9
+			var data: Dictionary     = DialogicResources.get_character_json(file)
103 10
 			var color: Color         = Color("#ffffff")
104 11
 			var c_name: String       = data['id']
105 12
 			var default_speaker      = false
@@ -134,9 +41,9 @@ static func get_character_list() -> Array:
134 41
 
135 42
 static func get_timeline_list() -> Array:
136 43
 	var timelines: Array = []
137
-	for file in listdir(get_path('TIMELINE_DIR')):
44
+	for file in DialogicResources.listdir(DialogicResources.get_path('TIMELINE_DIR')):
138 45
 		if '.json' in file:
139
-			var data = load_json(get_path('TIMELINE_DIR', file))
46
+			var data = DialogicResources.get_timeline_json(file)
140 47
 			if data.has('error') == false:
141 48
 				var metadata = data['metadata']
142 49
 				var color = Color("#ffffff")
@@ -147,43 +54,57 @@ static func get_timeline_list() -> Array:
147 54
 	return timelines
148 55
 
149 56
 
150
-static func get_definition_list() -> Array:
151
-	var definitions: Array = []
152
-	var config = ConfigFile.new()
153
-	var err = config.load(get_path('DEFINITIONS_FILE'))
154
-	if err == OK:
155
-		for section in config.get_sections():
156
-			definitions.append({
157
-				'section': section,
158
-				'name': config.get_value(section, 'name', section),
159
-				'config': config,
160
-				'type': config.get_value(section, 'type', 0),
57
+static func get_theme_list() -> Array:
58
+	var themes: Array = []
59
+	for file in DialogicResources.listdir(DialogicResources.get_path('THEME_DIR')):
60
+		if '.cfg' in file:
61
+			var config = ConfigFile.new()
62
+			var err = DialogicResources.get_theme_config(file)
63
+			themes.append({
64
+				'file': file,
65
+				'name': config.get_value('settings','name', file),
66
+				'config': config
161 67
 			})
68
+	return themes
69
+
70
+
71
+static func get_default_definition_list() -> Array:
72
+	var definitions: Array = []
73
+	var config = DialogicResources.get_default_definitions_config()
74
+	for section in config.get_sections():
75
+		definitions.append({
76
+			'section': section,
77
+			'name': config.get_value(section, 'name', section),
78
+			'config': config,
79
+			'type': config.get_value(section, 'type', 0),
80
+		})
162 81
 	return definitions
163 82
 
164 83
 
165
-static func set_definition(current_section: String, key,  value) -> void:
166
-	var config = ConfigFile.new()
167
-	var err = config.load(get_path('DEFINITIONS_FILE'))
168
-	if err == OK:
169
-		config.set_value(current_section, key, str(value))
170
-		config.save(get_path('DEFINITIONS_FILE'))
84
+static func get_definition_list() -> Array:
85
+	var definitions: Array = []
86
+	var config = DialogicResources.get_saved_definitions_config()
87
+	for section in config.get_sections():
88
+		definitions.append({
89
+			'section': section,
90
+			'name': config.get_value(section, 'name', section),
91
+			'config': config,
92
+			'type': config.get_value(section, 'type', 0),
93
+		})
94
+	return definitions
171 95
 
172 96
 
173
-static func get_var(variable: String):
174
-	print(get_definition_list())
97
+static func get_var(variable: String) -> String:
175 98
 	for d in get_definition_list():
176 99
 		if d['name'] == variable:
177 100
 			return d['config'].get_value(d['section'], 'value')
178 101
 	return ''
179 102
 
180 103
 
181
-static func set_var(variable: String):
182
-	print(get_definition_list())
104
+static func set_var(variable: String, value) -> void:
183 105
 	for d in get_definition_list():
184 106
 		if d['name'] == variable:
185
-			return d['config'].get_value(d['section'], 'value')
186
-	return ''
107
+			DialogicResources.set_saved_definition_variable(d['section'], d['name'], value)
187 108
 
188 109
 
189 110
 static func generate_random_id() -> String:
@@ -199,56 +120,3 @@ static func compare_dicts(dict_1: Dictionary, dict_2: Dictionary) -> bool:
199 120
 	return false
200 121
 
201 122
 
202
-static func get_theme_list() -> Array:
203
-	var themes: Array = []
204
-	for file in listdir(get_path('THEME_DIR')):
205
-		if '.cfg' in file:
206
-			var config = ConfigFile.new()
207
-			var err = config.load(get_path('THEME_DIR', file))
208
-			if err == OK: # If not, something went wrong with the file loading
209
-				themes.append({
210
-					'file': file,
211
-					'name': config.get_value('settings','name', file),
212
-					'config': config
213
-				})
214
-			else:
215
-				print('Error loading ',file , ' - Error: ', err)
216
-	return themes
217
-
218
-
219
-static func get_theme(filename):
220
-	var config = ConfigFile.new()
221
-	var path
222
-	if 'res://' in filename:
223
-		path = filename
224
-	else:
225
-		path = get_path('THEME_DIR', filename)
226
-	var err = config.load(path)
227
-	if err == OK:
228
-		return config
229
-
230
-
231
-static func set_theme_value(filename, section, key, value):
232
-	var config = ConfigFile.new()
233
-	var file = get_path('THEME_DIR', filename)
234
-	var err = config.load(file)
235
-	if err == OK:
236
-		config.set_value(section, key, value)
237
-		config.save(file)
238
-
239
-
240
-static func create_empty_file(path):
241
-	var file = File.new()
242
-	file.open(path, File.WRITE)
243
-	file.store_string('')
244
-	file.close()
245
-
246
-
247
-static func get_settings():
248
-	var directory = Directory.new()
249
-	var config = ConfigFile.new()
250
-	if directory.file_exists(get_path('SETTINGS_FILE')):
251
-		var err = config.load(get_path('SETTINGS_FILE'))
252
-		if err == OK:
253
-			return config
254
-	return config

+ 3
- 2
addons/dialogic/dialogic.gd View File

@@ -15,9 +15,10 @@ func _enter_tree() -> void:
15 15
 func _ready():
16 16
 	if Engine.editor_hint:
17 17
 		# Make sure the core files exist 
18
-		DialogicUtil.init_dialogic_files()
18
+		DialogicResources.init_dialogic_files()
19 19
 		# Force Godot to show the dialogic folder
20 20
 		get_editor_interface().get_resource_filesystem().scan()
21
+	
21 22
 
22 23
 
23 24
 func _exit_tree() -> void:
@@ -44,7 +45,7 @@ func get_plugin_icon():
44 45
 
45 46
 func _add_custom_editor_view():
46 47
 	_editor_view = preload("res://addons/dialogic/Editor/EditorView.tscn").instance()
47
-	_editor_view.plugin_reference = self
48
+	#_editor_view.plugin_reference = self
48 49
 
49 50
 
50 51
 func _remove_custom_editor_view():

BIN
characters/df-2.png View File


characters/test/nice.png.import → characters/df-2.png.import View File

@@ -2,15 +2,15 @@
2 2
 
3 3
 importer="texture"
4 4
 type="StreamTexture"
5
-path="res://.import/nice.png-45252d21bfd68632293e809427fcb2ee.stex"
5
+path="res://.import/df-2.png-1f29f4d1e6a1f1242da97614da8b7f6c.stex"
6 6
 metadata={
7 7
 "vram_texture": false
8 8
 }
9 9
 
10 10
 [deps]
11 11
 
12
-source_file="res://characters/test/nice.png"
13
-dest_files=[ "res://.import/nice.png-45252d21bfd68632293e809427fcb2ee.stex" ]
12
+source_file="res://characters/df-2.png"
13
+dest_files=[ "res://.import/df-2.png-1f29f4d1e6a1f1242da97614da8b7f6c.stex" ]
14 14
 
15 15
 [params]
16 16
 

BIN
characters/test/happy.png View File


+ 0
- 34
characters/test/happy.png.import View File

@@ -1,34 +0,0 @@
1
-[remap]
2
-
3
-importer="texture"
4
-type="StreamTexture"
5
-path="res://.import/happy.png-34b31afa58bc0c96ccc038435502ee02.stex"
6
-metadata={
7
-"vram_texture": false
8
-}
9
-
10
-[deps]
11
-
12
-source_file="res://characters/test/happy.png"
13
-dest_files=[ "res://.import/happy.png-34b31afa58bc0c96ccc038435502ee02.stex" ]
14
-
15
-[params]
16
-
17
-compress/mode=0
18
-compress/lossy_quality=0.7
19
-compress/hdr_mode=0
20
-compress/bptc_ldr=0
21
-compress/normal_map=0
22
-flags/repeat=0
23
-flags/filter=true
24
-flags/mipmaps=false
25
-flags/anisotropic=false
26
-flags/srgb=2
27
-process/fix_alpha_border=true
28
-process/premult_alpha=false
29
-process/HDR_as_SRGB=false
30
-process/invert_color=false
31
-stream=false
32
-size_limit=0
33
-detect_3d=true
34
-svg/scale=1.0

BIN
characters/test/nice.png View File


BIN
characters/test/shock.png View File


+ 0
- 34
characters/test/shock.png.import View File

@@ -1,34 +0,0 @@
1
-[remap]
2
-
3
-importer="texture"
4
-type="StreamTexture"
5
-path="res://.import/shock.png-a8c62a852aea125c35d6b3bd7987a7fc.stex"
6
-metadata={
7
-"vram_texture": false
8
-}
9
-
10
-[deps]
11
-
12
-source_file="res://characters/test/shock.png"
13
-dest_files=[ "res://.import/shock.png-a8c62a852aea125c35d6b3bd7987a7fc.stex" ]
14
-
15
-[params]
16
-
17
-compress/mode=0
18
-compress/lossy_quality=0.7
19
-compress/hdr_mode=0
20
-compress/bptc_ldr=0
21
-compress/normal_map=0
22
-flags/repeat=0
23
-flags/filter=true
24
-flags/mipmaps=false
25
-flags/anisotropic=false
26
-flags/srgb=2
27
-process/fix_alpha_border=true
28
-process/premult_alpha=false
29
-process/HDR_as_SRGB=false
30
-process/invert_color=false
31
-stream=false
32
-size_limit=0
33
-detect_3d=true
34
-svg/scale=1.0

+ 0
- 1
dialogic/characters/character-1615795338.json View File

@@ -1 +0,0 @@
1
-{"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}

+ 1
- 0
dialogic/characters/character-1615932195.json View File

@@ -0,0 +1 @@
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}

+ 6
- 3
dialogic/definitions.cfg View File

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

+ 1
- 1
dialogic/settings.cfg View File

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

+ 0
- 14
dialogic/themes/theme-1615795528.cfg View File

@@ -1,14 +0,0 @@
1
-[box]
2
-
3
-size=Vector2( 910, 167 )
4
-
5
-[text]
6
-
7
-margin=Vector2( 20, 10 )
8
-shadow=false
9
-speed=4.0
10
-
11
-[background]
12
-
13
-use_color=false
14
-use_image=true

+ 7
- 0
dialogic/themes/theme-1615930210.cfg View File

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

+ 0
- 1
dialogic/timelines/timeline-1615795397.json View File

@@ -1 +0,0 @@
1
-{"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"}}

+ 1
- 0
dialogic/timelines/timeline-1615930166.json View File

@@ -0,0 +1 @@
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
- 0
export_presets.cfg View File

@@ -0,0 +1,48 @@
1
+[preset.0]
2
+
3
+name="Linux/X11"
4
+platform="Linux/X11"
5
+runnable=true
6
+custom_features=""
7
+export_filter="all_resources"
8
+include_filter="*.json"
9
+exclude_filter=""
10
+export_path="build/linux/Pir-serious-game-ethics.x86_64"
11
+patch_list=PoolStringArray(  )
12
+script_export_mode=1
13
+script_encryption_key=""
14
+
15
+[preset.0.options]
16
+
17
+texture_format/bptc=false
18
+texture_format/s3tc=true
19
+texture_format/etc=false
20
+texture_format/etc2=false
21
+texture_format/no_bptc_fallbacks=true
22
+binary_format/64_bits=true
23
+binary_format/embed_pck=true
24
+custom_template/release=""
25
+custom_template/debug=""
26
+
27
+[preset.1]
28
+
29
+name="HTML5"
30
+platform="HTML5"
31
+runnable=true
32
+custom_features=""
33
+export_filter="all_resources"
34
+include_filter="*.json"
35
+exclude_filter=""
36
+export_path="build/html/Pir-serious-game-ethics.html"
37
+patch_list=PoolStringArray(  )
38
+script_export_mode=1
39
+script_encryption_key=""
40
+
41
+[preset.1.options]
42
+
43
+vram_texture_compression/for_desktop=true
44
+vram_texture_compression/for_mobile=false
45
+html/custom_html_shell=""
46
+html/head_include=""
47
+custom_template/release=""
48
+custom_template/debug=""

+ 0
- 16
git_api.gdnlib View File

@@ -1,16 +0,0 @@
1
-[general]
2
-
3
-singleton=true
4
-load_once=true
5
-symbol_prefix="godot_"
6
-reloadable=false
7
-
8
-[entry]
9
-
10
-Windows.64="res://bin/win64/release/libgitapi.dll"
11
-X11.64="res://bin/x11/release/libgitapi.so"
12
-
13
-[dependencies]
14
-
15
-Windows.64=[  ]
16
-X11.64=[  ]

+ 0
- 9
git_api.gdns View File

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

+ 0
- 1
json_example.json View File

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

+ 10
- 46
project.godot View File

@@ -9,61 +9,25 @@
9 9
 config_version=4
10 10
 
11 11
 _global_script_classes=[ {
12
-"base": "VBoxContainer",
13
-"class": "Choice",
14
-"language": "GDScript",
15
-"path": "res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/Choice/Choice.gd"
16
-}, {
17
-"base": "VBoxContainer",
18
-"class": "ChoicesList",
19
-"language": "GDScript",
20
-"path": "res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/ChoicesList.gd"
21
-}, {
22
-"base": "VBoxContainer",
23
-"class": "Condition",
24
-"language": "GDScript",
25
-"path": "res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/Condition/Condition.gd"
26
-}, {
27
-"base": "VBoxContainer",
28
-"class": "ConditionsList",
29
-"language": "GDScript",
30
-"path": "res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/ConditionsList.gd"
31
-}, {
32 12
 "base": "Node",
33 13
 "class": "Dialogic",
34 14
 "language": "GDScript",
35
-"path": "res://addons/dialogic/Other/dialogic_class.gd"
15
+"path": "res://addons/dialogic/Other/DialogicClass.gd"
36 16
 }, {
37 17
 "base": "Reference",
38
-"class": "DialogicUtil",
39
-"language": "GDScript",
40
-"path": "res://addons/dialogic/Other/DialogicUtil.gd"
41
-}, {
42
-"base": "",
43
-"class": "GitAPI",
44
-"language": "NativeScript",
45
-"path": "res://git_api.gdns"
46
-}, {
47
-"base": "VBoxContainer",
48
-"class": "Infobox",
18
+"class": "DialogicResources",
49 19
 "language": "GDScript",
50
-"path": "res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Infobox/Infobox.gd"
20
+"path": "res://addons/dialogic/Other/DialogicResources.gd"
51 21
 }, {
52
-"base": "GraphNode",
53
-"class": "LineNode",
22
+"base": "Reference",
23
+"class": "DialogicUtil",
54 24
 "language": "GDScript",
55
-"path": "res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/line_node.gd"
25
+"path": "res://addons/dialogic/Other/DialogicUtil.gd"
56 26
 } ]
57 27
 _global_script_class_icons={
58
-"Choice": "",
59
-"ChoicesList": "",
60
-"Condition": "",
61
-"ConditionsList": "",
62 28
 "Dialogic": "",
63
-"DialogicUtil": "",
64
-"GitAPI": "",
65
-"Infobox": "",
66
-"LineNode": ""
29
+"DialogicResources": "",
30
+"DialogicUtil": ""
67 31
 }
68 32
 
69 33
 [application]
@@ -74,11 +38,11 @@ config/icon="res://icon.png"
74 38
 
75 39
 [editor_plugins]
76 40
 
77
-enabled=PoolStringArray( "EXP-System-Dialog", "Todo_Manager", "dialogic" )
41
+enabled=PoolStringArray( "Todo_Manager", "dialogic" )
78 42
 
79 43
 [gdnative]
80 44
 
81
-singletons=[ "res://git_api.gdnlib" ]
45
+singletons=[  ]
82 46
 
83 47
 [rendering]
84 48
 

Loading…
Cancel
Save