public ClientRequestHandler(Guid id, TcpClient clientConnected, GameTcpServer server)
        {
            this._id = id;
            this._clientSocket = clientConnected;
            this._tcpServer = server;
            this._communicator = new TcpCommunicator(_clientSocket);

            _protocol = new PresentationLayer(
                new SessionLayer(
                    new SlipTransportLayer(_communicator)));
        }
 private GameServer()
 {
     ServerSocket = new GameTcpServer();
 }
Beispiel #3
0
        private void StartComponents(GameConfiguration configuration)
        {
            // Instantiate components
            _server = new GameTcpServer();
            _game = new GameController(_server, configuration);

            // Add listeners
            _server.Subscribe(_game);

            // Start the TCP Service
            _server.StartService();

            // Create and start the DiscoveryService
            var discovery = new DiscoveryService();
            discovery.Start();

            // Start the game
            var worker = new BackgroundWorker();
            worker.DoWork += (sender, args) => _game.Loop();
            worker.RunWorkerAsync();
        }