Пример #1
0
        /// <summary>
        /// Helper that disconnects and reconnects to the lobby. Used after a game and
        /// when we have gathered all info we needed from spawning ourselves. Will not
        /// invoke the disconnect handler, unless the connecting fails.
        /// </summary>
        private async Task DisconnectAndReconnect()
        {
            _connection.RemoveDisconnectListeners();
            _connection.Disconnect("Bye bye!");

            try
            {
                await Connect(_address, _lobbyName, _port);
            }
            catch
            {
                OnDisconnect?.Invoke();
            }
        }