Allow full control over json from node
这个提交包含在:
父节点
04dac568d0
当前提交
0ce0bc8986
共有 16 个文件被更改,包括 921 次插入 和 148 次删除
|
@ -0,0 +1,64 @@
|
|||
tool
|
||||
extends VBoxContainer
|
||||
|
||||
class_name Choice
|
||||
|
||||
signal choice_changed(index, new_json_structure)
|
||||
signal choice_removed(index)
|
||||
|
||||
onready var _ChoiceTitleLineEdit: LineEdit = self.get_node("HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer/ChoiceTitleLineEdit")
|
||||
onready var _ChoiceLabel: Label = self.get_node("HBoxContainer/MarginContainer/VBoxContainer/ChoiceLabel")
|
||||
onready var _Infobox: Infobox = self.get_node("HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/Infobox")
|
||||
onready var _ConditionsList: ConditionsList = self.get_node("HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/MarginContainer/ConditionsList")
|
||||
|
||||
var _id : int = 0;
|
||||
|
||||
var _json_structure := {
|
||||
"title": "",
|
||||
"conditions": []
|
||||
}
|
||||
|
||||
#Callback Methods
|
||||
|
||||
func _on_ChoiceTitleLineEdit_text_changed(new_text):
|
||||
_json_structure.title = new_text
|
||||
_emit_changed_signal()
|
||||
|
||||
|
||||
func _on_ChoiceRemoveButton_pressed():
|
||||
emit_signal("choice_removed", _id)
|
||||
|
||||
|
||||
func _on_ConditionsList_conditions_changed(new_json_structure):
|
||||
_json_structure.conditions = new_json_structure
|
||||
_emit_changed_signal()
|
||||
|
||||
|
||||
func _on_Infobox_infobox_removed():
|
||||
_json_structure.erase("infobox")
|
||||
_emit_changed_signal()
|
||||
|
||||
|
||||
func _on_Infobox_infobox_changed(new_json_structure):
|
||||
_json_structure.infobox = new_json_structure
|
||||
_emit_changed_signal()
|
||||
|
||||
|
||||
#Public Methods
|
||||
|
||||
func set_structure(new_json_structure):
|
||||
_json_structure = new_json_structure
|
||||
_ChoiceTitleLineEdit.set_text(_json_structure.title)
|
||||
if ("infobox" in _json_structure):
|
||||
_Infobox.set_structure(_json_structure.infobox)
|
||||
_ConditionsList.set_structure(_json_structure.conditions)
|
||||
|
||||
|
||||
func set_id(new_id):
|
||||
self._id = new_id;
|
||||
_ChoiceLabel.set_text("Choice #" + str(new_id + 1))
|
||||
|
||||
#Private Methods
|
||||
|
||||
func _emit_changed_signal():
|
||||
emit_signal("choice_changed", _id, _json_structure)
|
|
@ -0,0 +1,107 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/Choice/Choice.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/ConditionsList.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Infobox/Infobox.tscn" type="PackedScene" id=3]
|
||||
|
||||
[node name="Choice" type="VBoxContainer"]
|
||||
margin_right = 272.0
|
||||
margin_bottom = 156.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
margin_right = 272.0
|
||||
margin_bottom = 230.0
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="HBoxContainer"]
|
||||
margin_right = 272.0
|
||||
margin_bottom = 230.0
|
||||
size_flags_horizontal = 3
|
||||
custom_constants/margin_right = 5
|
||||
custom_constants/margin_top = 5
|
||||
custom_constants/margin_left = 5
|
||||
custom_constants/margin_bottom = 5
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/MarginContainer"]
|
||||
margin_left = 5.0
|
||||
margin_top = 5.0
|
||||
margin_right = 267.0
|
||||
margin_bottom = 225.0
|
||||
size_flags_horizontal = 3
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ChoiceLabel" type="Label" parent="HBoxContainer/MarginContainer/VBoxContainer"]
|
||||
margin_right = 262.0
|
||||
margin_bottom = 14.0
|
||||
text = "Choice #1"
|
||||
align = 1
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/MarginContainer/VBoxContainer"]
|
||||
margin_top = 18.0
|
||||
margin_right = 262.0
|
||||
margin_bottom = 220.0
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer"]
|
||||
margin_right = 262.0
|
||||
margin_bottom = 202.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2"]
|
||||
margin_right = 238.0
|
||||
margin_bottom = 202.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
|
||||
margin_right = 238.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="ChoiceTitleLabel" type="Label" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer"]
|
||||
margin_top = 5.0
|
||||
margin_right = 32.0
|
||||
margin_bottom = 19.0
|
||||
text = "Title:"
|
||||
|
||||
[node name="ChoiceTitleLineEdit" type="LineEdit" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 36.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Infobox" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer" instance=ExtResource( 3 )]
|
||||
margin_bottom = 164.0
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
|
||||
margin_top = 168.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 202.0
|
||||
custom_constants/margin_right = 5
|
||||
custom_constants/margin_top = 5
|
||||
custom_constants/margin_left = 5
|
||||
custom_constants/margin_bottom = 5
|
||||
|
||||
[node name="ConditionsList" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/MarginContainer" instance=ExtResource( 2 )]
|
||||
margin_bottom = 29.0
|
||||
|
||||
[node name="ChoiceRemoveButton" type="Button" parent="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2"]
|
||||
margin_left = 242.0
|
||||
margin_right = 262.0
|
||||
margin_bottom = 202.0
|
||||
text = "X"
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="."]
|
||||
margin_top = 234.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 238.0
|
||||
[connection signal="text_changed" from="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer/ChoiceTitleLineEdit" to="." method="_on_ChoiceTitleLineEdit_text_changed"]
|
||||
[connection signal="infobox_changed" from="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/Infobox" to="." method="_on_Infobox_infobox_changed"]
|
||||
[connection signal="infobox_removed" from="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/Infobox" to="." method="_on_Infobox_infobox_removed"]
|
||||
[connection signal="conditions_changed" from="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/VBoxContainer/MarginContainer/ConditionsList" to="." method="_on_ConditionsList_conditions_changed"]
|
||||
[connection signal="pressed" from="HBoxContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer2/ChoiceRemoveButton" to="." method="_on_ChoiceRemoveButton_pressed"]
|
|
@ -0,0 +1,66 @@
|
|||
tool
|
||||
extends VBoxContainer
|
||||
|
||||
class_name ChoicesList
|
||||
|
||||
signal choices_changed(new_json_structure)
|
||||
|
||||
var _choice_scene = preload("res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/Choice/Choice.tscn")
|
||||
|
||||
onready var _VBoxContainer: VBoxContainer = self.get_node("VBoxContainer")
|
||||
|
||||
var _json_structure: Array = []
|
||||
var _nodes: Array = []
|
||||
|
||||
#Callback Methods
|
||||
|
||||
func _on_choice_changed(index, new_structure):
|
||||
_json_structure[index] = new_structure
|
||||
_emit_changed_signal()
|
||||
|
||||
func _on_choice_removed(index):
|
||||
_json_structure.remove(index)
|
||||
_remove_choice_node(index)
|
||||
_emit_changed_signal()
|
||||
|
||||
func _on_ChoiceAddButton_pressed():
|
||||
add_choice()
|
||||
|
||||
|
||||
#Public Methods
|
||||
|
||||
func add_choice():
|
||||
_json_structure.append({
|
||||
"title": "",
|
||||
"conditions": []
|
||||
})
|
||||
_add_choice_node(_json_structure.size() - 1)
|
||||
_emit_changed_signal()
|
||||
|
||||
func set_structure(new_json_structure):
|
||||
_json_structure = new_json_structure
|
||||
for i in range(0, _json_structure.size()):
|
||||
var node: Choice = _add_choice_node(i)
|
||||
node.set_structure(_json_structure[i])
|
||||
|
||||
#Private Methods
|
||||
|
||||
func _emit_changed_signal():
|
||||
emit_signal("choices_changed", _json_structure)
|
||||
|
||||
func _add_choice_node(id: int):
|
||||
var node: Choice = _choice_scene.instance()
|
||||
_VBoxContainer.add_child(node)
|
||||
node.set_id(id)
|
||||
_nodes.append(node)
|
||||
node.connect("choice_changed", self, "_on_choice_changed")
|
||||
node.connect("choice_removed", self, "_on_choice_removed")
|
||||
return node
|
||||
|
||||
func _remove_choice_node(index):
|
||||
# Remove the node
|
||||
_nodes[index].queue_free()
|
||||
_nodes.remove(index)
|
||||
# Update remaining nodes indexes
|
||||
for i in range(0, _nodes.size()):
|
||||
_nodes[i].set_id(i)
|
|
@ -0,0 +1,23 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/ChoicesList.gd" type="Script" id=2]
|
||||
|
||||
[node name="ChoicesList" type="VBoxContainer"]
|
||||
margin_top = 242.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 422.0
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
margin_right = 272.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="ChoiceAddButton" type="Button" parent="."]
|
||||
margin_top = 4.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 24.0
|
||||
text = "Add choice"
|
||||
[connection signal="pressed" from="ChoiceAddButton" to="." method="_on_ChoiceAddButton_pressed"]
|
|
@ -0,0 +1,47 @@
|
|||
tool
|
||||
extends VBoxContainer
|
||||
|
||||
class_name Condition
|
||||
|
||||
signal condition_changed(index, new_json_structure)
|
||||
signal condition_removed(index)
|
||||
|
||||
onready var _ConditionLabel: Label = self.get_node("ContitionLabel")
|
||||
onready var _ContitionNameLineEdit: LineEdit = self.get_node("HBoxContainer2/ContitionNameLineEdit")
|
||||
onready var _ContitionValueSpinBox: SpinBox = self.get_node("HBoxContainer2/ContitionValueSpinBox")
|
||||
|
||||
var _id : int = 0;
|
||||
|
||||
var _json_structure = {
|
||||
"id": "",
|
||||
"value": 0
|
||||
}
|
||||
|
||||
#Callback Methods
|
||||
|
||||
func _on_ContitionNameLineEdit_text_changed(new_text):
|
||||
_json_structure.id = new_text
|
||||
emit_signal("condition_changed", _id, _json_structure)
|
||||
|
||||
|
||||
func _on_ContitionValueSpinBox_value_changed(value):
|
||||
_json_structure.value = value
|
||||
emit_signal("condition_changed", _id, _json_structure)
|
||||
|
||||
|
||||
func _on_ContitionRemoveButton_pressed():
|
||||
emit_signal("condition_removed", _id)
|
||||
|
||||
#Public Methods
|
||||
|
||||
func set_structure(new_json_structure):
|
||||
_json_structure = new_json_structure
|
||||
_ContitionNameLineEdit.text = _json_structure.id
|
||||
_ContitionValueSpinBox.value = _json_structure.value
|
||||
|
||||
|
||||
|
||||
func set_id(new_id):
|
||||
self._id = new_id;
|
||||
_ConditionLabel.set_text("Condition #" + str(new_id + 1))
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/Condition/Condition.gd" type="Script" id=1]
|
||||
|
||||
[node name="Condition" type="VBoxContainer"]
|
||||
margin_right = 228.0
|
||||
margin_bottom = 50.0
|
||||
size_flags_horizontal = 3
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="."]
|
||||
margin_right = 228.0
|
||||
margin_bottom = 4.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ContitionLabel" type="Label" parent="."]
|
||||
margin_top = 8.0
|
||||
margin_right = 228.0
|
||||
margin_bottom = 22.0
|
||||
text = "Condition #1"
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="."]
|
||||
margin_top = 26.0
|
||||
margin_right = 228.0
|
||||
margin_bottom = 50.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="ContitionNameLineEdit" type="LineEdit" parent="HBoxContainer2"]
|
||||
margin_right = 127.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="ContitionValueSpinBox" type="SpinBox" parent="HBoxContainer2"]
|
||||
margin_left = 131.0
|
||||
margin_right = 205.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="ContitionRemoveButton" type="Button" parent="HBoxContainer2"]
|
||||
margin_left = 209.0
|
||||
margin_right = 228.0
|
||||
margin_bottom = 24.0
|
||||
text = "x"
|
||||
[connection signal="text_changed" from="HBoxContainer2/ContitionNameLineEdit" to="." method="_on_ContitionNameLineEdit_text_changed"]
|
||||
[connection signal="value_changed" from="HBoxContainer2/ContitionValueSpinBox" to="." method="_on_ContitionValueSpinBox_value_changed"]
|
||||
[connection signal="pressed" from="HBoxContainer2/ContitionRemoveButton" to="." method="_on_ContitionRemoveButton_pressed"]
|
|
@ -0,0 +1,69 @@
|
|||
tool
|
||||
extends VBoxContainer
|
||||
|
||||
class_name ConditionsList
|
||||
|
||||
signal conditions_changed(new_json_structure)
|
||||
|
||||
var _condition_scene = preload("res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/Condition/Condition.tscn")
|
||||
|
||||
onready var _VBoxContainer = self.get_node("VBoxContainer")
|
||||
|
||||
var _json_structure = []
|
||||
var _nodes = []
|
||||
|
||||
#Callback Methods
|
||||
|
||||
func _on_condition_changed(index, new_structure):
|
||||
_json_structure[index] = new_structure
|
||||
_emit_changed_signal()
|
||||
|
||||
func _on_condition_removed(index):
|
||||
_json_structure.remove(index)
|
||||
_remove_choice_node(index)
|
||||
_emit_changed_signal()
|
||||
|
||||
func _on_ContitionAddButton_pressed():
|
||||
add_condition(
|
||||
{
|
||||
"id": "",
|
||||
"value": 0
|
||||
},
|
||||
_json_structure.size() - 1
|
||||
)
|
||||
|
||||
#Public Methods
|
||||
|
||||
func set_structure(new_json_structure):
|
||||
_json_structure = new_json_structure
|
||||
for i in range(0, _json_structure.size()):
|
||||
add_condition(_json_structure[0], i)
|
||||
|
||||
|
||||
func add_condition(structure: Dictionary, id: int):
|
||||
_json_structure.append(structure)
|
||||
_add_choice_node(structure, id)
|
||||
_emit_changed_signal()
|
||||
|
||||
#Private Methods
|
||||
|
||||
func _emit_changed_signal():
|
||||
emit_signal("conditions_changed", _json_structure)
|
||||
|
||||
func _add_choice_node(structure: Dictionary, id: int):
|
||||
var node: Condition = _condition_scene.instance()
|
||||
_VBoxContainer.add_child(node)
|
||||
node.set_id(id)
|
||||
node.set_structure(structure)
|
||||
_nodes.append(node)
|
||||
node.connect("condition_changed", self, "_on_condition_changed")
|
||||
node.connect("condition_removed", self, "_on_condition_removed")
|
||||
return node
|
||||
|
||||
func _remove_choice_node(index):
|
||||
# Remove the node
|
||||
_nodes[index].queue_free()
|
||||
_nodes.remove(index)
|
||||
# Update remaining nodes indexes
|
||||
for i in range(0, _nodes.size()):
|
||||
_nodes[i].set_id(i)
|
|
@ -0,0 +1,25 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/ConditionsList.gd" type="Script" id=1]
|
||||
|
||||
[node name="ConditionsList" type="VBoxContainer"]
|
||||
margin_left = 5.0
|
||||
margin_top = 5.0
|
||||
margin_right = 233.0
|
||||
margin_bottom = 79.0
|
||||
size_flags_horizontal = 3
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
margin_right = 228.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="ContitionAddButton" type="Button" parent="."]
|
||||
margin_top = 4.0
|
||||
margin_right = 228.0
|
||||
margin_bottom = 24.0
|
||||
text = "Add condition"
|
||||
[connection signal="pressed" from="ContitionAddButton" to="." method="_on_ContitionAddButton_pressed"]
|
|
@ -0,0 +1,68 @@
|
|||
tool
|
||||
extends VBoxContainer
|
||||
|
||||
class_name Infobox
|
||||
|
||||
signal infobox_changed(new_json_structure)
|
||||
signal infobox_removed()
|
||||
|
||||
onready var _TextEdit: TextEdit = self.get_node("HBoxContainer/VBoxContainer/TextEdit")
|
||||
onready var _CreateButton: Button = self.get_node("CreateButton")
|
||||
onready var _HBoxContainer: HBoxContainer = self.get_node("HBoxContainer")
|
||||
onready var _ConditionsList: ConditionsList = self.get_node("HBoxContainer/VBoxContainer/ConditionsList")
|
||||
|
||||
var _json_structure = {
|
||||
"text": "",
|
||||
"conditions": []
|
||||
}
|
||||
|
||||
#Virtual Methods
|
||||
|
||||
func _ready():
|
||||
_CreateButton.show()
|
||||
_HBoxContainer.hide()
|
||||
|
||||
|
||||
#Callback Methods
|
||||
|
||||
func _on_RemoveInfoboxButton_pressed():
|
||||
_disable_infobox()
|
||||
emit_signal("infobox_removed")
|
||||
|
||||
func _on_ConditionsList_conditions_changed(new_json_structure):
|
||||
_json_structure.conditions = new_json_structure
|
||||
_emit_changed_signal()
|
||||
|
||||
func _on_TextEdit_text_changed():
|
||||
_json_structure.text = self._TextEdit.get_text()
|
||||
_emit_changed_signal()
|
||||
|
||||
|
||||
func _on_CreateButton_pressed():
|
||||
_enable_infobox()
|
||||
_emit_changed_signal()
|
||||
|
||||
#Public Methods
|
||||
|
||||
func set_structure(new_json_structure):
|
||||
_json_structure = new_json_structure
|
||||
_TextEdit.set_text(_json_structure.text)
|
||||
_ConditionsList.set_structure(_json_structure.conditions)
|
||||
_enable_infobox()
|
||||
|
||||
#Private Methods
|
||||
|
||||
func _enable_infobox():
|
||||
_CreateButton.hide()
|
||||
_HBoxContainer.show()
|
||||
|
||||
|
||||
func _disable_infobox():
|
||||
_CreateButton.show()
|
||||
_HBoxContainer.hide()
|
||||
|
||||
|
||||
func _emit_changed_signal():
|
||||
emit_signal("infobox_changed", _json_structure)
|
||||
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Infobox/Infobox.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/ConditionsList.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="Infobox" type="VBoxContainer"]
|
||||
margin_top = 28.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 112.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
margin_right = 238.0
|
||||
margin_bottom = 112.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"]
|
||||
margin_right = 215.0
|
||||
margin_bottom = 112.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="HBoxContainer/VBoxContainer"]
|
||||
margin_right = 215.0
|
||||
margin_bottom = 4.0
|
||||
|
||||
[node name="Label" type="Label" parent="HBoxContainer/VBoxContainer"]
|
||||
margin_top = 8.0
|
||||
margin_right = 215.0
|
||||
margin_bottom = 22.0
|
||||
text = "Infobox"
|
||||
align = 1
|
||||
|
||||
[node name="TextEdit" type="TextEdit" parent="HBoxContainer/VBoxContainer"]
|
||||
margin_top = 26.0
|
||||
margin_right = 215.0
|
||||
margin_bottom = 76.0
|
||||
rect_min_size = Vector2( 0, 50 )
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="ConditionsList" parent="HBoxContainer/VBoxContainer" instance=ExtResource( 2 )]
|
||||
margin_left = 0.0
|
||||
margin_top = 80.0
|
||||
margin_right = 215.0
|
||||
margin_bottom = 104.0
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="HBoxContainer/VBoxContainer"]
|
||||
margin_top = 108.0
|
||||
margin_right = 215.0
|
||||
margin_bottom = 112.0
|
||||
|
||||
[node name="RemoveInfoboxButton" type="Button" parent="HBoxContainer"]
|
||||
margin_left = 219.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 112.0
|
||||
text = "x"
|
||||
|
||||
[node name="CreateButton" type="Button" parent="."]
|
||||
margin_top = 116.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 136.0
|
||||
text = "Create Infobox"
|
||||
[connection signal="text_changed" from="HBoxContainer/VBoxContainer/TextEdit" to="." method="_on_TextEdit_text_changed"]
|
||||
[connection signal="conditions_changed" from="HBoxContainer/VBoxContainer/ConditionsList" to="." method="_on_ConditionsList_conditions_changed"]
|
||||
[connection signal="pressed" from="HBoxContainer/RemoveInfoboxButton" to="." method="_on_RemoveInfoboxButton_pressed"]
|
||||
[connection signal="pressed" from="CreateButton" to="." method="_on_CreateButton_pressed"]
|
|
@ -1,11 +1,12 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/line_node.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/icon_distraction_free.svg" type="Texture" id=2]
|
||||
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/ChoicesList.tscn" type="PackedScene" id=3]
|
||||
|
||||
[node name="Line" type="GraphNode"]
|
||||
margin_right = 324.0
|
||||
margin_bottom = 181.0
|
||||
margin_bottom = 375.0
|
||||
rect_min_size = Vector2( 324, 137 )
|
||||
title = "Line"
|
||||
offset = Vector2( 40, 40 )
|
||||
|
@ -17,6 +18,12 @@ slot/0/left_color = Color( 1, 1, 1, 1 )
|
|||
slot/0/right_enabled = true
|
||||
slot/0/right_type = 0
|
||||
slot/0/right_color = Color( 1, 1, 1, 1 )
|
||||
slot/1/left_enabled = false
|
||||
slot/1/left_type = 0
|
||||
slot/1/left_color = Color( 1, 1, 1, 1 )
|
||||
slot/1/right_enabled = false
|
||||
slot/1/right_type = 0
|
||||
slot/1/right_color = Color( 1, 1, 1, 1 )
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
|
@ -24,9 +31,9 @@ __meta__ = {
|
|||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 24.0
|
||||
margin_top = 39.0
|
||||
margin_right = 308.0
|
||||
margin_bottom = 270.0
|
||||
margin_bottom = 329.0
|
||||
custom_constants/margin_right = 10
|
||||
custom_constants/margin_top = 10
|
||||
custom_constants/margin_left = 10
|
||||
|
@ -36,7 +43,7 @@ custom_constants/margin_bottom = 10
|
|||
margin_left = 10.0
|
||||
margin_top = 10.0
|
||||
margin_right = 282.0
|
||||
margin_bottom = 236.0
|
||||
margin_bottom = 280.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
__meta__ = {
|
||||
|
@ -45,54 +52,63 @@ __meta__ = {
|
|||
|
||||
[node name="HBoxContainer3" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||
margin_right = 272.0
|
||||
margin_bottom = 42.0
|
||||
margin_bottom = 70.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer3"]
|
||||
margin_right = 272.0
|
||||
margin_bottom = 42.0
|
||||
margin_bottom = 70.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SpeakerLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer"]
|
||||
margin_right = 272.0
|
||||
margin_bottom = 14.0
|
||||
text = "Speaker"
|
||||
align = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer"]
|
||||
margin_left = 89.0
|
||||
margin_top = 18.0
|
||||
margin_right = 272.0
|
||||
margin_right = 183.0
|
||||
margin_bottom = 42.0
|
||||
size_flags_horizontal = 4
|
||||
|
||||
[node name="SpeakerIdLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer"]
|
||||
margin_top = 5.0
|
||||
margin_right = 12.0
|
||||
margin_right = 16.0
|
||||
margin_bottom = 19.0
|
||||
text = "id"
|
||||
text = "id:"
|
||||
|
||||
[node name="SpeakerIdSpinBox" type="SpinBox" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 16.0
|
||||
margin_right = 90.0
|
||||
margin_left = 20.0
|
||||
margin_right = 94.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="SpeakerEmotionTextEdit" type="TextEdit" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 94.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 24.0
|
||||
rect_min_size = Vector2( 0, 20 )
|
||||
size_flags_horizontal = 3
|
||||
text = "emotion"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="MarginContainer/VBoxContainer"]
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer"]
|
||||
margin_top = 46.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 50.0
|
||||
margin_bottom = 70.0
|
||||
|
||||
[node name="SpeakerEmotionLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer2"]
|
||||
margin_top = 5.0
|
||||
margin_right = 57.0
|
||||
margin_bottom = 19.0
|
||||
text = "Emotion:"
|
||||
|
||||
[node name="SpeakerEmotionLineEdit" type="LineEdit" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer2"]
|
||||
margin_left = 61.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="MarginContainer/VBoxContainer"]
|
||||
margin_top = 74.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 78.0
|
||||
|
||||
[node name="HBoxContainer4" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||
margin_top = 54.0
|
||||
margin_top = 82.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 96.0
|
||||
margin_bottom = 124.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer4"]
|
||||
margin_right = 272.0
|
||||
|
@ -103,57 +119,54 @@ size_flags_horizontal = 3
|
|||
margin_right = 272.0
|
||||
margin_bottom = 14.0
|
||||
text = "Scene"
|
||||
align = 1
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer"]
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer"]
|
||||
margin_left = 89.0
|
||||
margin_top = 18.0
|
||||
margin_right = 272.0
|
||||
margin_right = 183.0
|
||||
margin_bottom = 42.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_horizontal = 4
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/CenterContainer"]
|
||||
margin_left = 91.0
|
||||
margin_right = 181.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="SceneIdLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/CenterContainer/HBoxContainer"]
|
||||
[node name="SceneIdLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/HBoxContainer"]
|
||||
margin_top = 5.0
|
||||
margin_right = 12.0
|
||||
margin_right = 16.0
|
||||
margin_bottom = 19.0
|
||||
text = "id"
|
||||
text = "id:"
|
||||
|
||||
[node name="SceneIdSpinBox" type="SpinBox" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/CenterContainer/HBoxContainer"]
|
||||
margin_left = 16.0
|
||||
margin_right = 90.0
|
||||
[node name="SceneIdSpinBox" type="SpinBox" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 20.0
|
||||
margin_right = 94.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="MarginContainer/VBoxContainer"]
|
||||
margin_top = 100.0
|
||||
margin_top = 128.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 104.0
|
||||
margin_bottom = 132.0
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||
margin_top = 108.0
|
||||
margin_top = 136.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 190.0
|
||||
margin_bottom = 234.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
|
||||
margin_right = 272.0
|
||||
margin_bottom = 82.0
|
||||
margin_bottom = 98.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="DialogLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
|
||||
margin_right = 272.0
|
||||
margin_bottom = 14.0
|
||||
text = "Dialog"
|
||||
text = "Message"
|
||||
align = 1
|
||||
|
||||
[node name="MessageTextEdit" type="TextEdit" parent="MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
|
||||
margin_top = 18.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 82.0
|
||||
rect_min_size = Vector2( 256, 64 )
|
||||
margin_bottom = 98.0
|
||||
rect_min_size = Vector2( 256, 80 )
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Message"
|
||||
smooth_scrolling = true
|
||||
|
||||
[node name="Editor_BTN" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
|
||||
|
@ -167,64 +180,22 @@ icon = ExtResource( 2 )
|
|||
expand_icon = true
|
||||
|
||||
[node name="HSeparator3" type="HSeparator" parent="MarginContainer/VBoxContainer"]
|
||||
margin_top = 194.0
|
||||
margin_top = 238.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 198.0
|
||||
margin_bottom = 242.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||
margin_top = 202.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 226.0
|
||||
alignment = 1
|
||||
|
||||
[node name="Save_BTN" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
visible = false
|
||||
margin_right = 125.0
|
||||
margin_bottom = 24.0
|
||||
hint_tooltip = "Save the current text as a template that can quickly loaded into new nodes."
|
||||
text = "Save Template As"
|
||||
|
||||
[node name="Load_BTN" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
visible = false
|
||||
margin_left = 64.0
|
||||
margin_right = 170.0
|
||||
margin_bottom = 24.0
|
||||
hint_tooltip = "Load a template from file."
|
||||
text = "Load Template"
|
||||
|
||||
[node name="VSeparator" type="VSeparator" parent="MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
visible = false
|
||||
margin_left = 119.0
|
||||
margin_right = 123.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="Link_LBL" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 77.0
|
||||
margin_top = 5.0
|
||||
margin_right = 116.0
|
||||
margin_bottom = 19.0
|
||||
text = "Slots: "
|
||||
|
||||
[node name="Link_SpinBox" type="SpinBox" parent="MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 120.0
|
||||
margin_right = 194.0
|
||||
margin_bottom = 24.0
|
||||
hint_tooltip = "Change the number of output slots on this node."
|
||||
min_value = 1.0
|
||||
value = 1.0
|
||||
rounded = true
|
||||
allow_greater = true
|
||||
[node name="ChoicesList" parent="MarginContainer/VBoxContainer" instance=ExtResource( 3 )]
|
||||
margin_top = 246.0
|
||||
margin_bottom = 270.0
|
||||
[connection signal="close_request" from="." to="." method="_on_Line_close_request"]
|
||||
[connection signal="offset_changed" from="." to="." method="_on_Line_offset_changed"]
|
||||
[connection signal="resize_request" from="." to="." method="_on_Line_resize_request"]
|
||||
[connection signal="value_changed" from="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer/SpeakerIdSpinBox" to="." method="_on_SpeakerIdSpinBox_value_changed"]
|
||||
[connection signal="text_changed" from="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer/SpeakerEmotionTextEdit" to="." method="_on_SpeakerEmotionTextEdit_text_changed"]
|
||||
[connection signal="value_changed" from="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/CenterContainer/HBoxContainer/SceneIdSpinBox" to="." method="_on_SceneIdSpinBox_value_changed"]
|
||||
[connection signal="text_changed" from="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer2/SpeakerEmotionLineEdit" to="." method="_on_SpeakerEmotionLineEdit_text_changed"]
|
||||
[connection signal="value_changed" from="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/HBoxContainer/SceneIdSpinBox" to="." method="_on_SceneIdSpinBox_value_changed"]
|
||||
[connection signal="text_changed" from="MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer/MessageTextEdit" to="." method="_on_MessageTextEdit_text_changed"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer2/Editor_BTN" to="." method="_on_Editor_BTN_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/Save_BTN" to="." method="_on_Save_BTN_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/Load_BTN" to="." method="_on_Load_BTN_pressed"]
|
||||
[connection signal="value_changed" from="MarginContainer/VBoxContainer/HBoxContainer/Link_SpinBox" to="." method="_on_Link_SpinBox_value_changed"]
|
||||
[connection signal="choices_changed" from="MarginContainer/VBoxContainer/ChoicesList" to="." method="_on_ChoicesList_choices_changed"]
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
tool
|
||||
extends GraphNode
|
||||
|
||||
class_name LineNode
|
||||
|
||||
signal changed_offset(nid, vec2)
|
||||
signal changed_size(this)
|
||||
signal changed_slots(this)
|
||||
|
@ -10,17 +12,16 @@ signal pressed_load(this)
|
|||
signal pressed_save(this)
|
||||
signal text_changed(nid, new_text)
|
||||
|
||||
onready var _Link_SpinBox = self.get_node("MarginContainer/VBoxContainer/HBoxContainer/Link_SpinBox")
|
||||
|
||||
onready var _MessageTextEdit = self.get_node("MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer/MessageTextEdit")
|
||||
onready var _SpeakerEmotionTextEdit = self.get_node("MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer/SpeakerEmotionTextEdit")
|
||||
onready var _SpeakerIdSpinBox = self.get_node("MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer/SpeakerIdSpinBox")
|
||||
onready var _SceneIdSpinBox = self.get_node("MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/CenterContainer/HBoxContainer/SceneIdSpinBox")
|
||||
onready var _SpeakerIdSpinBox: SpinBox = self.get_node("MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer/SpeakerIdSpinBox")
|
||||
onready var _SpeakerEmotionLineEdit: LineEdit = self.get_node("MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer2/SpeakerEmotionLineEdit")
|
||||
onready var _SceneIdSpinBox: SpinBox = self.get_node("MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/HBoxContainer/SceneIdSpinBox")
|
||||
onready var _MessageTextEdit : TextEdit= self.get_node("MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer/MessageTextEdit")
|
||||
onready var _ChoicesList: ChoicesList = self.get_node("MarginContainer/VBoxContainer/ChoicesList")
|
||||
|
||||
var _nid : int = 0
|
||||
var _slot_amount : int = 1
|
||||
|
||||
|
||||
var json_structure = {
|
||||
"speaker": {
|
||||
"id": 0,
|
||||
|
@ -31,23 +32,7 @@ var json_structure = {
|
|||
},
|
||||
"dialog": {
|
||||
"message": "",
|
||||
"choices_free": {
|
||||
"placeholder": "",
|
||||
"global_var_name": "",
|
||||
},
|
||||
"choices_multiple": [
|
||||
{
|
||||
"title": "",
|
||||
"arc": 0,
|
||||
"infobox": {
|
||||
"title": "",
|
||||
"text": "",
|
||||
"conditions": [],
|
||||
},
|
||||
"conditions": []
|
||||
}
|
||||
|
||||
]
|
||||
"choices_multiple": []
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,12 +61,6 @@ func _on_Line_resize_request(new_minsize):
|
|||
self.emit_signal("changed_size", self)
|
||||
|
||||
|
||||
func _on_Link_SpinBox_value_changed(value):
|
||||
self._slot_amount = int(self._Link_SpinBox.value)
|
||||
self._update_slots()
|
||||
self.emit_signal("changed_slots", self)
|
||||
|
||||
|
||||
func _on_Load_BTN_pressed():
|
||||
self.emit_signal("pressed_load", self)
|
||||
|
||||
|
@ -92,21 +71,34 @@ func _on_Save_BTN_pressed():
|
|||
|
||||
func _on_MessageTextEdit_text_changed():
|
||||
json_structure.dialog.message = self._MessageTextEdit.text
|
||||
emit_text()
|
||||
_emit_text()
|
||||
|
||||
func _on_SceneIdSpinBox_value_changed(value):
|
||||
json_structure.scene.id = value
|
||||
emit_text()
|
||||
_emit_text()
|
||||
|
||||
|
||||
func _on_SpeakerEmotionTextEdit_text_changed():
|
||||
json_structure.speaker.emotion = self._SpeakerEmotionTextEdit.text
|
||||
emit_text()
|
||||
func _on_SpeakerEmotionLineEdit_text_changed(new_text):
|
||||
json_structure.speaker.emotion = new_text
|
||||
_emit_text()
|
||||
|
||||
|
||||
func _on_SpeakerIdSpinBox_value_changed(value):
|
||||
json_structure.speaker.id = value
|
||||
emit_text()
|
||||
_emit_text()
|
||||
|
||||
func _on_ChoicesList_choices_changed(new_json_structure):
|
||||
json_structure.dialog.choices_multiple = new_json_structure
|
||||
var slot_number = json_structure.dialog.choices_multiple.size()
|
||||
# Always have at least one slot
|
||||
if slot_number == 0:
|
||||
slot_number = 1
|
||||
if (self.get_slot_amount() != slot_number):
|
||||
self.set_slot_amount(slot_number)
|
||||
self._update_slots()
|
||||
# TODO fix slots resetting when editing choice data
|
||||
self.emit_signal("changed_slots", self)
|
||||
_emit_text()
|
||||
|
||||
|
||||
#Public Methods
|
||||
|
@ -120,7 +112,7 @@ func get_slot_amount() -> int:
|
|||
|
||||
|
||||
func get_text() -> String:
|
||||
return JSON.print(json_structure)
|
||||
return JSON.print(json_structure, "\t")
|
||||
|
||||
|
||||
func set_nid(new_nid):
|
||||
|
@ -135,13 +127,23 @@ func set_slot_amount(new_amount : int):
|
|||
|
||||
|
||||
func set_text(new_text : String):
|
||||
json_structure = JSON.parse(new_text)
|
||||
# TODO update components
|
||||
print("New text received:")
|
||||
print(new_text)
|
||||
json_structure = JSON.parse(new_text).get_result()
|
||||
print(JSON.print(json_structure, "\t"))
|
||||
_update_components()
|
||||
self.emit_signal("text_changed", self._nid, new_text)
|
||||
|
||||
#Private Methods
|
||||
|
||||
func emit_text():
|
||||
func _update_components():
|
||||
_SpeakerIdSpinBox.set_value(json_structure.speaker.id)
|
||||
_SpeakerEmotionLineEdit.set_text(json_structure.speaker.emotion);
|
||||
_SceneIdSpinBox.set_value(json_structure.scene.id)
|
||||
_MessageTextEdit.set_text(json_structure.dialog.message)
|
||||
_ChoicesList.set_structure(json_structure.dialog.choices_multiple)
|
||||
|
||||
func _emit_text():
|
||||
print(get_text())
|
||||
self.emit_signal("text_changed", self._nid, get_text())
|
||||
|
||||
|
@ -158,7 +160,10 @@ func _update_slots():
|
|||
self._clear_link_labels()
|
||||
self.set_slot(0, true, 0, Color(1.0, 1.0, 1.0, 1.0), true, 0, Color(1.0, 1.0, 1.0, 1.0), null, null)
|
||||
var base_link_label = Label.new()
|
||||
base_link_label.text = "0"
|
||||
if (json_structure.dialog.choices_multiple.size() == 0):
|
||||
base_link_label.text = "Next"
|
||||
else:
|
||||
base_link_label.text = "Choice #1"
|
||||
base_link_label.align = Label.ALIGN_RIGHT
|
||||
self.add_child(base_link_label)
|
||||
self.move_child(base_link_label, 0)
|
||||
|
@ -166,7 +171,9 @@ func _update_slots():
|
|||
for slot in range(1, self._slot_amount):
|
||||
self.set_slot(slot, false, 0, Color(1.0, 1.0, 1.0, 1.0), true, 0, Color(1.0, 1.0, 1.0, 1.0), null, null)
|
||||
var output_link_label = Label.new()
|
||||
output_link_label.text = str(slot)
|
||||
output_link_label.text = "Choice #" + str(slot + 1)
|
||||
output_link_label.align = Label.ALIGN_RIGHT
|
||||
self.add_child_below_node(last_output_link_label, output_link_label)
|
||||
last_output_link_label = output_link_label
|
||||
|
||||
|
||||
|
|
|
@ -9,13 +9,49 @@
|
|||
config_version=4
|
||||
|
||||
_global_script_classes=[ {
|
||||
"base": "VBoxContainer",
|
||||
"class": "Choice",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/Choice/Choice.gd"
|
||||
}, {
|
||||
"base": "VBoxContainer",
|
||||
"class": "ChoicesList",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ChoicesList/ChoicesList.gd"
|
||||
}, {
|
||||
"base": "VBoxContainer",
|
||||
"class": "Condition",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/Condition/Condition.gd"
|
||||
}, {
|
||||
"base": "VBoxContainer",
|
||||
"class": "ConditionsList",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/ConditionsList/ConditionsList.gd"
|
||||
}, {
|
||||
"base": "",
|
||||
"class": "GitAPI",
|
||||
"language": "NativeScript",
|
||||
"path": "res://git_api.gdns"
|
||||
}, {
|
||||
"base": "VBoxContainer",
|
||||
"class": "Infobox",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Infobox/Infobox.gd"
|
||||
}, {
|
||||
"base": "GraphNode",
|
||||
"class": "LineNode",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/line_node.gd"
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
"GitAPI": ""
|
||||
"Choice": "",
|
||||
"ChoicesList": "",
|
||||
"Condition": "",
|
||||
"ConditionsList": "",
|
||||
"GitAPI": "",
|
||||
"Infobox": "",
|
||||
"LineNode": ""
|
||||
}
|
||||
|
||||
[application]
|
||||
|
|
121
test_story.tres
121
test_story.tres
|
@ -6,23 +6,132 @@
|
|||
script = ExtResource( 1 )
|
||||
TYPE = "EXP_Story_editor"
|
||||
names = {
|
||||
"TEST": 1
|
||||
|
||||
}
|
||||
story = {
|
||||
1: {
|
||||
"available_nid": [ ],
|
||||
"groups": [ ],
|
||||
"human_readable_description": "This is a test dialog",
|
||||
"name": "TEST",
|
||||
"human_readable_description": "New Dialog - Enter Human Readable Description.",
|
||||
"nodes": {
|
||||
1: {
|
||||
"graph_offset": Vector2( 200, 40 ),
|
||||
"graph_offset": Vector2( 120, 80 ),
|
||||
"links": {
|
||||
0: 2
|
||||
},
|
||||
"rect_size": Vector2( 324, 375 ),
|
||||
"slot_amount": 1,
|
||||
"text": "{
|
||||
\"speaker\": {
|
||||
\"id\": 1,
|
||||
\"emotion\": \"happy\"
|
||||
},
|
||||
\"scene\": {
|
||||
\"id\": 1
|
||||
},
|
||||
\"dialog\": {
|
||||
\"message\": \"Bonjour !\",
|
||||
\"choices_multiple\": [
|
||||
|
||||
]
|
||||
}
|
||||
}",
|
||||
"type": "line"
|
||||
},
|
||||
2: {
|
||||
"graph_offset": Vector2( 540, -180 ),
|
||||
"links": {
|
||||
0: 3,
|
||||
1: 4
|
||||
},
|
||||
"rect_size": Vector2( 324, 375 ),
|
||||
"slot_amount": 2,
|
||||
"text": "{
|
||||
\"speaker\": {
|
||||
\"id\": 1,
|
||||
\"emotion\": \"happy\"
|
||||
},
|
||||
\"scene\": {
|
||||
\"id\": 1
|
||||
},
|
||||
\"dialog\": {
|
||||
\"message\": \"Comment vas tu ?\",
|
||||
\"choices_multiple\": [
|
||||
{
|
||||
\"title\": \"Super !\",
|
||||
\"conditions\": [
|
||||
{
|
||||
\"id\": \"wellness\",
|
||||
\"value\": 50
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
\"title\": \"Pas ouf\",
|
||||
\"conditions\": [
|
||||
|
||||
],
|
||||
\"infobox\": {
|
||||
\"text\": \"Dire une telle chose est impensable\",
|
||||
\"conditions\": [
|
||||
{
|
||||
\"id\": \"intelligence\",
|
||||
\"value\": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}",
|
||||
"type": "line"
|
||||
},
|
||||
3: {
|
||||
"graph_offset": Vector2( 980, -60 ),
|
||||
"links": {
|
||||
|
||||
},
|
||||
"rect_size": Vector2( 324, 181 ),
|
||||
"rect_size": Vector2( 324, 375 ),
|
||||
"slot_amount": 1,
|
||||
"text": "{\"speaker\":{\"id\":1,\"emotion\":\"test\"},\"scene\":{\"id\":3},\"dialog\":{\"message\":\"message\",\"choices_free\":{\"placeholder\":\"\",\"global_var_name\":\"\"},\"choices_multiple\":[{\"title\":\"\",\"arc\":0,\"infobox\":{\"title\":\"\",\"text\":\"\",\"conditions\":[]},\"conditions\":[]}]}}",
|
||||
"text": "{
|
||||
\"speaker\": {
|
||||
\"id\": 1,
|
||||
\"emotion\": \"happy\"
|
||||
},
|
||||
\"scene\": {
|
||||
\"id\": 1
|
||||
},
|
||||
\"dialog\": {
|
||||
\"message\": \"Cool !\",
|
||||
\"choices_multiple\": [
|
||||
|
||||
]
|
||||
}
|
||||
}",
|
||||
"type": "line"
|
||||
},
|
||||
4: {
|
||||
"graph_offset": Vector2( 980, 460 ),
|
||||
"links": {
|
||||
|
||||
},
|
||||
"rect_size": Vector2( 324, 375 ),
|
||||
"slot_amount": 1,
|
||||
"text": "{
|
||||
\"speaker\": {
|
||||
\"id\": 1,
|
||||
\"emotion\": \"sad\"
|
||||
},
|
||||
\"scene\": {
|
||||
\"id\": 1
|
||||
},
|
||||
\"dialog\": {
|
||||
\"message\": \"Triste\",
|
||||
\"choices_multiple\": [
|
||||
|
||||
]
|
||||
}
|
||||
}",
|
||||
"type": "line"
|
||||
}
|
||||
}
|
||||
|
|
44
tests/NodeTest.gd
普通文件
44
tests/NodeTest.gd
普通文件
|
@ -0,0 +1,44 @@
|
|||
extends Node
|
||||
|
||||
onready var _LineNode: LineNode = self.get_node("Line")
|
||||
|
||||
var _json_structure = {
|
||||
"speaker": {
|
||||
"id": 5,
|
||||
"emotion": "happy"
|
||||
},
|
||||
"scene": {
|
||||
"id": 2
|
||||
},
|
||||
"dialog": {
|
||||
"message": "plop",
|
||||
"choices_multiple": [
|
||||
{
|
||||
"title": "test",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "coucou",
|
||||
"value": 5
|
||||
}
|
||||
],
|
||||
"infobox": {
|
||||
"text": "info info",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "zzzz",
|
||||
"value": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "cc",
|
||||
"conditions": []
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
func _on_Button_pressed():
|
||||
_LineNode.set_text(JSON.print(_json_structure))
|
20
tests/NodeTest.tscn
普通文件
20
tests/NodeTest.tscn
普通文件
|
@ -0,0 +1,20 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/EXP-System-Dialog/Dialog Editor/Nodes/Line/Line_Node.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://tests/NodeTest.gd" type="Script" id=2]
|
||||
|
||||
[node name="NodeTest" type="Node"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Line" parent="." instance=ExtResource( 1 )]
|
||||
|
||||
[node name="Button" type="Button" parent="."]
|
||||
margin_left = 378.27
|
||||
margin_top = 132.451
|
||||
margin_right = 427.27
|
||||
margin_bottom = 152.451
|
||||
text = "LOAD"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
[connection signal="pressed" from="Button" to="." method="_on_Button_pressed"]
|
正在加载…
在新工单中引用