added save functionality for genre settings. currently saves to xml file under user's local files. saves for other wizards to come

This commit is contained in:
BassS0ul 2023-10-15 13:37:39 -05:00
parent 81ed1d7c03
commit 6533d889b5
7 changed files with 26 additions and 18 deletions

View File

@ -16,7 +16,7 @@ dock_5="Inspector,Node,History"
[EditorNode] [EditorNode]
open_scenes=["res://top_toolbar/TopToolbar.tscn", "res://genre_dialog_container.tscn"] open_scenes=["res://top_toolbar/TopToolbar.tscn", "res://genre_dialog_container.tscn", "res://new_genre.tscn"]
[ScriptEditor] [ScriptEditor]

View File

@ -1,8 +1,8 @@
2a60927148abd1d33b818b535e306557 2a60927148abd1d33b818b535e306557
::res://::1696749243 ::res://::1697073810
Cabin-VariableFont_wdth,wght.ttf::FontFile::6071708341937432371::1691364683::1691364683::1::::<><>:: Cabin-VariableFont_wdth,wght.ttf::FontFile::6071708341937432371::1691364683::1691364683::1::::<><>::
default_env.tres::Environment::-1::1691364683::0::1::::<><>:: default_env.tres::Environment::-1::1691364683::0::1::::<><>::
GenreSettings.gd::GDScript::-1::1695443926::0::1::::<>Node<>:: GenreSettings.gd::GDScript::-1::1696788114::0::1::::<>Node<>::
genre_dialog_container.gd::GDScript::-1::1693705495::0::1::::<>ScrollContainer<>:: genre_dialog_container.gd::GDScript::-1::1693705495::0::1::::<>ScrollContainer<>::
genre_dialog_container.tscn::PackedScene::153944638127573795::1695854807::0::1::::<><>::uid://cl7q0snsncynm<>res://genre_dialog_container.gd genre_dialog_container.tscn::PackedScene::153944638127573795::1695854807::0::1::::<><>::uid://cl7q0snsncynm<>res://genre_dialog_container.gd
icon.png::CompressedTexture2D::6683631437730026850::1691364683::1691364683::1::::<><>:: icon.png::CompressedTexture2D::6683631437730026850::1691364683::1691364683::1::::<><>::
@ -12,7 +12,7 @@ README.md::TextFile::-1::1691364683::0::1::::<><>::
term_container.tscn::PackedScene::5611995818604433798::1693156714::0::1::::<><>:: term_container.tscn::PackedScene::5611995818604433798::1693156714::0::1::::<><>::
::res://index_screen/::1691364683 ::res://index_screen/::1691364683
index.tscn::PackedScene::1801527253264693182::1691364683::0::1::::<><>:: index.tscn::PackedScene::1801527253264693182::1691364683::0::1::::<><>::
::res://top_toolbar/::1695854807 ::res://top_toolbar/::1696788114
DialogMenu.gd::GDScript::-1::1693705495::0::1::::<>Label<>:: DialogMenu.gd::GDScript::-1::1693705495::0::1::::<>Label<>::
GenreDialogManager.gd::GDScript::-1::1693446726::0::1::::<>OptionButton<>:: GenreDialogManager.gd::GDScript::-1::1693446726::0::1::::<>OptionButton<>::
TopToolbar.tscn::PackedScene::5079673781919012116::1695854807::0::1::::<><>::res://MenuManager.gd<>res://GenreSettings.gd<>res://top_toolbar/DialogMenu.gd<>res://top_toolbar/GenreDialogManager.gd<>uid://cgtpfhy1ler0 TopToolbar.tscn::PackedScene::5079673781919012116::1696788114::0::1::::<><>::res://MenuManager.gd<>res://GenreSettings.gd<>res://top_toolbar/DialogMenu.gd<>res://top_toolbar/GenreDialogManager.gd<>uid://cgtpfhy1ler0

View File

@ -1,2 +1,4 @@
res://top_toolbar/TopToolbar.tscn res://genre_dialog_container.tscn
res://GenreSettings.gd res://GenreSettings.gd
res://new_genre.tscn
res://top_toolbar/TopToolbar.tscn

View File

@ -10,7 +10,7 @@ run_reload_scripts=true
[recent_files] [recent_files]
scenes=["res://genre_dialog_container.tscn", "res://top_toolbar/TopToolbar.tscn", "res://new_genre.tscn", "res://index_screen/index.tscn", "res://toolset_test_tabbed_merged/tabbed_merged_test_interface.tscn", "res://toolset_test_tabbed_merged/draggable_assets.tscn", "res://toolset_test/drag_and_drop_demo_final.tscn"] scenes=["res://new_genre.tscn", "res://genre_dialog_container.tscn", "res://top_toolbar/TopToolbar.tscn", "res://index_screen/index.tscn", "res://toolset_test_tabbed_merged/tabbed_merged_test_interface.tscn", "res://toolset_test_tabbed_merged/draggable_assets.tscn", "res://toolset_test/drag_and_drop_demo_final.tscn"]
scripts=["res://genre_dialog_container.gd", "res://top_toolbar/GenreDialogManager.gd", "res://top_toolbar/DialogMenu.gd", "res://GenreSettings.gd", "res://RadioButtonManager.gd", "res://MenuManager.gd", "res://toolset_test_tabbed_merged/target_container_final.gd", "res://toolset_test_tabbed_merged/toolset_test_tabbed_merged.gd", "res://toolset_test/draggable_final.gd", "res://toolset_test_tabbed_merged/PanelCanvas_Temp.gd"] scripts=["res://genre_dialog_container.gd", "res://top_toolbar/GenreDialogManager.gd", "res://top_toolbar/DialogMenu.gd", "res://GenreSettings.gd", "res://RadioButtonManager.gd", "res://MenuManager.gd", "res://toolset_test_tabbed_merged/target_container_final.gd", "res://toolset_test_tabbed_merged/toolset_test_tabbed_merged.gd", "res://toolset_test/draggable_final.gd", "res://toolset_test_tabbed_merged/PanelCanvas_Temp.gd"]
[dialog_bounds] [dialog_bounds]

View File

@ -17,11 +17,11 @@ state={
state={ state={
"bookmarks": PackedInt32Array(), "bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(), "breakpoints": PackedInt32Array(),
"column": 84, "column": 45,
"folded_lines": Array[int]([]), "folded_lines": Array[int]([]),
"h_scroll_position": 0, "h_scroll_position": 0,
"row": 25, "row": 29,
"scroll_position": 0.0, "scroll_position": 10.0,
"selection": false, "selection": false,
"syntax_highlighter": "GDScript" "syntax_highlighter": "GDScript"
} }

View File

@ -21,10 +21,16 @@ func _on_new_genre_button_up():
func _on_save_button_pressed(): func _on_save_button_pressed():
var listOfGenres = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<genresettings>\n"
var file = FileAccess.open("user://test.xml", FileAccess.WRITE) var file = FileAccess.open("user://test.xml", FileAccess.WRITE)
if file: var fromFile = $HBoxContainer/Default/ScrollContainer/GenreContainer.get_children()
file.store_string("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<genresettings>\n") #go through each genre in the list and add them to the string to be added to the file
#for each genre container for genre in fromFile:
#add name and what it's based on. skip based on if first three. if genre is HBoxContainer:
file.store_string("</genresettings>") listOfGenres= listOfGenres + "\t<genre>\n"
file.close() if genre.get_child_count() > 2:
listOfGenres = listOfGenres + "\t\t<default>\n\t\t\t" + str(genre.get_child(0).is_pressed()) + "\n\t\t</default>\n" + "\t\t<name>\n\t\t\t" + genre.get_child(1).text + "\n\t\t</name>\n" + "\t\t<basedOn>\n\t\t\t" + genre.get_child(2).Selected + "\n\t\t</basedOn>\n\t</genre>\n"
else:
listOfGenres= listOfGenres + "\t\t<default>\n\t\t\t" + str(genre.get_child(0).is_pressed()) + "\n\t\t</default>\n" + "\t\t<name>\n\t\t\t" + genre.get_child(1).text + "\n\t\t</name>\n\t</genre>\n"
listOfGenres = listOfGenres + "</genresettings>\n"
file.store_string(listOfGenres)