diff --git a/EscapeMenu.cs b/Menu.cs similarity index 85% rename from EscapeMenu.cs rename to Menu.cs index 6941dd4..6667333 100644 --- a/EscapeMenu.cs +++ b/Menu.cs @@ -1,4 +1,4 @@ -public partial class EscapeMenu : CenterContainer +public partial class Menu : CenterContainer { [Export] public Container SideButtons { get; set; } [Export] public TabContainer Tabs { get; set; } @@ -11,6 +11,8 @@ public partial class EscapeMenu : CenterContainer for (var i = 0; i < Tabs.GetTabCount(); i++) if (Tabs.GetTabControl(i).Name == button.Name) Tabs.CurrentTab = i; + // Make sure you can't "detoggle" the button. + button.Disabled = true; }; } @@ -36,7 +38,7 @@ public partial class EscapeMenu : CenterContainer var tabName = Tabs.GetTabControl(tabIndex).Name; foreach (var child in SideButtons.GetChildren()) if ((child is BaseButton button) && button.ToggleMode) - button.ButtonPressed = button.Name == tabName; + button.Disabled = button.ButtonPressed = button.Name == tabName; } public void OnReturnPressed() diff --git a/MultiplayerMenu.cs b/MultiplayerMenu.cs new file mode 100644 index 0000000..adf8c86 --- /dev/null +++ b/MultiplayerMenu.cs @@ -0,0 +1,128 @@ +public partial class MultiplayerMenu : MarginContainer +{ + enum Status + { + Disconnected, + ConnectionFailed, + HostingFailed, + Connecting, + Connected, + Hosting, + } + + Status _status = Status.Disconnected; + + [Export] public Label StatusLabel { get; set; } + + [ExportGroup("When Disconnected")] + [Export] public Container WhenDisconnected { get; set; } + [Export] public LineEdit AddressInput { get; set; } + [Export] public SpinBox PortInput { get; set; } + [Export] public Button ConnectButton { get; set; } + [Export] public Button HostButton { get; set; } + + [ExportGroup("When Server")] + [Export] public Container WhenServer { get; set; } + [Export] public LineEdit PortDisplay { get; set; } + + [ExportGroup("When Connected")] + [Export] public Container WhenConnected { get; set; } + [Export] public Label PlayersLabel { get; set; } + [Export] public Button DisconnectButton { get; set; } + + public override void _Ready() + { + PortDisplay.AddThemeColorOverride("font_uneditable_color", PortDisplay.GetThemeColor("font_color")); + + Multiplayer.ConnectedToServer += () => UpdateStatus(Status.Connected); + Multiplayer.ConnectionFailed += () => UpdateStatus(Status.ConnectionFailed); + Multiplayer.ServerDisconnected += () => UpdateStatus(Status.Disconnected); + + Multiplayer.PeerConnected += (_) => UpdatePlayerCount(); + Multiplayer.PeerDisconnected += (_) => UpdatePlayerCount(); + } + + void UpdateStatus(Status status) + { + _status = status; + + StatusLabel.Text = status switch { + Status.Disconnected => "Disconnected", + Status.ConnectionFailed => "Connection failed!", + Status.HostingFailed => "Hosting failed!", + Status.Connecting => "Connecting ...", + Status.Connected => "Connected", + Status.Hosting => "Hosting", + _ => throw new InvalidOperationException(), + }; + StatusLabel.LabelSettings.FontColor = (status switch { + Status.Disconnected => Colors.DarkGray, + Status.ConnectionFailed => Colors.Red, + Status.HostingFailed => Colors.Red, + Status.Connecting => Colors.Yellow, + Status.Connected => Colors.Green, + Status.Hosting => Colors.Green, + _ => throw new InvalidOperationException(), + }).Lerp(StatusLabel.GetThemeColor("font_color"), 0.5f); + + WhenDisconnected.Visible = status < Status.Connecting; + WhenServer.Visible = status == Status.Hosting; + WhenConnected.Visible = status >= Status.Connecting; + DisconnectButton.Text = status == Status.Hosting ? "Close Server" : "Disconnect"; + + UpdatePlayerCount(); + } + + void UpdatePlayerCount() + { + PlayersLabel.Text = _status switch { + < Status.Connecting => "Singleplayer", + Status.Connecting => "??? Players", + > Status.Connecting => ((Func)(() => { + var players = Multiplayer.GetPeers().Length + 1; + return $"{players} {(players != 1 ? "Players" : "Player")}"; + }))(), + }; + } + + public void OnShowAddressToggled(bool toggledOn) + { + AddressInput.Secret = !toggledOn; + AddressInput.VirtualKeyboardType = toggledOn + ? LineEdit.VirtualKeyboardTypeEnum.Default + : LineEdit.VirtualKeyboardTypeEnum.Password; + } + + public void OnConnectPressed() + { + var address = AddressInput.Text; + if (address == "") address = AddressInput.PlaceholderText; + var port = RoundToInt(PortInput.Value); + + var peer = new ENetMultiplayerPeer(); + peer.CreateClient(address, port); + Multiplayer.MultiplayerPeer = peer; + UpdateStatus(Status.Connecting); + } + + public void OnHostPressed() + { + var port = RoundToInt(PortInput.Value); + PortDisplay.Text = port.ToString(); + + var peer = new ENetMultiplayerPeer(); + if (peer.CreateServer(port) == Error.Ok) { + Multiplayer.MultiplayerPeer = peer; + UpdateStatus(Status.Hosting); + } else { + UpdateStatus(Status.HostingFailed); + } + } + + public void OnDisconnectPressed() + { + Multiplayer.MultiplayerPeer.Close(); + Multiplayer.MultiplayerPeer = null; + UpdateStatus(Status.Disconnected); + } +} diff --git a/escape_menu.tscn b/escape_menu.tscn deleted file mode 100644 index a61ef2f..0000000 --- a/escape_menu.tscn +++ /dev/null @@ -1,92 +0,0 @@ -[gd_scene load_steps=3 format=3 uid="uid://c5ooi36ibspfo"] - -[ext_resource type="Script" path="res://EscapeMenu.cs" id="1_5qxrt"] - -[sub_resource type="LabelSettings" id="LabelSettings_u8eqm"] -font_size = 22 - -[node name="EscapeMenu" type="CenterContainer" node_paths=PackedStringArray("SideButtons", "Tabs")] -offset_right = 562.0 -offset_bottom = 404.0 -mouse_filter = 0 -script = ExtResource("1_5qxrt") -SideButtons = NodePath("PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons") -Tabs = NodePath("PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer") - -[node name="PanelContainer" type="PanelContainer" parent="."] -layout_mode = 2 - -[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"] -layout_mode = 2 -theme_override_constants/margin_left = 10 -theme_override_constants/margin_top = 4 -theme_override_constants/margin_right = 10 -theme_override_constants/margin_bottom = 10 - -[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"] -layout_mode = 2 - -[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer"] -layout_mode = 2 -text = "Escape Menu" -label_settings = SubResource("LabelSettings_u8eqm") -horizontal_alignment = 1 - -[node name="GridContainer" type="GridContainer" parent="PanelContainer/MarginContainer/VBoxContainer"] -layout_mode = 2 -theme_override_constants/h_separation = 6 -theme_override_constants/v_separation = 6 -columns = 2 - -[node name="SideButtons" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer"] -custom_minimum_size = Vector2(160, 0) -layout_mode = 2 - -[node name="Gameplay" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons"] -layout_mode = 2 -toggle_mode = true -button_pressed = true -text = "Gameplay" - -[node name="Multiplayer" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons"] -layout_mode = 2 -toggle_mode = true -text = "Multiplayer" - -[node name="TabContainer" type="TabContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer"] -custom_minimum_size = Vector2(400, 300) -layout_mode = 2 -size_flags_vertical = 3 -tabs_visible = false - -[node name="Gameplay" type="CenterContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer"] -layout_mode = 2 - -[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Gameplay"] -layout_mode = 2 -text = "Gameplay -(nothing here yet)" -horizontal_alignment = 1 - -[node name="Multiplayer" type="CenterContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer"] -visible = false -layout_mode = 2 - -[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer"] -layout_mode = 2 -text = "Multiplayer -(nothing here yet)" -horizontal_alignment = 1 - -[node name="Quit" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer"] -layout_mode = 2 -text = "Quit to Desktop" - -[node name="Return" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer"] -layout_mode = 2 -text = "Return to Game -" - -[connection signal="tab_changed" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer" to="." method="OnTabChanged"] -[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/Quit" to="." method="OnQuitPressed"] -[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/Return" to="." method="OnReturnPressed"] diff --git a/menu.tscn b/menu.tscn new file mode 100644 index 0000000..7dc4588 --- /dev/null +++ b/menu.tscn @@ -0,0 +1,284 @@ +[gd_scene load_steps=8 format=3 uid="uid://c5ooi36ibspfo"] + +[ext_resource type="Script" path="res://Menu.cs" id="1_5qxrt"] +[ext_resource type="Script" path="res://MultiplayerMenu.cs" id="2_3ulcb"] + +[sub_resource type="LabelSettings" id="LabelSettings_u8eqm"] +font_size = 22 + +[sub_resource type="LabelSettings" id="LabelSettings_nmchh"] +font_color = Color(0.75, 0.75, 0.75, 1) + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ulror"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_fwm45"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_2rjy4"] + +[node name="Menu" type="CenterContainer" node_paths=PackedStringArray("SideButtons", "Tabs")] +offset_right = 586.0 +offset_bottom = 386.0 +mouse_filter = 0 +script = ExtResource("1_5qxrt") +SideButtons = NodePath("PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons") +Tabs = NodePath("PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer") + +[node name="PanelContainer" type="PanelContainer" parent="."] +layout_mode = 2 + +[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"] +layout_mode = 2 +theme_override_constants/margin_left = 10 +theme_override_constants/margin_top = 4 +theme_override_constants/margin_right = 10 +theme_override_constants/margin_bottom = 10 + +[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"] +layout_mode = 2 + +[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer"] +layout_mode = 2 +text = "Menu" +label_settings = SubResource("LabelSettings_u8eqm") +horizontal_alignment = 1 + +[node name="GridContainer" type="GridContainer" parent="PanelContainer/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/h_separation = 6 +theme_override_constants/v_separation = 6 +columns = 2 + +[node name="SideButtons" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer"] +custom_minimum_size = Vector2(160, 0) +layout_mode = 2 + +[node name="Gameplay" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons"] +layout_mode = 2 +toggle_mode = true +text = "Gameplay" + +[node name="Multiplayer" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons"] +layout_mode = 2 +toggle_mode = true +text = "Multiplayer" + +[node name="Controls" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons"] +layout_mode = 2 +toggle_mode = true +text = "Controls" + +[node name="Graphics" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons"] +layout_mode = 2 +toggle_mode = true +text = "Graphics" + +[node name="Audio" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons"] +layout_mode = 2 +toggle_mode = true +text = "Audio" + +[node name="TabContainer" type="TabContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer"] +custom_minimum_size = Vector2(400, 300) +layout_mode = 2 +size_flags_vertical = 3 +current_tab = 1 +tabs_visible = false +use_hidden_tabs_for_min_size = true + +[node name="Gameplay" type="CenterContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer"] +visible = false +layout_mode = 2 + +[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Gameplay"] +layout_mode = 2 +text = "Gameplay +(nothing here yet)" +horizontal_alignment = 1 + +[node name="Multiplayer" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer" node_paths=PackedStringArray("StatusLabel", "WhenDisconnected", "AddressInput", "PortInput", "ConnectButton", "HostButton", "WhenServer", "PortDisplay", "WhenConnected", "PlayersLabel", "DisconnectButton")] +layout_mode = 2 +theme_override_constants/margin_left = 8 +theme_override_constants/margin_top = 8 +theme_override_constants/margin_right = 8 +theme_override_constants/margin_bottom = 8 +script = ExtResource("2_3ulcb") +StatusLabel = NodePath("VBoxContainer/HBoxContainer/Status") +WhenDisconnected = NodePath("VBoxContainer/WhenDisconnected") +AddressInput = NodePath("VBoxContainer/WhenDisconnected/GridContainer/Address") +PortInput = NodePath("VBoxContainer/WhenDisconnected/GridContainer/Port") +ConnectButton = NodePath("VBoxContainer/WhenDisconnected/HBoxContainer/Connect") +HostButton = NodePath("VBoxContainer/WhenDisconnected/HBoxContainer/Host") +WhenServer = NodePath("VBoxContainer/WhenServer") +PortDisplay = NodePath("VBoxContainer/WhenServer/HBoxContainer/Port") +WhenConnected = NodePath("VBoxContainer/WhenConnected") +PlayersLabel = NodePath("VBoxContainer/WhenConnected/HBoxContainer/Players") +DisconnectButton = NodePath("VBoxContainer/WhenConnected/Disconnect") + +[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer"] +layout_mode = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer"] +layout_mode = 2 + +[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/HBoxContainer"] +custom_minimum_size = Vector2(80, 0) +layout_mode = 2 +text = "Status: " +horizontal_alignment = 2 + +[node name="Status" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Disconnected" +label_settings = SubResource("LabelSettings_nmchh") +horizontal_alignment = 1 + +[node name="WhenDisconnected" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer"] +layout_mode = 2 + +[node name="GridContainer" type="GridContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenDisconnected"] +layout_mode = 2 +columns = 3 + +[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenDisconnected/GridContainer"] +layout_mode = 2 +text = "Address" +horizontal_alignment = 1 + +[node name="Control" type="Control" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenDisconnected/GridContainer"] +layout_mode = 2 + +[node name="Label2" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenDisconnected/GridContainer"] +layout_mode = 2 +text = "Port" +horizontal_alignment = 1 + +[node name="Address" type="LineEdit" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenDisconnected/GridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +placeholder_text = "localhost" +virtual_keyboard_type = 6 +secret = true + +[node name="Label3" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenDisconnected/GridContainer"] +layout_mode = 2 +text = ":" + +[node name="Port" type="SpinBox" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenDisconnected/GridContainer"] +layout_mode = 2 +min_value = 1024.0 +max_value = 65535.0 +value = 9713.0 +rounded = true +alignment = 2 + +[node name="ShowAddress" type="CheckButton" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenDisconnected"] +layout_mode = 2 +text = "Show Server Address" + +[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenDisconnected"] +layout_mode = 2 + +[node name="Connect" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenDisconnected/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Connect to Server" + +[node name="Host" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenDisconnected/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Host Server" + +[node name="WhenServer" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer"] +visible = false +layout_mode = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenServer"] +layout_mode = 2 + +[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenServer/HBoxContainer"] +custom_minimum_size = Vector2(80, 0) +layout_mode = 2 +text = "Port: " +horizontal_alignment = 2 + +[node name="Port" type="LineEdit" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenServer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +theme_override_styles/normal = SubResource("StyleBoxEmpty_ulror") +theme_override_styles/focus = SubResource("StyleBoxEmpty_fwm45") +theme_override_styles/read_only = SubResource("StyleBoxEmpty_2rjy4") +text = "9713" +alignment = 1 +editable = false + +[node name="WhenConnected" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer"] +visible = false +layout_mode = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenConnected"] +layout_mode = 2 + +[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenConnected/HBoxContainer"] +custom_minimum_size = Vector2(80, 0) +layout_mode = 2 +text = "Players: " +horizontal_alignment = 2 + +[node name="Players" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenConnected/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Singleplayer" +horizontal_alignment = 1 + +[node name="Disconnect" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenConnected"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Disconnect" + +[node name="Controls" type="CenterContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer"] +visible = false +layout_mode = 2 + +[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Controls"] +layout_mode = 2 +text = "Controls +(nothing here yet)" +horizontal_alignment = 1 + +[node name="Graphics" type="CenterContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer"] +visible = false +layout_mode = 2 + +[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Graphics"] +layout_mode = 2 +text = "Graphics +(nothing here yet)" +horizontal_alignment = 1 + +[node name="Audio" type="CenterContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer"] +visible = false +layout_mode = 2 + +[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Audio"] +layout_mode = 2 +text = "Audio +(nothing here yet)" +horizontal_alignment = 1 + +[node name="Quit" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer"] +layout_mode = 2 +text = "Quit to Desktop" + +[node name="Return" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer"] +layout_mode = 2 +text = "Return to Game +" + +[connection signal="tab_changed" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer" to="." method="OnTabChanged"] +[connection signal="toggled" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenDisconnected/ShowAddress" to="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer" method="OnShowAddressToggled"] +[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenDisconnected/HBoxContainer/Connect" to="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer" method="OnConnectPressed"] +[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenDisconnected/HBoxContainer/Host" to="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer" method="OnHostPressed"] +[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenConnected/Disconnect" to="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer" method="OnDisconnectPressed"] +[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/Quit" to="." method="OnQuitPressed"] +[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/Return" to="." method="OnReturnPressed"] diff --git a/scenes/game.tscn b/scenes/game.tscn index 1a609ae..0899aee 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -4,7 +4,7 @@ [ext_resource type="Shader" path="res://assets/shaders/outline.gdshader" id="2_yvnqw"] [ext_resource type="Script" path="res://scripts/OutlineCamera.cs" id="3_wd8hf"] [ext_resource type="Texture2D" uid="uid://lxxfestfg2dt" path="res://assets/crosshair.png" id="4_06ang"] -[ext_resource type="PackedScene" uid="uid://c5ooi36ibspfo" path="res://escape_menu.tscn" id="4_77nbu"] +[ext_resource type="PackedScene" uid="uid://c5ooi36ibspfo" path="res://menu.tscn" id="4_77nbu"] [ext_resource type="Script" path="res://scripts/Crosshair.cs" id="5_i8gkf"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_ke1l3"] @@ -45,7 +45,7 @@ grow_horizontal = 2 grow_vertical = 2 mouse_filter = 2 -[node name="EscapeMenu" parent="HUD" instance=ExtResource("4_77nbu")] +[node name="Menu" parent="HUD" instance=ExtResource("4_77nbu")] visible = false layout_mode = 1 anchors_preset = 15