示例#1
0
 public ClientFrame(NetPeerConfiguration config,
                    IMessageReceiver receiver,
                    NetworkConnector connector)
 {
     _client   = new NetClient(config);
     Receiver  = receiver;
     Connector = connector;
 }
示例#2
0
        public static ClientFrame Create(string id, int timeout, int ping, IMessageReceiver receiver, NetworkConnector connector)
        {
            NetPeerConfiguration config = new NetPeerConfiguration(id);

            config.PingInterval        = ping;
            config.ConnectionTimeout   = timeout;
            config.UseMessageRecycling = true;
            config.SendBufferSize      = 134_216_704;
            config.EnableMessageType(NetIncomingMessageType.ConnectionLatencyUpdated);

#if DEBUG
            config.SimulatedMinimumLatency   = 0.015f;
            config.SimulatedRandomLatency    = 0.010f;
            config.SimulatedDuplicatesChance = 0.01f;
            config.SimulatedLoss             = 0.01f;
#endif // DEBUG

            ClientFrame cf = new ClientFrame(config, receiver, connector);
            return(cf);
        }