示例#1
0
    public void uLink_OnConnectedToServer(System.Net.EndPoint server)
    {
        Printf("Connected to server");

        OnConnectToServerFailed = null;

        if (Debug.isDebugBuild)
        {
            // the timeout interval needs to be extended for debug purpose (to avoid disconnect the game network when debugging a code)
            uLink.Network.config.timeoutDelay = 10 * 60;

            Debug.Log("Debug: The network timeout value has been set to " + uLink.Network.config.timeoutDelay + " seconds");

            NetUtils.SetConnectionQualityEmulation(TestingConnectionQuality);

            if (ShowNetworkStatistics)
            {
                NetUtils.DisplayNetworkStatistics();
                LastShowNetworkStatistics = ShowNetworkStatistics;
            }
        }
        else
        {
            uLink.Network.config.timeoutDelay = ClientSetup.TimeoutDelay;
        }
    }
示例#2
0
    public void ConnectToServer(IPEndPoint EndPoint, int joinRequestId, ConnectToServerFailedDelegate onConnectToServerFailed)
    {
        Printf("Connecting to lan server");

        PrepareNetworkConnection(onConnectToServerFailed);

        uLink.Network.Connect(EndPoint,
                              "",
                              NetUtils.CurrentVersion.ToString(),
                              CloudUser.instance.primaryKey,
                              CloudUser.instance.nickName,
                              (int)Application.platform,
                              joinRequestId);

        uLinkStatisticsGUI.HACK_ConnectedServerEndpoint = EndPoint;
    }
示例#3
0
    void PrepareNetworkConnection(ConnectToServerFailedDelegate onConnectToServerFailed)
    {
        OnConnectToServerFailed = onConnectToServerFailed;

        //TODO remove or keep it: this line returns the old timer function which  have impact to uLink's network.Time implementation
        // maybe it will solve a lagging bug
        // Update1: yes keep it for now. It is not going to solve all the problems but there was a serious problem detected in the default timeMeasurementFunction (StopWatch)
        // Update2: The stopwatch timer implementation has been fixed
        // Update3: batch send re-enabled - let's turn the optimization on again as the new uLink fixed the slow packet re-send
        // Update4: batch send disabled back again as it causes some data serialization issues (throwing exception during RPC calls). Still not fixed in uLink 1.5.2
        // Update5: we are enabling it back again because a patch in uLink 1.5.3 Lina: "Fixed reported issue "Trying to read past buffer size" during serialization, which previously was also made more evident by batchSendAtEndOfFrame"
        // Update6: batch send still not working (same issue as before; appears during several fast consecutive Knockdowns), so disabled yet again!
        uLink.Network.config.timeMeasurementFunction = uLink.NetworkTimeMeasurementFunction.TickCount;
        uLink.Network.config.batchSendAtEndOfFrame   = false;

        float timeBetweenPings = 1.0f;

        Printf("Changing uLink.Network.config.timeBetweenPings from " + uLink.Network.config.timeBetweenPings + " to " + timeBetweenPings +
               " seconds.");

        uLink.Network.config.timeBetweenPings = timeBetweenPings;
    }