예제 #1
0
        public void OnServerStop()
        {
            ServerSocketManager s = new ServerSocketManager(IPAddress.Parse("127.0.0.1"), 6969);

            Assert.Null(s.OnServerStop);
            s.OnServerStop = () => { };
            Assert.IsType <Action>(s.OnServerStop);
            s.Dispose();
        }
예제 #2
0
        public void OnClientReady()
        {
            ServerSocketManager s = new ServerSocketManager(IPAddress.Parse("127.0.0.1"), 6969);

            Assert.Null(s.OnClientReady);
            s.OnClientReady = socket => { };
            Assert.IsType <Action <ClientSocket> >(s.OnClientReady);
            s.Dispose();
        }
예제 #3
0
        public void OnClientDisconnect()
        {
            ServerSocketManager s = new ServerSocketManager(IPAddress.Parse("127.0.0.1"), 6969);

            Assert.Null(s.OnClientDisconnect);
            s.OnClientDisconnect = s1 => {  };
            Assert.IsType <Action <string> >(s.OnClientDisconnect);
            s.Dispose();
        }
예제 #4
0
        private Server(IConfiguration configuration)
        {
            _configuration = configuration;

            IPAddress ip   = IPAddress.Parse(_configuration["Server:IPAddress"]);
            int       port = Convert.ToInt32(_configuration["Server:Port"]);

            _server = new ServerSocketManager(ip, port);

            _simulation = new Simulation(new Infection(), new WorldOptions
            {
                Seed             = 1234,
                ChunkSize        = 16,
                WorldChunkWidth  = 10,
                WorldChunkHeight = 4,
                WorldScale       = 30,
                WorldGenerator   = options => new FlatWorld(options)
            });
        }