Пример #1
0
        public GameServer(ServerConfig sConfig)
        {
            serverConfig = sConfig;

            Name = serverConfig.getServerName();
            Port = serverConfig.getServerPort();
            world = new GameWorld(this);

            NetPeerConfiguration npConfig = new NetPeerConfiguration("game");
            npConfig.EnableMessageType(NetIncomingMessageType.ConnectionApproval);
            npConfig.EnableMessageType(NetIncomingMessageType.StatusChanged);
            npConfig.EnableMessageType(NetIncomingMessageType.Data);
            npConfig.Port = Port;

            server = new NetServer(npConfig);
            server.Start();

            Initialize();

            Logger.InfoFormat("Started {0} on port {1} !", Name, Port);
        }