void Start() { Assert.IsNotNull(landButton); Assert.IsNotNull(restartButton); Assert.IsNotNull(leaveButton); sLeaveButton = leaveButton.GetComponent <LeaveButton>(); sRestartButton = restartButton.GetComponent <RestartButton>(); sLandButton = landButton.GetComponent <LandButton>(); mainMenuOn = false; showAllMainMenuElements(false); }
public override void _Ready() { GetTree().Connect("network_peer_connected", this, nameof(PlayerConnected)); GetTree().Connect("network_peer_disconnected", this, nameof(PlayerDisconnected)); GetTree().Connect("connected_to_server", this, nameof(ConnectedToServer)); GetTree().Connect("connection_failed", this, nameof(ConnectionFailed)); GetTree().Connect("server_disconnected", this, nameof(ServerDisconnected)); HostButton = (Button)GetNode("MarginContainer/VBoxContainer/HostGameButton"); HostButton.Connect("pressed", this, nameof(HostGame)); JoinButton = (Button)GetNode("MarginContainer/VBoxContainer/JoinGameButton"); JoinButton.Connect("pressed", this, nameof(JoinGame)); LeaveButton = (Button)GetNode("MarginContainer/VBoxContainer/LeaveGameButton"); LeaveButton.Connect("pressed", this, nameof(LeaveGame)); LeaveButton.Disabled = true; AddressText = (TextEdit)GetNode("MarginContainer/VBoxContainer/Address"); NameText = (TextEdit)GetNode("MarginContainer/VBoxContainer/Name"); }