Update json structure from new controls
This commit is contained in:
parent
b7cd887c5e
commit
04dac568d0
3 changed files with 75 additions and 35 deletions
|
@ -17,12 +17,6 @@ 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
|
||||
|
@ -30,9 +24,9 @@ __meta__ = {
|
|||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 39.0
|
||||
margin_top = 24.0
|
||||
margin_right = 308.0
|
||||
margin_bottom = 285.0
|
||||
margin_bottom = 270.0
|
||||
custom_constants/margin_right = 10
|
||||
custom_constants/margin_top = 10
|
||||
custom_constants/margin_left = 10
|
||||
|
@ -58,7 +52,7 @@ margin_right = 272.0
|
|||
margin_bottom = 42.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer"]
|
||||
[node name="SpeakerLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer"]
|
||||
margin_right = 272.0
|
||||
margin_bottom = 14.0
|
||||
text = "Speaker"
|
||||
|
@ -68,18 +62,18 @@ margin_top = 18.0
|
|||
margin_right = 272.0
|
||||
margin_bottom = 42.0
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer"]
|
||||
[node name="SpeakerIdLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer"]
|
||||
margin_top = 5.0
|
||||
margin_right = 12.0
|
||||
margin_bottom = 19.0
|
||||
text = "id"
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer"]
|
||||
[node name="SpeakerIdSpinBox" type="SpinBox" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 16.0
|
||||
margin_right = 90.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="TextEdit2" type="TextEdit" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer"]
|
||||
[node name="SpeakerEmotionTextEdit" type="TextEdit" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 94.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 24.0
|
||||
|
@ -105,7 +99,7 @@ margin_right = 272.0
|
|||
margin_bottom = 42.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer"]
|
||||
[node name="SceneLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer"]
|
||||
margin_right = 272.0
|
||||
margin_bottom = 14.0
|
||||
text = "Scene"
|
||||
|
@ -121,13 +115,13 @@ margin_left = 91.0
|
|||
margin_right = 181.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/CenterContainer/HBoxContainer"]
|
||||
[node name="SceneIdLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/CenterContainer/HBoxContainer"]
|
||||
margin_top = 5.0
|
||||
margin_right = 12.0
|
||||
margin_bottom = 19.0
|
||||
text = "id"
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/CenterContainer/HBoxContainer"]
|
||||
[node name="SceneIdSpinBox" type="SpinBox" parent="MarginContainer/VBoxContainer/HBoxContainer4/VBoxContainer/CenterContainer/HBoxContainer"]
|
||||
margin_left = 16.0
|
||||
margin_right = 90.0
|
||||
margin_bottom = 24.0
|
||||
|
@ -147,7 +141,7 @@ margin_right = 272.0
|
|||
margin_bottom = 82.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
|
||||
[node name="DialogLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
|
||||
margin_right = 272.0
|
||||
margin_bottom = 14.0
|
||||
text = "Dialog"
|
||||
|
@ -226,7 +220,10 @@ allow_greater = true
|
|||
[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="text_changed" from="MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer/MessageTextEdit" to="." method="_on_TextEdit_text_changed"]
|
||||
[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/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"]
|
||||
|
|
|
@ -11,7 +11,11 @@ signal pressed_save(this)
|
|||
signal text_changed(nid, new_text)
|
||||
|
||||
onready var _Link_SpinBox = self.get_node("MarginContainer/VBoxContainer/HBoxContainer/Link_SpinBox")
|
||||
onready var _Text_Editor = self.get_node("MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer/TextEdit")
|
||||
|
||||
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")
|
||||
|
||||
var _nid : int = 0
|
||||
var _slot_amount : int = 1
|
||||
|
@ -38,19 +42,9 @@ var json_structure = {
|
|||
"infobox": {
|
||||
"title": "",
|
||||
"text": "",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "education",
|
||||
"value": 0
|
||||
}
|
||||
],
|
||||
"conditions": [],
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "open_mindeness",
|
||||
"value": 0
|
||||
}
|
||||
]
|
||||
"conditions": []
|
||||
}
|
||||
|
||||
]
|
||||
|
@ -96,10 +90,25 @@ func _on_Save_BTN_pressed():
|
|||
self.emit_signal("pressed_save", self)
|
||||
|
||||
|
||||
func _on_TextEdit_text_changed():
|
||||
json_structure.dialog.message = self._Text_Editor.text
|
||||
func _on_MessageTextEdit_text_changed():
|
||||
json_structure.dialog.message = self._MessageTextEdit.text
|
||||
emit_text()
|
||||
|
||||
func _on_SceneIdSpinBox_value_changed(value):
|
||||
json_structure.scene.id = value
|
||||
emit_text()
|
||||
|
||||
|
||||
func _on_SpeakerEmotionTextEdit_text_changed():
|
||||
json_structure.speaker.emotion = self._SpeakerEmotionTextEdit.text
|
||||
emit_text()
|
||||
|
||||
|
||||
func _on_SpeakerIdSpinBox_value_changed(value):
|
||||
json_structure.speaker.id = value
|
||||
emit_text()
|
||||
|
||||
|
||||
#Public Methods
|
||||
|
||||
func get_nid() -> int:
|
||||
|
@ -111,7 +120,7 @@ func get_slot_amount() -> int:
|
|||
|
||||
|
||||
func get_text() -> String:
|
||||
return self._Text_Editor.text
|
||||
return JSON.print(json_structure)
|
||||
|
||||
|
||||
func set_nid(new_nid):
|
||||
|
@ -126,13 +135,15 @@ func set_slot_amount(new_amount : int):
|
|||
|
||||
|
||||
func set_text(new_text : String):
|
||||
self._Text_Editor.text = new_text
|
||||
json_structure = JSON.parse(new_text)
|
||||
# TODO update components
|
||||
self.emit_signal("text_changed", self._nid, new_text)
|
||||
|
||||
#Private Methods
|
||||
|
||||
func emit_text():
|
||||
self.emit_signal("text_changed", self._nid, JSON.print(json_structure))
|
||||
print(get_text())
|
||||
self.emit_signal("text_changed", self._nid, get_text())
|
||||
|
||||
|
||||
func _clear_link_labels():
|
||||
|
|
32
test_story.tres
Normal file
32
test_story.tres
Normal file
|
@ -0,0 +1,32 @@
|
|||
[gd_resource type="Resource" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/EXP-System-Dialog/Resource_EditorStory/EXP_EditorStory.gd" type="Script" id=1]
|
||||
|
||||
[resource]
|
||||
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",
|
||||
"nodes": {
|
||||
1: {
|
||||
"graph_offset": Vector2( 200, 40 ),
|
||||
"links": {
|
||||
|
||||
},
|
||||
"rect_size": Vector2( 324, 181 ),
|
||||
"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\":[]}]}}",
|
||||
"type": "line"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
available_dids = [ ]
|
||||
groups = [ ]
|
Loading…
Reference in a new issue