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> /// Create a new AutomaticTurnGame. /// </summary> /// <param name="context">The networking context.</param> /// <param name="targetUpdatesPerSecond">The number of updates/turns that will occur every /// second.</param> public AutomaticTurnGame(NetworkContext context, int targetUpdatesPerSecond) { TargetUpdatesPerSecond = targetUpdatesPerSecond; _context = context; if (_context.IsServer) { _serverHandler = new GameServerHandler(_context); _context.AddMessageHandler(_serverHandler); } _clientHandler = new GameClientHandler(); _context.AddMessageHandler(_clientHandler); }
/// <summary> /// Construct a new ChatManager using the given networking context and the given object for /// mapping network players to a directed player relation graph. /// </summary> /// <param name="context">The networking context.</param> public ChatManager(NetworkContext context) { _context = context; _handler = new ChatMessageHandler(_context); _context.AddMessageHandler(_handler); }
private LobbyMember(NetworkContext context, IMapManager mapManager) : base(context) { _mapHandler = new MapDownloadClientMessageHandler(context, mapManager); context.AddMessageHandler(_mapHandler); }
/// <summary> /// Create a new PauseManager instance. /// </summary> /// <param name="context">The networking context to use.</param> public PauseManager(NetworkContext context) { _context = context; _handler = new PauseMessageHandler(); _context.AddMessageHandler(_handler); }