From c758e49361ec01098a4205d687c98403a2a00f3f Mon Sep 17 00:00:00 2001 From: mifth Date: Sun, 9 Jun 2024 23:40:50 +0200 Subject: [PATCH] V0.2 --- .../Assets/Dialogue/DialogueCreator.tscn | 8 ++++---- addons/dialoguecreator/Scripts/Dialogue/DCGraph.gd | 11 +++++++++++ addons/dialoguecreator/Scripts/Menu/DCFileMenu.gd | 10 ++++------ addons/dialoguecreator/Scripts/Nodes/DCActionNode.gd | 1 - addons/dialoguecreator/Scripts/Parsing/DCParse.gd | 4 ++-- .../dialoguecreator/Scripts/PlayScene/DCPlayScene.gd | 5 +++-- addons/dialoguecreator/Scripts/Utils/DCUtils.gd | 2 +- addons/dialoguecreator/plugin.cfg | 2 +- addons/dialoguecreatorgame/Scripts/Utils/DCGUtils.gd | 2 +- addons/dialoguecreatorgame/plugin.cfg | 2 +- 10 files changed, 28 insertions(+), 19 deletions(-) diff --git a/addons/dialoguecreator/Assets/Dialogue/DialogueCreator.tscn b/addons/dialoguecreator/Assets/Dialogue/DialogueCreator.tscn index 1c223a9..8821854 100644 --- a/addons/dialoguecreator/Assets/Dialogue/DialogueCreator.tscn +++ b/addons/dialoguecreator/Assets/Dialogue/DialogueCreator.tscn @@ -55,11 +55,11 @@ grow_vertical = 2 layout_mode = 2 text = "File" item_count = 3 -popup/item_0/text = "New" +popup/item_0/text = "New (Ctrl+N)" popup/item_0/id = 0 -popup/item_1/text = "Open" +popup/item_1/text = "Open (Ctrl+O)" popup/item_1/id = 1 -popup/item_2/text = "Save" +popup/item_2/text = "Save (Ctrl+S)" popup/item_2/id = 2 script = ExtResource("2_4wsl1") @@ -136,7 +136,7 @@ size = Vector2i(589, 344) dialog_hide_on_ok = true dialog_autowrap = true access = 2 -filters = PackedStringArray("*.json") +filters = PackedStringArray("*.dcj") use_native_dialog = true [connection signal="pressed" from="VBoxContainer/MenuBar/HBoxContainer/HBoxContainer/PlaySceneButton" to="." method="_on_play_scene_button_pressed"] diff --git a/addons/dialoguecreator/Scripts/Dialogue/DCGraph.gd b/addons/dialoguecreator/Scripts/Dialogue/DCGraph.gd index c6ebd73..221cd1f 100644 --- a/addons/dialoguecreator/Scripts/Dialogue/DCGraph.gd +++ b/addons/dialoguecreator/Scripts/Dialogue/DCGraph.gd @@ -101,7 +101,18 @@ func add_node(node_name: String): func _input(event): if Input.is_key_pressed(KEY_DELETE): delete_selected_graphNodes() + + elif Input.is_key_pressed(KEY_S): + if Input.is_key_pressed(KEY_CTRL): + save_file_dialogue() + + elif Input.is_key_pressed(KEY_O): + if Input.is_key_pressed(KEY_CTRL): + load_file_dialogue() + elif Input.is_key_pressed(KEY_N): + if Input.is_key_pressed(KEY_CTRL): + new_scene() func delete_selected_graphNodes(): var nodes = graph.get_children() diff --git a/addons/dialoguecreator/Scripts/Menu/DCFileMenu.gd b/addons/dialoguecreator/Scripts/Menu/DCFileMenu.gd index 8ed85f0..fc2864d 100644 --- a/addons/dialoguecreator/Scripts/Menu/DCFileMenu.gd +++ b/addons/dialoguecreator/Scripts/Menu/DCFileMenu.gd @@ -14,11 +14,9 @@ func _ready(): func _on_item_pressed(ID): - var button_name = popup.get_item_text(ID) - - if button_name == "New": + if ID == 0: emit_signal("NewFile") - elif button_name == "Save": - emit_signal("SaveFile") - elif button_name == "Open": + elif ID == 1: emit_signal("LoadFile") + elif ID == 2: + emit_signal("SaveFile") diff --git a/addons/dialoguecreator/Scripts/Nodes/DCActionNode.gd b/addons/dialoguecreator/Scripts/Nodes/DCActionNode.gd index 01a480f..56f1fba 100644 --- a/addons/dialoguecreator/Scripts/Nodes/DCActionNode.gd +++ b/addons/dialoguecreator/Scripts/Nodes/DCActionNode.gd @@ -33,7 +33,6 @@ func get_node_params_js(): params["ActionPorts"]["Texts"].append(port.get_text_node().text) - return [params, DCGUtils.ActionNode] diff --git a/addons/dialoguecreator/Scripts/Parsing/DCParse.gd b/addons/dialoguecreator/Scripts/Parsing/DCParse.gd index 312165e..2ab0700 100644 --- a/addons/dialoguecreator/Scripts/Parsing/DCParse.gd +++ b/addons/dialoguecreator/Scripts/Parsing/DCParse.gd @@ -51,8 +51,8 @@ static func save_file_js(main_graph: DCGraph, path: String): var data_js_str = JSON.stringify(data_js, " ") var final_path = path - if not final_path.ends_with(".json"): - final_path += ".json" + if not final_path.ends_with(".dcj"): + final_path += ".dcj" if FileAccess.file_exists(final_path): # Set Writable diff --git a/addons/dialoguecreator/Scripts/PlayScene/DCPlayScene.gd b/addons/dialoguecreator/Scripts/PlayScene/DCPlayScene.gd index 7487dfe..7be99ab 100644 --- a/addons/dialoguecreator/Scripts/PlayScene/DCPlayScene.gd +++ b/addons/dialoguecreator/Scripts/PlayScene/DCPlayScene.gd @@ -144,10 +144,11 @@ func set_up_dialogue_node(d_node: DCGDialogueData.NodeData): var char_node = self.dc_data.get_character_node_js_by_id(char_id) if char_node: get_char_name_edit().text = char_node["CharacterName"] - #get_char_texture_edit().texture = null - #print(char_node["CharacterTexture"]) + var icons = get_main_graph().graph.get_node(char_node["Name"]) as DCCharacterNode get_char_texture_edit().texture = icons.GetItemsIcons().get_item_icon(char_node["CharacterTexture"]) + else: + get_char_name_edit().text = "Character: " + str(char_id) func clear_play_scene(): diff --git a/addons/dialoguecreator/Scripts/Utils/DCUtils.gd b/addons/dialoguecreator/Scripts/Utils/DCUtils.gd index 86a3bd1..ecc14e1 100644 --- a/addons/dialoguecreator/Scripts/Utils/DCUtils.gd +++ b/addons/dialoguecreator/Scripts/Utils/DCUtils.gd @@ -1,7 +1,7 @@ class_name DCUtils extends Object -const version = [0, 1] +const version = [0, 2] diff --git a/addons/dialoguecreator/plugin.cfg b/addons/dialoguecreator/plugin.cfg index ec27534..04fe6dc 100644 --- a/addons/dialoguecreator/plugin.cfg +++ b/addons/dialoguecreator/plugin.cfg @@ -3,5 +3,5 @@ name="DialogueCreator" description="" author="Mifth" -version="0.1" +version="0.2" script="dialoguecreatorplugin.gd" diff --git a/addons/dialoguecreatorgame/Scripts/Utils/DCGUtils.gd b/addons/dialoguecreatorgame/Scripts/Utils/DCGUtils.gd index c0721f6..c7f0a60 100644 --- a/addons/dialoguecreatorgame/Scripts/Utils/DCGUtils.gd +++ b/addons/dialoguecreatorgame/Scripts/Utils/DCGUtils.gd @@ -17,7 +17,7 @@ const CharacterNode = "DCCharacterNode" const dialogue_nodes_types = [ActionNode, DialogueNode] const live_nodes_types = [ActionNode, DialogueNode, SetTextNode] -const version = [0, 1] +const version = [0, 2] static func generate_id(ids, start_value: int) -> int: diff --git a/addons/dialoguecreatorgame/plugin.cfg b/addons/dialoguecreatorgame/plugin.cfg index 2097648..7cd7023 100644 --- a/addons/dialoguecreatorgame/plugin.cfg +++ b/addons/dialoguecreatorgame/plugin.cfg @@ -3,5 +3,5 @@ name="DialogueCreatorGame" description="" author="Mifth" -version="0.1" +version="0.2" script="dcgplugin.gd"