From 973433754710f3f748cc11cbb1d3401841b7e623 Mon Sep 17 00:00:00 2001 From: Luna Date: Sat, 24 Feb 2018 22:08:08 -0500 Subject: [PATCH] Change lobby interface to better match new model --- scenes/lobby.tscn | 530 +++++++++++++++++++++++++++++++++--------------------- scripts/lobby.gd | 68 +++---- 2 files changed, 356 insertions(+), 242 deletions(-) diff --git a/scenes/lobby.tscn b/scenes/lobby.tscn index 8b44ab9..92187e5 100644 --- a/scenes/lobby.tscn +++ b/scenes/lobby.tscn @@ -29,7 +29,7 @@ use_filter = false font_data = SubResource( 3 ) _sections_unfolded = [ "Font", "Resource", "Settings" ] -[node name="Control" type="Control"] +[node name="Lobby" type="Control" index="0"] anchor_left = 0.0 anchor_top = 0.0 @@ -69,16 +69,31 @@ lines_skipped = 0 max_lines_visible = -1 _sections_unfolded = [ "custom_fonts" ] -[node name="Server" type="Button" parent="." index="1"] +[node name="GameBrowser" type="Control" parent="." index="1"] +editor/display_folded = true anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 7.0 -margin_top = -9.0 -margin_right = 159.0 -margin_bottom = 46.0 +margin_right = 40.0 +margin_bottom = 40.0 +rect_pivot_offset = Vector2( 0, 0 ) +mouse_filter = 0 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 1 + +[node name="Play" type="Button" parent="GameBrowser" index="0"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 9.0 +margin_top = -2.0 +margin_right = 405.0 +margin_bottom = 53.0 rect_pivot_offset = Vector2( 0, 0 ) focus_mode = 2 mouse_filter = 0 @@ -89,45 +104,62 @@ toggle_mode = false enabled_focus_mode = 2 shortcut = null group = null -text = "Server" +text = "Just, Play!" flat = false align = 1 -[node name="ServerStart" type="Button" parent="." index="2"] +[node name="PickAGameLabel" type="Label" parent="GameBrowser" index="1"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 166.0 -margin_top = -10.0 -margin_right = 279.0 -margin_bottom = 45.0 +margin_left = 10.0 +margin_top = 65.0 +margin_right = 114.0 +margin_bottom = 79.0 rect_pivot_offset = Vector2( 0, 0 ) +mouse_filter = 2 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 4 +text = "Or, pick a game:" +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + +[node name="GameList" type="ItemList" parent="GameBrowser" index="2"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 8.0 +margin_top = 87.0 +margin_right = 411.0 +margin_bottom = 208.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = true focus_mode = 2 mouse_filter = 0 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 1 -toggle_mode = false -enabled_focus_mode = 2 -shortcut = null -group = null -text = "Start game" -flat = false -align = 1 -_sections_unfolded = [ "Visibility" ] +items = [ "No Games Running", null, false ] +select_mode = 0 +icon_mode = 1 +fixed_icon_size = Vector2( 0, 0 ) -[node name="LevelSelect" type="OptionButton" parent="ServerStart" index="0"] +[node name="Join" type="Button" parent="GameBrowser" index="3"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 123.0 -margin_top = 1.0 -margin_right = 238.0 -margin_bottom = 53.0 +margin_left = 9.0 +margin_top = 217.0 +margin_right = 163.0 +margin_bottom = 244.0 rect_pivot_offset = Vector2( 0, 0 ) focus_mode = 2 mouse_filter = 0 @@ -135,94 +167,81 @@ mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 1 toggle_mode = false -action_mode = 0 enabled_focus_mode = 2 shortcut = null group = null -text = "Platform map" +text = "Join Selected Game" flat = false -align = 0 -selected = 0 -items = [ "Platform map", null, false, 0, null, "City-like thing", null, false, 1, null, "Slide", null, false, 2, null ] +align = 1 -[node name="HSeparator" type="HSeparator" parent="." index="3"] +[node name="VSeparator" type="VSeparator" parent="." index="2"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 10.0 -margin_top = 61.0 -margin_right = 408.0 -margin_bottom = 65.0 +margin_left = 431.0 +margin_top = -3.0 +margin_right = 436.0 +margin_bottom = 234.0 rect_pivot_offset = Vector2( 0, 0 ) mouse_filter = 0 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 1 -[node name="Client" type="Button" parent="." index="4"] +[node name="PlayerSettings" type="Control" parent="." index="3"] +editor/display_folded = true anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 10.0 -margin_top = 76.0 -margin_right = 159.0 -margin_bottom = 133.0 +margin_right = 40.0 +margin_bottom = 40.0 rect_pivot_offset = Vector2( 0, 0 ) -focus_mode = 2 mouse_filter = 0 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 1 -toggle_mode = false -enabled_focus_mode = 2 -shortcut = null -group = null -text = "Client" -flat = false -align = 1 -[node name="IPLabel" type="Label" parent="." index="5"] +[node name="PlayerSettingsLabel" type="Label" parent="PlayerSettings" index="0"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 178.0 -margin_top = 85.0 -margin_right = 203.0 -margin_bottom = 101.0 +margin_left = 459.0 +margin_top = -6.0 +margin_right = 564.0 +margin_bottom = 13.0 rect_pivot_offset = Vector2( 0, 0 ) mouse_filter = 2 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 4 -text = "IP:" +text = "Player Settings" percent_visible = 1.0 lines_skipped = 0 max_lines_visible = -1 -_sections_unfolded = [ "Visibility" ] -[node name="IP" type="TextEdit" parent="." index="6"] +[node name="Username" type="TextEdit" parent="PlayerSettings" index="1"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 207.0 -margin_top = 83.0 -margin_right = 405.0 -margin_bottom = 101.0 +margin_left = 457.0 +margin_top = 27.0 +margin_right = 636.0 +margin_bottom = 47.0 rect_pivot_offset = Vector2( 0, 0 ) focus_mode = 2 mouse_filter = 0 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 1 -text = "127.0.0.1" +text = "Nickname" readonly = false highlight_current_line = false syntax_highlighting = false @@ -239,189 +258,253 @@ caret_blink = false caret_blink_speed = 0.65 caret_moving_by_right_click = true -[node name="ForceStart" type="CheckBox" parent="." index="7"] +[node name="HeroSelectLabel" type="Label" parent="PlayerSettings" index="2"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 172.0 -margin_top = 111.0 -margin_right = 196.0 -margin_bottom = 135.0 +margin_left = 460.0 +margin_top = 66.0 +margin_right = 538.0 +margin_bottom = 80.0 +rect_pivot_offset = Vector2( 0, 0 ) +mouse_filter = 2 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 4 +text = "Hero Select:" +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + +[node name="HeroSelect" type="OptionButton" parent="PlayerSettings" index="3"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 457.0 +margin_top = 94.0 +margin_right = 645.0 +margin_bottom = 114.0 +rect_rotation = -0.0115615 rect_pivot_offset = Vector2( 0, 0 ) focus_mode = 2 mouse_filter = 0 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 1 -toggle_mode = true +toggle_mode = false +action_mode = 0 enabled_focus_mode = 2 shortcut = null group = null flat = false align = 0 +selected = -1 +items = [ ] +script = ExtResource( 2 ) -[node name="ForceStartLabel" type="Label" parent="ForceStart" index="0"] +[node name="TeamLabel" type="Label" parent="PlayerSettings" index="4"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 29.0 -margin_top = 5.0 -margin_right = 69.0 -margin_bottom = 19.0 +margin_left = 459.0 +margin_top = 132.0 +margin_right = 558.0 +margin_bottom = 146.0 rect_pivot_offset = Vector2( 0, 0 ) mouse_filter = 2 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 4 -text = "Force game to start" +text = "Assigned team:" percent_visible = 1.0 lines_skipped = 0 max_lines_visible = -1 -[node name="HSeparator2" type="HSeparator" parent="." index="8"] +[node name="Team" type="Label" parent="PlayerSettings" index="5"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 13.0 -margin_top = 154.0 -margin_right = 411.0 -margin_bottom = 158.0 +margin_left = 460.0 +margin_top = 157.0 +margin_right = 500.0 +margin_bottom = 171.0 +rect_pivot_offset = Vector2( 0, 0 ) +mouse_filter = 2 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 4 +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + +[node name="HeroDescriptionLabel" type="Label" parent="PlayerSettings" index="6"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 677.0 +margin_top = -5.0 +margin_right = 790.0 +margin_bottom = 9.0 +rect_pivot_offset = Vector2( 0, 0 ) +mouse_filter = 2 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 4 +text = "Hero Description:" +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + +[node name="HeroDescription" type="RichTextLabel" parent="PlayerSettings" index="7"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 675.0 +margin_top = 15.0 +margin_right = 918.0 +margin_bottom = 245.0 rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = true mouse_filter = 0 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 1 +bbcode_enabled = false +bbcode_text = "" +visible_characters = -1 +percent_visible = 1.0 +meta_underlined = true +tab_size = 4 +text = "" +scroll_active = true +scroll_following = false +selection_enabled = false +override_selected_font_color = false -[node name="Singleplayer" type="Button" parent="." index="9"] +[node name="HSeparator3" type="HSeparator" parent="." index="4"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 12.0 -margin_top = 174.0 -margin_right = 159.0 -margin_bottom = 237.0 +margin_left = 19.0 +margin_top = 271.0 +margin_right = 645.0 +margin_bottom = 275.0 rect_pivot_offset = Vector2( 0, 0 ) -focus_mode = 2 mouse_filter = 0 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 1 -toggle_mode = false -enabled_focus_mode = 2 -shortcut = null -group = null -text = "Singleplayer" -flat = false -align = 1 -[node name="VSeparator" type="VSeparator" parent="." index="10"] +[node name="CustomGame" type="Control" parent="." index="5"] +editor/display_folded = true anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 431.0 -margin_top = -3.0 -margin_right = 435.0 -margin_bottom = 110.0 +margin_right = 40.0 +margin_bottom = 40.0 rect_pivot_offset = Vector2( 0, 0 ) mouse_filter = 0 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 1 -[node name="Label" type="Label" parent="." index="11"] +[node name="Label" type="Label" parent="CustomGame" index="0"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 459.0 -margin_top = -6.0 -margin_right = 564.0 -margin_bottom = 13.0 +margin_left = 671.0 +margin_top = 275.0 +margin_right = 874.0 +margin_bottom = 289.0 rect_pivot_offset = Vector2( 0, 0 ) mouse_filter = 2 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 4 -text = "Player Settings" +text = "Or, host or join a custom game:" percent_visible = 1.0 lines_skipped = 0 max_lines_visible = -1 -[node name="Username" type="TextEdit" parent="." index="12"] +[node name="Server" type="Button" parent="CustomGame" index="1"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 457.0 -margin_top = 27.0 -margin_right = 636.0 -margin_bottom = 47.0 +margin_left = 665.0 +margin_top = 300.0 +margin_right = 752.0 +margin_bottom = 335.0 rect_pivot_offset = Vector2( 0, 0 ) focus_mode = 2 mouse_filter = 0 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 1 -text = "Nickname" -readonly = false -highlight_current_line = false -syntax_highlighting = false -show_line_numbers = false -highlight_all_occurrences = false -override_selected_font_color = false -context_menu_enabled = true -smooth_scrolling = false -v_scroll_speed = 80.0 -hiding_enabled = 0 -wrap_lines = false -caret_block_mode = false -caret_blink = false -caret_blink_speed = 0.65 -caret_moving_by_right_click = true +toggle_mode = false +enabled_focus_mode = 2 +shortcut = null +group = null +text = "Server" +flat = false +align = 1 -[node name="HeroSelectLabel" type="Label" parent="." index="13"] +[node name="LevelSelect" type="OptionButton" parent="CustomGame" index="2"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 460.0 -margin_top = 66.0 -margin_right = 538.0 -margin_bottom = 80.0 +margin_left = 770.0 +margin_top = 300.0 +margin_right = 895.0 +margin_bottom = 335.0 rect_pivot_offset = Vector2( 0, 0 ) -mouse_filter = 2 +focus_mode = 2 +mouse_filter = 0 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 -size_flags_vertical = 4 -text = "Hero Select:" -percent_visible = 1.0 -lines_skipped = 0 -max_lines_visible = -1 +size_flags_vertical = 1 +toggle_mode = false +action_mode = 0 +enabled_focus_mode = 2 +shortcut = null +group = null +text = "Platform map" +flat = false +align = 0 +selected = 0 +items = [ "Platform map", null, false, 0, null, "City-like thing", null, false, 1, null, "Slide", null, false, 2, null ] -[node name="HeroSelect" type="OptionButton" parent="." index="14"] +[node name="Client" type="Button" parent="CustomGame" index="3"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 457.0 -margin_top = 94.0 -margin_right = 645.0 -margin_bottom = 114.0 -rect_rotation = -0.0115615 +margin_left = 667.0 +margin_top = 354.0 +margin_right = 753.0 +margin_bottom = 393.0 rect_pivot_offset = Vector2( 0, 0 ) focus_mode = 2 mouse_filter = 0 @@ -429,81 +512,133 @@ mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 1 toggle_mode = false -action_mode = 0 enabled_focus_mode = 2 shortcut = null group = null +text = "Client" flat = false -align = 0 -selected = -1 -items = [ ] -script = ExtResource( 2 ) +align = 1 -[node name="TeamLabel" type="Label" parent="." index="15"] +[node name="IPLabel" type="Label" parent="CustomGame" index="4"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 459.0 -margin_top = 132.0 -margin_right = 558.0 -margin_bottom = 146.0 +margin_left = 673.0 +margin_top = 403.0 +margin_right = 698.0 +margin_bottom = 419.0 rect_pivot_offset = Vector2( 0, 0 ) mouse_filter = 2 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 4 -text = "Assigned team:" +text = "IP:" percent_visible = 1.0 lines_skipped = 0 max_lines_visible = -1 +_sections_unfolded = [ "Visibility" ] -[node name="Team" type="Label" parent="." index="16"] +[node name="IP" type="TextEdit" parent="CustomGame" index="5"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 460.0 -margin_top = 157.0 -margin_right = 500.0 -margin_bottom = 171.0 +margin_left = 707.0 +margin_top = 401.0 +margin_right = 851.0 +margin_bottom = 419.0 rect_pivot_offset = Vector2( 0, 0 ) -mouse_filter = 2 +focus_mode = 2 +mouse_filter = 0 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 -size_flags_vertical = 4 -percent_visible = 1.0 -lines_skipped = 0 -max_lines_visible = -1 +size_flags_vertical = 1 +text = "127.0.0.1" +readonly = false +highlight_current_line = false +syntax_highlighting = false +show_line_numbers = false +highlight_all_occurrences = false +override_selected_font_color = false +context_menu_enabled = true +smooth_scrolling = false +v_scroll_speed = 80.0 +hiding_enabled = 0 +wrap_lines = false +caret_block_mode = false +caret_blink = false +caret_blink_speed = 0.65 +caret_moving_by_right_click = true -[node name="HSeparator3" type="HSeparator" parent="." index="17"] +[node name="Singleplayer" type="Button" parent="CustomGame" index="6"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 19.0 -margin_top = 254.0 -margin_right = 645.0 -margin_bottom = 258.0 +margin_left = 668.0 +margin_top = 431.0 +margin_right = 760.0 +margin_bottom = 470.0 +rect_pivot_offset = Vector2( 0, 0 ) +focus_mode = 2 +mouse_filter = 0 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 1 +toggle_mode = false +enabled_focus_mode = 2 +shortcut = null +group = null +text = "Singleplayer" +flat = false +align = 1 + +[node name="VSeparator2" type="VSeparator" parent="." index="6"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 653.0 +margin_top = 273.0 +margin_right = 657.0 +margin_bottom = 467.0 +rect_pivot_offset = Vector2( 0, 0 ) +mouse_filter = 0 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 1 + +[node name="JoinedGameLobby" type="Control" parent="." index="7"] + +editor/display_folded = true +visible = false +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_right = 40.0 +margin_bottom = 40.0 rect_pivot_offset = Vector2( 0, 0 ) mouse_filter = 0 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 1 -[node name="PlayerListLabel" type="Label" parent="." index="18"] +[node name="PlayerListLabel" type="Label" parent="JoinedGameLobby" index="0"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 14.0 -margin_top = 270.0 +margin_top = 287.0 margin_right = 136.0 -margin_bottom = 284.0 +margin_bottom = 301.0 rect_pivot_offset = Vector2( 0, 0 ) mouse_filter = 2 mouse_default_cursor_shape = 0 @@ -514,16 +649,16 @@ percent_visible = 1.0 lines_skipped = 0 max_lines_visible = -1 -[node name="PlayerList" type="Label" parent="." index="19"] +[node name="PlayerList" type="Label" parent="JoinedGameLobby" index="1"] anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 margin_left = -7.0 -margin_top = 270.0 +margin_top = 287.0 margin_right = 639.0 -margin_bottom = 460.0 +margin_bottom = 433.0 rect_pivot_offset = Vector2( 0, 0 ) mouse_filter = 2 mouse_default_cursor_shape = 0 @@ -536,52 +671,29 @@ lines_skipped = 0 max_lines_visible = -1 _sections_unfolded = [ "BBCode", "custom_fonts" ] -[node name="HeroDescriptionLabel" type="Label" parent="." index="20"] - -anchor_left = 0.0 -anchor_top = 0.0 -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_left = 677.0 -margin_top = -5.0 -margin_right = 790.0 -margin_bottom = 9.0 -rect_pivot_offset = Vector2( 0, 0 ) -mouse_filter = 2 -mouse_default_cursor_shape = 0 -size_flags_horizontal = 1 -size_flags_vertical = 4 -text = "Hero Description:" -percent_visible = 1.0 -lines_skipped = 0 -max_lines_visible = -1 - -[node name="HeroDescription" type="RichTextLabel" parent="." index="21"] +[node name="StartGame" type="Button" parent="JoinedGameLobby" index="2"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 675.0 -margin_top = 15.0 -margin_right = 918.0 -margin_bottom = 245.0 +margin_left = 13.0 +margin_top = 443.0 +margin_right = 135.0 +margin_bottom = 483.0 rect_pivot_offset = Vector2( 0, 0 ) -rect_clip_content = true +focus_mode = 2 mouse_filter = 0 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 1 -bbcode_enabled = false -bbcode_text = "" -visible_characters = -1 -percent_visible = 1.0 -meta_underlined = true -tab_size = 4 -text = "" -scroll_active = true -scroll_following = false -selection_enabled = false -override_selected_font_color = false +toggle_mode = false +enabled_focus_mode = 2 +shortcut = null +group = null +text = "Start game" +flat = false +align = 1 +_sections_unfolded = [ "Visibility" ] diff --git a/scripts/lobby.gd b/scripts/lobby.gd index 090e073..e715538 100644 --- a/scripts/lobby.gd +++ b/scripts/lobby.gd @@ -5,11 +5,11 @@ extends "res://scripts/args.gd" # var b = "textvar" var SERVER_PORT = 2467 var MAX_PLAYERS = 10 -var SERVER_PLAYING = true var player_info = {} var my_info = {} var begun = false +var server_playing = true func setup_options(): var opts = Options.new() @@ -17,7 +17,7 @@ func setup_options(): opts.add('-singleplayer', false, 'Whether to run singeplayer, starting immediately') opts.add('-server', false, 'Whether to run as server') opts.add('-client', false, 'Immediately connect as client') - opts.add('-silent-server', false, 'If the server is not playing, merely serving') + opts.add('-silent', false, 'If the server is not playing, merely serving') opts.add('-hero', 'r', 'Your choice of hero (index)') opts.add('-level', 'r', 'Your choice of level (index) - server only!') opts.add('-start-game', false, 'Join as a client and immediately start the game') @@ -36,27 +36,30 @@ func option_sel(button_name, option): func _ready(): + my_info.version = [0,0,0] # Semantic versioning: [0].[1].[2] + randomize() - get_node("Server").connect("pressed", self, "_server_init") - get_node("ServerStart").connect("pressed", self, "start_game") - get_node("Client").connect("pressed", self, "_client_init") - get_node("Singleplayer").connect("pressed", self, "_singleplayer_init") - get_node("HeroSelect").connect("item_selected", self, "select_hero") - get_node("Username").connect("text_changed", self, "resend_name") + get_node("PlayerSettings/HeroSelect").connect("item_selected", self, "select_hero") + get_node("PlayerSettings/Username").connect("text_changed", self, "resend_name") + get_node("JoinedGameLobby/StartGame").connect("pressed", self, "start_game") + get_node("CustomGame/Server").connect("pressed", self, "_server_init") + get_node("CustomGame/Client").connect("pressed", self, "_client_init") + get_node("CustomGame/Singleplayer").connect("pressed", self, "_singleplayer_init") + get_node("CustomGame/LevelSelect").connect("item_selected", self, "select_level") var o = setup_options() o.parse() - if o.get_value("-silent-server"): - SERVER_PLAYING = false # TODO: Uncaps :( + if o.get_value("-silent"): + server_playing = false # TODO: Uncaps :( if o.get_value("-hero"): var hero = o.get_value("-hero") - option_sel("HeroSelect", hero) + option_sel("PlayerSettings/HeroSelect", hero) # For some reason, calling option_sel doesn't trigger the actual selection - select_hero(get_node("HeroSelect").get_selected_id()) + select_hero(get_node("PlayerSettings/HeroSelect").get_selected_id()) if o.get_value("-level"): - option_sel("ServerStart/LevelSelect", o.get_value("-level")) + option_sel("CustomGame/LevelSelect", o.get_value("-level")) if o.get_value("-server"): call_deferred("_server_init") if o.get_value("-client"): @@ -81,10 +84,10 @@ func _ready(): func _client_init(): collect_info() var peer = NetworkedMultiplayerENet.new() - var server_ip = get_node("IP").get_text() + var server_ip = get_node("CustomGame/IP").get_text() peer.create_client(server_ip, SERVER_PORT) get_tree().set_network_peer(peer) - get_node("Client").set_text("Clienting!") + get_node("CustomGame/Client").set_text("Clienting!") func _singleplayer_init(): collect_info() @@ -99,9 +102,9 @@ func _server_init(): var peer = NetworkedMultiplayerENet.new() peer.create_server(SERVER_PORT, MAX_PLAYERS) get_tree().set_network_peer(peer) - get_node("Server").set_text("Serving!") - get_node("ServerStart").show() - if SERVER_PLAYING: + get_node("CustomGame/Server").set_text("Serving!") + get_node("JoinedGameLobby").show() + if server_playing: player_info[1] = my_info func _player_connected(id): @@ -115,16 +118,15 @@ func _connected_ok(): rpc("register_player", get_tree().get_network_unique_id(), my_info) if "start_game" in my_info and my_info.start_game: rpc_id(1, "start_game") + get_node("JoinedGameLobby").show() func collect_info(): if not "username" in my_info: - my_info.username = get_node("Username").get_text() + my_info.username = get_node("PlayerSettings/Username").get_text() if not "hero" in my_info: - my_info.hero = get_node("HeroSelect").get_selected_id() + my_info.hero = get_node("PlayerSettings/HeroSelect").get_selected_id() if not "is_right_team" in my_info: my_info.is_right_team = false # Server assigns team, wait for that - if not "start_game" in my_info: - my_info.start_game = get_node("ForceStart").pressed remote func register_player(new_peer, info): player_info[new_peer] = info @@ -149,7 +151,7 @@ remote func register_player(new_peer, info): if not begun and player_info.size() == MAX_PLAYERS: start_game() if begun: - var level = get_node("ServerStart/LevelSelect").get_selected_id() + var level = get_node("CustomGame/LevelSelect").get_selected_id() rpc_id(new_peer, "pre_configure_game", level) rpc("spawn_player", new_peer) @@ -158,8 +160,8 @@ sync func unregister_player(peer): get_node("/root/Level/Players/%d" % peer).queue_free() func select_hero(hero): - var description = get_node("HeroSelect").hero_text[hero] - get_node("HeroDescription").set_text(description) + var description = get_node("PlayerSettings/HeroSelect").hero_text[hero] + get_node("PlayerSettings/HeroDescription").set_text(description) rpc("set_hero", get_tree().get_network_unique_id(), hero) sync func set_hero(peer, hero): @@ -167,7 +169,7 @@ sync func set_hero(peer, hero): render_player_list() func resend_name(): - var name = get_node("Username").get_text() + var name = get_node("PlayerSettings/Username").get_text() rpc("set_name", get_tree().get_network_unique_id(), name) sync func set_name(peer, name): @@ -178,14 +180,14 @@ sync func assign_team(peer, is_right_team): player_info[peer].is_right_team = is_right_team if peer == get_tree().get_network_unique_id(): if is_right_team: - get_node("Team").set_text("Right Team") + get_node("PlayerSettings/Team").set_text("Right Team") else: - get_node("Team").set_text("Left Team") + get_node("PlayerSettings/Team").set_text("Left Team") render_player_list() func render_player_list(): var list = "" - var hero_names = get_node("HeroSelect").hero_names + var hero_names = get_node("PlayerSettings/HeroSelect").hero_names for p in player_info: list += "%-15s" % player_info[p].username list += "%-20s" % hero_names[player_info[p].hero] @@ -194,11 +196,11 @@ func render_player_list(): else: list += "Left Team" list += "\n" - get_node("PlayerList").set_text(list) + get_node("JoinedGameLobby/PlayerList").set_text(list) sync func start_game(): begun = true - var level = get_node("ServerStart/LevelSelect").get_selected_id() + var level = get_node("CustomGame/LevelSelect").get_selected_id() rpc("pre_configure_game", level) var players_done = [] @@ -220,8 +222,8 @@ sync func pre_configure_game(level): var self_peer_id = get_tree().get_network_unique_id() # Remove the interface so as to not fuck with things - # But we still need the lobby (Control) alive to deal with networking! - for element in get_node("/root/Control").get_children(): + # But we still need the lobby alive to deal with networking! + for element in get_node("/root/Lobby").get_children(): element.queue_free() var world = load("res://scenes/levels/%d.tscn" % level).instance()