From 777111219f2ac46a736e72a87072478eea6f9d8a Mon Sep 17 00:00:00 2001 From: osquallo Date: Mon, 30 Jul 2018 16:00:37 +0200 Subject: [PATCH] allegement de syntaxe. --- scenes/GUI/GUI.tscn | 1 - scenes/GUI/HUD/HUD.gd | 1 + scenes/GUI/HUD/HUD.tscn | 4 ++-- scenes/GUI/Settings/Settings.gd | 13 +++++++------ scenes/GUI/Settings/Settings.tscn | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/scenes/GUI/GUI.tscn b/scenes/GUI/GUI.tscn index 31cd7cc..a7ae4e0 100644 --- a/scenes/GUI/GUI.tscn +++ b/scenes/GUI/GUI.tscn @@ -46,7 +46,6 @@ margin_left = 4.0 margin_top = 4.0 margin_right = 1020.0 margin_bottom = 596.0 -mouse_filter = 1 theme = SubResource( 2 ) [node name="Home" parent="." index="1" instance=ExtResource( 4 )] diff --git a/scenes/GUI/HUD/HUD.gd b/scenes/GUI/HUD/HUD.gd index c863e5a..fbcb60a 100644 --- a/scenes/GUI/HUD/HUD.gd +++ b/scenes/GUI/HUD/HUD.gd @@ -23,6 +23,7 @@ func _on_SaveHUD_pressed(): if err: print("Error code when loading config file: ", err) + for child in get_node("Windows" ).get_children(): child.save_to_file( config_file ) diff --git a/scenes/GUI/HUD/HUD.tscn b/scenes/GUI/HUD/HUD.tscn index aabe5ef..c5f3c9f 100644 --- a/scenes/GUI/HUD/HUD.tscn +++ b/scenes/GUI/HUD/HUD.tscn @@ -12,7 +12,7 @@ [ext_resource path="res://scenes/GUI/HUD/trauma.gd" type="Script" id=10] [ext_resource path="res://scenes/GUI/HUD/douleur.gd" type="Script" id=11] -[node name="HUD" type="MarginContainer" index="0"] +[node name="HUD" type="MarginContainer"] anchor_left = 0.0 anchor_top = 0.0 @@ -20,7 +20,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false -mouse_filter = 2 +mouse_filter = 1 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 1 diff --git a/scenes/GUI/Settings/Settings.gd b/scenes/GUI/Settings/Settings.gd index bb86e8d..0651134 100644 --- a/scenes/GUI/Settings/Settings.gd +++ b/scenes/GUI/Settings/Settings.gd @@ -25,13 +25,14 @@ func load_settings(): # On suppose que le fichier n'existe pas encore, donc on le crée. config_file.set_value( "theme", "font_size", 14 ) config_file.save( "user://settings.cfg" ) - else: + elif not err == OK: print("Error code when loading config file: ", err) - - if $Menus.get_theme() and config_file.get_value( "theme", "font_size" ): - $Menus.get_theme().default_font.size = config_file.get_value( "theme", "font_size" ) - $Menus/TabContainer/Test/ScrollContainer/VBoxContainer/font_size_bar.value = config_file.get_value( "theme", "font_size" ) - $Menus/TabContainer/Test/ScrollContainer/VBoxContainer/font_size/font_size_value.text = str( $Menus/TabContainer/Test/ScrollContainer/VBoxContainer/font_size_bar.value ) + + var font_size = config_file.get_value( "theme", "font_size" ) + if $Menus.get_theme() and font_size: + $Menus.get_theme().default_font.size = font_size + $Menus/TabContainer/Test/ScrollContainer/VBoxContainer/font_size_bar.value = font_size + $Menus/TabContainer/Test/ScrollContainer/VBoxContainer/font_size/font_size_value.text = str( font_size ) diff --git a/scenes/GUI/Settings/Settings.tscn b/scenes/GUI/Settings/Settings.tscn index a031f84..c1b165e 100644 --- a/scenes/GUI/Settings/Settings.tscn +++ b/scenes/GUI/Settings/Settings.tscn @@ -148,7 +148,7 @@ use_filter = false font_data = ExtResource( 2 ) _sections_unfolded = [ "Font", "Settings" ] -[node name="Settings" type="MarginContainer"] +[node name="Settings" type="MarginContainer" index="0"] anchor_left = 0.0 anchor_top = 0.0