Пример #1
0
    public void StartNewPingClient()
    {
        if (string.IsNullOrEmpty(pingServerEndpoint))
        {
            Debug.LogWarning("Cannot start pinging - No ping server endpoint was entered");
            return;
        }

        if (m_UdpPing != null)
        {
            Debug.LogWarning("Cannot start pinging - Pinging already in progress");
            return;
        }

        Debug.Log("Starting pinging...");

        try
        {
            m_UdpPing = new UdpPingWrapper();
            m_UdpPing.Start(pingServerEndpoint);
            m_State = MatchmakingState.ServerPing;
        }
        catch (Exception e)
        {
            Debug.LogError("Cannot start pinging due to exception - " + e.Message);
            m_UdpPing?.Dispose();
            m_UdpPing = null;
        }
    }
Пример #2
0
    public void ShutdownPingClient()
    {
        if (m_UdpPing == null)
        {
            Debug.LogWarning("Cannot shut down ping client - no pinging in progress");
            return;
        }

        Debug.Log("Shutting down ping client...");
        m_UdpPing.Dispose();
        m_UdpPing = null;
        m_State   = MatchmakingState.Idle;
    }
Пример #3
0
    public void TerminateRemoteServer()
    {
        if (m_UdpPing != null)
        {
            m_UdpPing.TryTerminateRemoteServer();
            m_UdpPing.Dispose();
            m_UdpPing = null;
        }
        else
        {
            UdpPingWrapper.TryTerminateRemoteServer(pingServerEndpoint);
        }

        m_State = MatchmakingState.Idle;
    }