diff --git a/Phase2/Godot_Toolset/Main/project.godot b/Phase2/Godot_Toolset/Main/project.godot index 9118a34..4420a7c 100644 --- a/Phase2/Godot_Toolset/Main/project.godot +++ b/Phase2/Godot_Toolset/Main/project.godot @@ -13,6 +13,10 @@ config_version=4 config/name="bcirpg_toolset" config/icon="res://icon.png" +[global] + +filters=false + [gui] common/drop_mouse_on_gui_input_disabled=true diff --git a/Phase2/Godot_Toolset/Main/screens/wizards/character_creation/SaveCharButton.gd b/Phase2/Godot_Toolset/Main/screens/wizards/character_creation/SaveCharButton.gd new file mode 100644 index 0000000..458a8f2 --- /dev/null +++ b/Phase2/Godot_Toolset/Main/screens/wizards/character_creation/SaveCharButton.gd @@ -0,0 +1,14 @@ +extends Button + + + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +func _handle_user_input(): + pass + +func _on_Button_pressed(): + _handle_user_input() diff --git a/Phase2/Godot_Toolset/Main/screens/wizards/character_creation/character_creation_wizard.tscn b/Phase2/Godot_Toolset/Main/screens/wizards/character_creation/character_creation_wizard.tscn index 4174ba5..afbe68e 100644 --- a/Phase2/Godot_Toolset/Main/screens/wizards/character_creation/character_creation_wizard.tscn +++ b/Phase2/Godot_Toolset/Main/screens/wizards/character_creation/character_creation_wizard.tscn @@ -1,6 +1,8 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=4 format=2] -[ext_resource path="res://screens/wizards/character_creation/SkillOptionButtonScript.gd" type="Script" id=1] +[ext_resource path="res://screens/wizards/character_creation/skills_option_button.gd" type="Script" id=1] +[ext_resource path="res://screens/wizards/character_creation/specials_option_button.gd" type="Script" id=2] +[ext_resource path="res://screens/wizards/character_creation/SaveCharButton.gd" type="Script" id=3] [node name="Control" type="Control"] anchor_right = 1.0 @@ -568,6 +570,7 @@ text = "Slot 1:" margin_left = 44.0 margin_right = 73.0 margin_bottom = 20.0 +script = ExtResource( 2 ) [node name="Label2" type="Label" parent="RootVBoxContainer/TopHBoxContainer/RightVBoxContainer/VBoxContainer/HBoxContainer/SpecialAbilitiesVBoxContainer/CenterContainer/GridContainer"] margin_top = 27.0 @@ -580,6 +583,7 @@ margin_left = 44.0 margin_top = 24.0 margin_right = 73.0 margin_bottom = 44.0 +script = ExtResource( 2 ) [node name="Label3" type="Label" parent="RootVBoxContainer/TopHBoxContainer/RightVBoxContainer/VBoxContainer/HBoxContainer/SpecialAbilitiesVBoxContainer/CenterContainer/GridContainer"] margin_top = 51.0 @@ -592,6 +596,7 @@ margin_left = 44.0 margin_top = 48.0 margin_right = 73.0 margin_bottom = 68.0 +script = ExtResource( 2 ) [node name="Label4" type="Label" parent="RootVBoxContainer/TopHBoxContainer/RightVBoxContainer/VBoxContainer/HBoxContainer/SpecialAbilitiesVBoxContainer/CenterContainer/GridContainer"] margin_top = 75.0 @@ -604,6 +609,7 @@ margin_left = 44.0 margin_top = 72.0 margin_right = 73.0 margin_bottom = 92.0 +script = ExtResource( 2 ) [node name="Label5" type="Label" parent="RootVBoxContainer/TopHBoxContainer/RightVBoxContainer/VBoxContainer/HBoxContainer/SpecialAbilitiesVBoxContainer/CenterContainer/GridContainer"] margin_top = 99.0 @@ -616,6 +622,7 @@ margin_left = 44.0 margin_top = 96.0 margin_right = 73.0 margin_bottom = 116.0 +script = ExtResource( 2 ) [node name="Label6" type="Label" parent="RootVBoxContainer/TopHBoxContainer/RightVBoxContainer/VBoxContainer/HBoxContainer/SpecialAbilitiesVBoxContainer/CenterContainer/GridContainer"] margin_top = 123.0 @@ -628,6 +635,7 @@ margin_left = 44.0 margin_top = 120.0 margin_right = 73.0 margin_bottom = 140.0 +script = ExtResource( 2 ) [node name="Label7" type="Label" parent="RootVBoxContainer/TopHBoxContainer/RightVBoxContainer/VBoxContainer/HBoxContainer/SpecialAbilitiesVBoxContainer/CenterContainer/GridContainer"] margin_top = 147.0 @@ -640,6 +648,7 @@ margin_left = 44.0 margin_top = 144.0 margin_right = 73.0 margin_bottom = 164.0 +script = ExtResource( 2 ) [node name="Label8" type="Label" parent="RootVBoxContainer/TopHBoxContainer/RightVBoxContainer/VBoxContainer/HBoxContainer/SpecialAbilitiesVBoxContainer/CenterContainer/GridContainer"] margin_top = 171.0 @@ -652,6 +661,7 @@ margin_left = 44.0 margin_top = 168.0 margin_right = 73.0 margin_bottom = 188.0 +script = ExtResource( 2 ) [node name="Label9" type="Label" parent="RootVBoxContainer/TopHBoxContainer/RightVBoxContainer/VBoxContainer/HBoxContainer/SpecialAbilitiesVBoxContainer/CenterContainer/GridContainer"] margin_top = 195.0 @@ -664,9 +674,14 @@ margin_left = 44.0 margin_top = 192.0 margin_right = 73.0 margin_bottom = 212.0 +script = ExtResource( 2 ) [node name="Button" type="Button" parent="RootVBoxContainer/TopHBoxContainer/RightVBoxContainer/VBoxContainer"] margin_top = 348.0 margin_right = 400.0 margin_bottom = 368.0 text = "Export Character To Module" +script = ExtResource( 3 ) + +[connection signal="pressed" from="RootVBoxContainer/TopHBoxContainer/RightVBoxContainer/VBoxContainer/Button" to="RootVBoxContainer/TopHBoxContainer/RightVBoxContainer/VBoxContainer/HBoxContainer/SkillsVboxContainer/CenterContainer/GridContainer/SkillOptionButton" method="_on_Button_pressed"] +[connection signal="pressed" from="RootVBoxContainer/TopHBoxContainer/RightVBoxContainer/VBoxContainer/Button" to="RootVBoxContainer/TopHBoxContainer/RightVBoxContainer/VBoxContainer/Button" method="_on_Button_pressed"] diff --git a/Phase2/Godot_Toolset/Main/screens/wizards/character_creation/skills_option_button.gd b/Phase2/Godot_Toolset/Main/screens/wizards/character_creation/skills_option_button.gd new file mode 100644 index 0000000..15d73a2 --- /dev/null +++ b/Phase2/Godot_Toolset/Main/screens/wizards/character_creation/skills_option_button.gd @@ -0,0 +1,29 @@ +extends OptionButton + +var json_path = "res://test_scripts/testnew.json" + +func _ready(): + _loadJSONToDict(json_path) + +func _loadJSONToDict(filepath: String): + var file = File.new() + + # Open the file for reading + var error = file.open(filepath, File.READ) + if error != OK: + print("Error opening file:", filepath) + + # Read and parse the JSON content + var json_text = file.get_as_text() + file.close() # Close the file after reading + var moduleDict = parse_json(json_text) + + # Check if parsing was successful + if moduleDict is Dictionary and moduleDict.size() > 0: + print(moduleDict) + var variables = moduleDict.get("items") + for variable in variables: + add_item(variable["value"]) + return moduleDict + else: + print("Error parsing JSON content") diff --git a/Phase2/Godot_Toolset/Main/screens/wizards/character_creation/specials_option_button.gd b/Phase2/Godot_Toolset/Main/screens/wizards/character_creation/specials_option_button.gd new file mode 100644 index 0000000..15d73a2 --- /dev/null +++ b/Phase2/Godot_Toolset/Main/screens/wizards/character_creation/specials_option_button.gd @@ -0,0 +1,29 @@ +extends OptionButton + +var json_path = "res://test_scripts/testnew.json" + +func _ready(): + _loadJSONToDict(json_path) + +func _loadJSONToDict(filepath: String): + var file = File.new() + + # Open the file for reading + var error = file.open(filepath, File.READ) + if error != OK: + print("Error opening file:", filepath) + + # Read and parse the JSON content + var json_text = file.get_as_text() + file.close() # Close the file after reading + var moduleDict = parse_json(json_text) + + # Check if parsing was successful + if moduleDict is Dictionary and moduleDict.size() > 0: + print(moduleDict) + var variables = moduleDict.get("items") + for variable in variables: + add_item(variable["value"]) + return moduleDict + else: + print("Error parsing JSON content") diff --git a/Phase2/Godot_Toolset/Main/screens/wizards/character_creation/testnew.json b/Phase2/Godot_Toolset/Main/screens/wizards/character_creation/testnew.json new file mode 100644 index 0000000..5bd5747 --- /dev/null +++ b/Phase2/Godot_Toolset/Main/screens/wizards/character_creation/testnew.json @@ -0,0 +1,11 @@ +{ + "items": [ + { + "value": "item1" + }, + { + "value": "item2" + } + ] +} + diff --git a/Phase2/Godot_Toolset/Main/test_scripts/test.json b/Phase2/Godot_Toolset/Main/test_scripts/test.json index cb8b323..8b30663 100644 --- a/Phase2/Godot_Toolset/Main/test_scripts/test.json +++ b/Phase2/Godot_Toolset/Main/test_scripts/test.json @@ -1,5 +1,5 @@ { - "variables": [ + "items": [ { "name": "variable1", "value": "value1" diff --git a/Phase2/Godot_Toolset/Main/test_scripts/testnew.json b/Phase2/Godot_Toolset/Main/test_scripts/testnew.json new file mode 100644 index 0000000..5bd5747 --- /dev/null +++ b/Phase2/Godot_Toolset/Main/test_scripts/testnew.json @@ -0,0 +1,11 @@ +{ + "items": [ + { + "value": "item1" + }, + { + "value": "item2" + } + ] +} +