示例#1
0
        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);
            }
        }
示例#2
0
        /// <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);
        }
示例#3
0
 /// <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);
 }
示例#4
0
 private LobbyMember(NetworkContext context, IMapManager mapManager)
     : base(context) {
     _mapHandler = new MapDownloadClientMessageHandler(context, mapManager);
     context.AddMessageHandler(_mapHandler);
 }
示例#5
0
 /// <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);
 }