void CloseNetwork() { SafeDisconnect("server_disconnected", this, "CloseNetwork"); SafeDisconnect("connection_failed", this, "CloseNetwork"); SafeDisconnect("connected_to_server", this, "Connected"); StopGame(); AcceptDialog acceptDialog = GetNode <AcceptDialog>("AcceptDialog"); acceptDialog.ShowModal(); acceptDialog.GetCloseButton().GrabFocus(); GetTree().NetworkPeer = null; }