Пример #1
0
        //Constructors
        //============
        public dwClient(dwWorld2D world)
        {
            clientWorld = world;
            clientWorld.onWorldUpdate += gameUpdate;

            netThread = new Thread(threadStart);
            running = false;
        }
Пример #2
0
        public dwServer(dwWorld2D world)
        {
            dwLog.info("Initializing NetServer...");

            //Setup the connection between the server and the world
            serverWorld = world;

            //Create the network configuration
            peerConfig = new NetPeerConfiguration(dwWorldConstants.GAME_ID);
            peerConfig.Port = dwWorldConstants.GAME_NET_PORT;
            peerConfig.MaximumConnections = 200;
            peerConfig.EnableMessageType(NetIncomingMessageType.ConnectionApproval);

            //Create the server instance
            netServer = new NetServer(peerConfig);
            running = false;

            //Create the server thread
            serverThread = new Thread(threadStart);
        }