internal LobbyCommon(NetworkContext context) { _context = context; _lobbyLaunchedHandler = new LobbyLaunchedHandler(); _context.AddMessageHandler(_lobbyLaunchedHandler); _playerManager = new PlayerManager(_context); _context.AddMessageHandler(_playerManager); if (_context.IsServer) { _context.AddConnectionMonitor(_playerManager); } }
/// <summary> /// Dispose the lobby. /// </summary> public virtual void Dispose() { if (_lobbyLaunchedHandler != null) { _context.RemoveMessageHandler(_lobbyLaunchedHandler); _lobbyLaunchedHandler = null; } if (_playerManager != null) { _context.RemoveMessageHandler(_playerManager); if (_context.IsServer) { _context.RemoveConnectionMonitor(_playerManager); } _playerManager = null; } }