From e29637f08b48f0ca3d1b5f974e0674ec8377556f Mon Sep 17 00:00:00 2001 From: osquallo Date: Tue, 28 Aug 2018 10:00:17 +0200 Subject: [PATCH] ajout d'un onglet de selection de scene, au menu setting. --- dispensaire_scenes/dispensaire_scenes.tscn | 2 + game_scene/Game/Game.tscn | 2 +- gui_scene/GUI/GUI.tscn | 2 +- gui_scene/GUI/Settings/Settings.tscn | 11 +- .../scene_selection/scene_selection_menu.tscn | 258 ++++++++++++++++++ .../scene_selection/select_scene_button.gd | 10 + login_scene/login_scene.tscn | 2 +- 7 files changed, 282 insertions(+), 5 deletions(-) create mode 100644 gui_scene/GUI/scene_selection/scene_selection_menu.tscn create mode 100644 gui_scene/GUI/scene_selection/select_scene_button.gd diff --git a/dispensaire_scenes/dispensaire_scenes.tscn b/dispensaire_scenes/dispensaire_scenes.tscn index 18c7a56..79c622c 100644 --- a/dispensaire_scenes/dispensaire_scenes.tscn +++ b/dispensaire_scenes/dispensaire_scenes.tscn @@ -10,6 +10,8 @@ [node name="world" type="Spatial" parent="." index="0"] +editor/display_folded = true + [node name="DisCor1wDoLRAA01" parent="world" index="0" instance=ExtResource( 1 )] transform = Transform( -1, 0, -8.74228e-008, 0, 1, 0, 8.74228e-008, 0, -1, -1, 0, 0 ) diff --git a/game_scene/Game/Game.tscn b/game_scene/Game/Game.tscn index 408e0c8..f17e90f 100644 --- a/game_scene/Game/Game.tscn +++ b/game_scene/Game/Game.tscn @@ -1018,11 +1018,11 @@ _sections_unfolded = [ "Transform" ] [node name="World" type="Spatial" parent="." index="0"] -editor/display_folded = true _sections_unfolded = [ "Transform", "Visibility" ] [node name="WorldEnvironment" type="WorldEnvironment" parent="World" index="0"] +editor/display_folded = true environment = SubResource( 2 ) script = ExtResource( 1 ) diff --git a/gui_scene/GUI/GUI.tscn b/gui_scene/GUI/GUI.tscn index 6f90e40..cfb43a9 100644 --- a/gui_scene/GUI/GUI.tscn +++ b/gui_scene/GUI/GUI.tscn @@ -19,7 +19,7 @@ _sections_unfolded = [ "Font", "Settings" ] default_font = SubResource( 1 ) -[node name="GUI" type="MarginContainer" index="0"] +[node name="GUI" type="MarginContainer"] pause_mode = 2 anchor_left = 0.0 diff --git a/gui_scene/GUI/Settings/Settings.tscn b/gui_scene/GUI/Settings/Settings.tscn index 1280b16..12d9203 100644 --- a/gui_scene/GUI/Settings/Settings.tscn +++ b/gui_scene/GUI/Settings/Settings.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=16 format=2] +[gd_scene load_steps=17 format=2] [ext_resource path="res://gui_scene/GUI/Settings/Settings.gd" type="Script" id=1] [ext_resource path="res://assets/GUI/fonts/ryzom.ttf" type="DynamicFontData" id=2] @@ -6,7 +6,7 @@ [ext_resource path="res://addons/input_map_button/icon.png" type="Texture" id=4] [ext_resource path="res://gui_scene/GUI/Settings/MenuButton.gd" type="Script" id=5] [ext_resource path="res://gui_scene/GUI/MusicControls/MusicControls.tscn" type="PackedScene" id=6] - +[ext_resource path="res://gui_scene/GUI/scene_selection/scene_selection_menu.tscn" type="PackedScene" id=7] [sub_resource type="DynamicFont" id=1] @@ -619,6 +619,7 @@ _sections_unfolded = [ "Size Flags" ] [node name="Controles" type="VBoxContainer" parent="Menus/TabContainer" index="1"] +editor/display_folded = true visible = false anchor_left = 0.0 anchor_top = 0.0 @@ -1294,6 +1295,7 @@ _sections_unfolded = [ "Size Flags" ] [node name="Test" type="MarginContainer" parent="Menus/TabContainer" index="2"] +editor/display_folded = true visible = false anchor_left = 0.0 anchor_top = 0.0 @@ -1633,6 +1635,11 @@ edit_alpha = true margin_top = 323.0 margin_bottom = 446.0 +[node name="scene_selection" parent="Menus/TabContainer" index="3" instance=ExtResource( 7 )] + +visible = false +margin_top = 49.0 + [node name="Footer" type="HBoxContainer" parent="Menus" index="2"] anchor_left = 0.0 diff --git a/gui_scene/GUI/scene_selection/scene_selection_menu.tscn b/gui_scene/GUI/scene_selection/scene_selection_menu.tscn new file mode 100644 index 0000000..952c884 --- /dev/null +++ b/gui_scene/GUI/scene_selection/scene_selection_menu.tscn @@ -0,0 +1,258 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://gui_scene/GUI/scene_selection/select_scene_button.gd" type="Script" id=1] + +[node name="scene_selection_menu" type="Control" index="0"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 0 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 1 + +[node name="scenes_box" type="CenterContainer" parent="." index="0"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 0 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 1 +use_top_left = false + +[node name="scenes" type="VBoxContainer" parent="scenes_box" index="0"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 441.0 +margin_top = 266.0 +margin_right = 583.0 +margin_bottom = 334.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 1 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 7 +size_flags_vertical = 7 +alignment = 0 +_sections_unfolded = [ "Size Flags" ] + +[node name="main_scene" type="HBoxContainer" parent="scenes_box/scenes" index="0"] + +editor/display_folded = true +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_right = 142.0 +margin_bottom = 20.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 1 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 1 +alignment = 0 + +[node name="label" type="Label" parent="scenes_box/scenes/main_scene" index="0"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_top = 3.0 +margin_right = 87.0 +margin_bottom = 17.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 2 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 3 +size_flags_vertical = 4 +text = "Main scene" +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 +_sections_unfolded = [ "Size Flags" ] + +[node name="select_scene_button" type="Button" parent="scenes_box/scenes/main_scene" index="1"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 91.0 +margin_right = 142.0 +margin_bottom = 20.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +focus_mode = 2 +mouse_filter = 0 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 9 +size_flags_vertical = 1 +toggle_mode = false +enabled_focus_mode = 2 +shortcut = null +group = null +text = "select" +flat = false +align = 1 +script = ExtResource( 1 ) +_sections_unfolded = [ "Size Flags" ] +scene_path = "res://game_scene/Game/Game.tscn" +start_position_path = "start_position" + +[node name="test_grid_map" type="HBoxContainer" parent="scenes_box/scenes" index="1"] + +editor/display_folded = true +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_top = 24.0 +margin_right = 142.0 +margin_bottom = 44.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 1 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 1 +alignment = 0 +_sections_unfolded = [ "Size Flags" ] + +[node name="label" type="Label" parent="scenes_box/scenes/test_grid_map" index="0"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_top = 3.0 +margin_right = 87.0 +margin_bottom = 17.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 2 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 3 +size_flags_vertical = 4 +text = "Test grid map" +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 +_sections_unfolded = [ "Size Flags" ] + +[node name="select_scene_button" type="Button" parent="scenes_box/scenes/test_grid_map" index="1"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 91.0 +margin_right = 142.0 +margin_bottom = 20.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +focus_mode = 2 +mouse_filter = 0 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 9 +size_flags_vertical = 1 +toggle_mode = false +enabled_focus_mode = 2 +shortcut = null +group = null +text = "select" +flat = false +align = 1 +script = ExtResource( 1 ) +_sections_unfolded = [ "Size Flags" ] +scene_path = "res://dispensaire_gridmap/dispensaire_gridmap.tscn" +start_position_path = "start_position" + +[node name="test_scenes" type="HBoxContainer" parent="scenes_box/scenes" index="2"] + +editor/display_folded = true +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_top = 48.0 +margin_right = 142.0 +margin_bottom = 68.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 1 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 1 +alignment = 0 + +[node name="label" type="Label" parent="scenes_box/scenes/test_scenes" index="0"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_top = 3.0 +margin_right = 87.0 +margin_bottom = 17.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 2 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 3 +size_flags_vertical = 4 +text = "Test scenes" +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 +_sections_unfolded = [ "Size Flags" ] + +[node name="select_scene_button" type="Button" parent="scenes_box/scenes/test_scenes" index="1"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 91.0 +margin_right = 142.0 +margin_bottom = 20.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +focus_mode = 2 +mouse_filter = 0 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 9 +size_flags_vertical = 1 +toggle_mode = false +enabled_focus_mode = 2 +shortcut = null +group = null +text = "select" +flat = false +align = 1 +script = ExtResource( 1 ) +_sections_unfolded = [ "Size Flags" ] +scene_path = "res://dispensaire_scenes/dispensaire_scenes.tscn" +start_position_path = "start_position" + +[connection signal="pressed" from="scenes_box/scenes/main_scene/select_scene_button" to="scenes_box/scenes/main_scene/select_scene_button" method="_on_select_scene_button_pressed"] + +[connection signal="pressed" from="scenes_box/scenes/test_grid_map/select_scene_button" to="scenes_box/scenes/test_grid_map/select_scene_button" method="_on_select_scene_button_pressed"] + +[connection signal="pressed" from="scenes_box/scenes/test_scenes/select_scene_button" to="scenes_box/scenes/test_scenes/select_scene_button" method="_on_select_scene_button_pressed"] + + diff --git a/gui_scene/GUI/scene_selection/select_scene_button.gd b/gui_scene/GUI/scene_selection/select_scene_button.gd new file mode 100644 index 0000000..c3d67d9 --- /dev/null +++ b/gui_scene/GUI/scene_selection/select_scene_button.gd @@ -0,0 +1,10 @@ +extends Button + +export( String ) var scene_path = null +export( String ) var start_position_path = "start_position" + + + +func _on_select_scene_button_pressed(): + if scene_path and not scene_path == "": + global.change_level( "game", scene_path, null, global.current_map, start_position_path ) diff --git a/login_scene/login_scene.tscn b/login_scene/login_scene.tscn index cdb55ec..b31d4b4 100644 --- a/login_scene/login_scene.tscn +++ b/login_scene/login_scene.tscn @@ -4,7 +4,7 @@ [ext_resource path="res://login_scene/character_selection_menu.tscn" type="PackedScene" id=2] [ext_resource path="res://gui_scene/GUI/login/login_menu.tscn" type="PackedScene" id=3] -[node name="login_scene" type="Node" index="0"] +[node name="login_scene" type="Node"] script = ExtResource( 1 )