private IEnumerable <bool> RequestP2PConnectionWithHost()
    {
        while (!SteamManager.Initialized)
        {
            if (P2PLogFilter.logError)
            {
                Debug.LogError("[TransportLayerSteam] SteamManager not initialized");
            }
            yield return(false);
        }
        P2PTransportLayer.CanStartSessionEventArgs canStartSessionEventArgs = new P2PTransportLayer.CanStartSessionEventArgs();
        P2PTransportLayer.CanStartSession(canStartSessionEventArgs);
        if (!canStartSessionEventArgs.IsSessionReady)
        {
            yield return(false);
        }
        CSteamID lobbyOwner = SteamMatchmaking.GetLobbyOwner(this.m_LobbyId);

        if (P2PLogFilter.logInfo)
        {
            Debug.Log("[TransportLayerSteam] Requesting P2P connection (sending empty packet)");
        }
        SteamNetworking.SendP2PPacket(lobbyOwner, null, 0u, EP2PSend.k_EP2PSendReliable, 0);
        this.AssignNewConnectionForUser(lobbyOwner);
        yield break;
        yield break;
    }
Пример #2
0
 public static void CanStartSession(P2PTransportLayer.CanStartSessionEventArgs args)
 {
     P2PTransportLayer.CanStartSessionDel canStartSessionCheckEvent = P2PTransportLayer.CanStartSessionCheckEvent;
     if (canStartSessionCheckEvent == null)
     {
         return;
     }
     canStartSessionCheckEvent(args);
 }