示例#1
0
    public void SetupClient(bool simulatedLatency)
    {
        ConnectionConfig config = new ConnectionConfig();

        //config.por
        //MyNetworkManager.singleton.StartServer();

        config.NetworkDropThreshold = 90;
        config.ReducedPingTimeout   = 1000;
        config.PingTimeout          = 1000;
        config.AddChannel(QosType.ReliableSequenced);
        config.AddChannel(QosType.AllCostDelivery);
        myClient = new NetworkClient();
        myClient.Configure(config, 10);
        myClient.RegisterHandler(MsgType.Connect, OnConnected);
        if (simulatedLatency)
        {
            myClient.ConnectWithSimulator(m_ipText.text, m_gameServerPort, 150, 0);
        }
        else
        {
            myClient.Connect(m_ipText.text, m_gameServerPort);
        }
    }