public async Task <Lobby> CreateLobby(LobbyCreateParams createParams)
        {
            ELobbyType type;

            switch (createParams.Type)
            {
            case LobbyType.Private: type = ELobbyType.k_ELobbyTypePrivate; break;

            default:
            case LobbyType.Public: type = ELobbyType.k_ELobbyTypePublic; break;
            }
            var size       = createParams.Capacity;
            var lobbyEnter = SteamUtility.WaitFor <LobbyEnter_t>();
            var result     = await SteamMatchmaking.CreateLobby(type, (int)size).ToTask <LobbyCreated_t>();

            SteamUtility.ThrowIfError(result.m_eResult);
            await lobbyEnter;
            var   lobbyId = new CSteamID(lobbyEnter.Result.m_ulSteamIDLobby);
            var   lobby   = new SteamLobby(lobbyId, this);

            if (createParams.Metadata != null)
            {
                foreach (var kvp in createParams.Metadata)
                {
                    if (kvp.Key == null || kvp.Value == null)
                    {
                        continue;
                    }
                    SteamMatchmaking.SetLobbyData(lobbyId, kvp.Key, kvp.Value.ToString());
                }
            }
            _connectedLobbies.Add(lobbyId, lobby);
            return(lobby);
        }
    ////////////////
    /// Lobby Creation Methods and callbacks
    ///////////////

    public void CreateLobby(ELobbyType lobbyType, int maxMembers)
    {
        SteamAPICall_t handle = SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePublic, maxMembers);

        OnLobbyCreatedCallResult.Set(handle);
        Debug.Log("SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePublic, 1) : " + handle);
    }
Ejemplo n.º 3
0
 private void updateLobbyPrivacy()
 {
     if (lobbyOwner != selfId)
     {
         return;
     }
     if (lobby != null)
     {
         GalaxyInstance.Matchmaking().SetLobbyType(lobby, privacyToLobbyType(privacy));
     }
     if (lobby == null)
     {
         if (steamLobby.HasValue)
         {
             SteamMatchmaking.LeaveLobby(steamLobby.Value);
         }
     }
     else if (!steamLobby.HasValue)
     {
         if (steamLobbyEnterCallback == null)
         {
             steamLobbyEnterCallback = Callback <LobbyEnter_t> .Create(onSteamLobbyEnter);
         }
         SteamMatchmaking.CreateLobby(privacyToSteamLobbyType(privacy), (int)memberLimit);
     }
     else
     {
         SteamMatchmaking.SetLobbyType(steamLobby.Value, privacyToSteamLobbyType(privacy));
         SteamMatchmaking.SetLobbyData(steamLobby.Value, "connect", getConnectionString());
     }
 }
Ejemplo n.º 4
0
        // Token: 0x06002EDC RID: 11996 RVA: 0x00132248 File Offset: 0x00130648
        public static void createLobby()
        {
            Terminal.print("Create lobby", null, Provider.STEAM_IC, Provider.STEAM_DC, true);
            SteamAPICall_t hAPICall = SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePrivate, 24);

            Lobbies.lobbyCreated.Set(hAPICall, null);
        }
Ejemplo n.º 5
0
 public void HostSingleLobby()
 {
     Debug.Log(networkManager.maxConnections);
     connectionUI.SetActive(false);
     networkManager.singlePlayerMode = true;
     SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypeFriendsOnly, networkManager.maxConnections);
 }
Ejemplo n.º 6
0
        public void CreateLobby()
        {
            var mumber_count = 8;
            var lobby_type   = ELobbyType.k_ELobbyTypePublic;

            CLobbyCreator.Set(SteamMatchmaking.CreateLobby(lobby_type, mumber_count), OnLobbyCreated);
        }
Ejemplo n.º 7
0
 public void CreateLobby()
 {
     if (SteamManager.Initialized)
     {
         SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypeFriendsOnly, MAX_PLAYERS);
     }
 }
Ejemplo n.º 8
0
    // Update is called once per frame
    void OnGUI()
    {
        SteamAPI.RunCallbacks();

        if (GUI.Button(new Rect(120, 20, 140, 20), "Create Lobby"))
        {
            print("Create lobby");
            SteamAPICall_t host = SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePublic, 4);
        }
        if (GUI.Button(new Rect(120, 20, 280, 20), "lobbies list"))
        {
            print("list lobbies");
            SteamAPICall_t getList = SteamMatchmaking.RequestLobbyList();
        }
        if (GUI.Button(new Rect(120, 20, 420, 20), "change first lobby"))
        {
            print("change first lobby");
            SteamAPICall_t joinLobby = SteamMatchmaking.JoinLobby(SteamMatchmaking.GetLobbyByIndex(0));
        }
        if (GUI.Button(new Rect(120, 20, 560, 20), "Num Players"))
        {
            int numPlayers = SteamMatchmaking.GetNumLobbyMembers((CSteamID)currentID);
            print("Number of players" + numPlayers);
            for (int i = 0; i < numPlayers; i++)
            {
                print("\t Player(" + i + ")==" + SteamFriends.GetFriendPersonaName(SteamMatchmaking.GetLobbyMemberByIndex((CSteamID)currentID, i)));
            }
        }
    }
Ejemplo n.º 9
0
        public static void CreateLobby(bool isPublic = false)
        {
            Debug.Log("Creating lobby");
            SteamAPICall_t handle = SteamMatchmaking.CreateLobby(isPublic ? ELobbyType.k_ELobbyTypePublic : ELobbyType.k_ELobbyTypeFriendsOnly, 2);

            SteamHelper.LobbyCreated.Set(handle);
        }
Ejemplo n.º 10
0
    public void HostGame()
    {
        if (lobby.Equals(CSteamID.Nil) == false)
        {
            Debug.LogError("Lobby already created. Probably already hosting. Must shut down hosting before doing it again.");
            return;
        }

        //Construct the network database. Very important!
        MeshNetworkIdentity databaseID = new MeshNetworkIdentity((ushort)ReservedObjectIDs.DatabaseObject,
                                                                 (ushort)ReservedPrefabIDs.Database,
                                                                 (ulong)GetLocalPlayerID(), true);

        database = game.SpawnDatabase(databaseID).GetComponent <NetworkDatabase>(); //Spawns the database prefab.
        Debug.Log("Registering database.");
        database.AddObject(databaseID, true);                                       //Tells the database that it itself exists (funny)

        //First, we get our own player object, and we make ourselves the provider.
        Player me = ConstructPlayer(SteamUser.GetSteamID());

        Debug.Log("Registering provider.");
        database.AddPlayer(me, true);

        //Actually create the lobby. Password info, etc, will be set after this.
        Debug.Log("Creating Lobby");
        m_LobbyCreated.Set(SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePrivate, 4));
    }
Ejemplo n.º 11
0
        public static void createLobby()
        {
            Terminal.print("Create lobby", null, Provider.STEAM_IC, Provider.STEAM_DC, true);
            SteamAPICall_t steamAPICall_t = SteamMatchmaking.CreateLobby(0, 24);

            Lobbies.lobbyCreated.Set(steamAPICall_t, null);
        }
Ejemplo n.º 12
0
        public void Create(bool inviteOnly, CallResult <LobbyCreated_t> .APIDispatchDelegate callResult)
        {
            SteamAPICall_t steamAPICallT = SteamMatchmaking.CreateLobby((inviteOnly ? ELobbyType.k_ELobbyTypePrivate : ELobbyType.k_ELobbyTypeFriendsOnly), 256);

            this._lobbyCreatedExternalCallback = callResult;
            this._lobbyCreated.Set(steamAPICallT, null);
            this.State = LobbyState.Creating;
        }
Ejemplo n.º 13
0
 public void CreateSteamFriendsLobby()
 {
     if (SteamManager.Initialized)
     {
         Debug.Log("[STEAM] Initializing lobby creation ... ");
         SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypeFriendsOnly, _maxFriends);
     }
 }
Ejemplo n.º 14
0
    public void CreateLobby()
    {
        Debug.Log("Creating lobby");

        UNETServerController.inviteFriendOnStart = false;
        SteamMatchmaking.CreateLobby(lobbyAccess, MAX_USERS);
        // ...continued in OnLobbyEntered callback
    }
Ejemplo n.º 15
0
        public void Create(bool inviteOnly, CallResult <LobbyCreated_t> .APIDispatchDelegate callResult)
        {
            SteamAPICall_t hAPICall = SteamMatchmaking.CreateLobby((!inviteOnly) ? ELobbyType.k_ELobbyTypeFriendsOnly : ELobbyType.k_ELobbyTypePrivate, 17);

            _lobbyCreatedExternalCallback = callResult;
            _lobbyCreated.Set(hAPICall);
            State = LobbyState.Creating;
        }
    public SteamAPICall_t createLobbyGameServer(ELobbyType ELobbyType)
    {
        SteamAPICall_t handle = SteamMatchmaking.CreateLobby(ELobbyType, 250);

        OnLobbyCreatedCallResult.Set(handle);
        Console.WriteLine("SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePublic, 1) : " + handle);
        return(handle);
    }
Ejemplo n.º 17
0
        public void Create(bool inviteOnly, CallResult <LobbyCreated_t> .APIDispatchDelegate callResult)
        {
            SteamAPICall_t lobby = SteamMatchmaking.CreateLobby(inviteOnly ? (ELobbyType)0 : (ELobbyType)1, 256);

            this._lobbyCreatedExternalCallback = callResult;
            this._lobbyCreated.Set(lobby, (CallResult <LobbyCreated_t> .APIDispatchDelegate)null);
            this.State = LobbyState.Creating;
        }
Ejemplo n.º 18
0
 public void HostLobby()
 {
     menuManager.NavigateToMenu("Loading");
     try {
         SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypeFriendsOnly, networkManager.maxConnections);
     } catch (System.Exception e) {
         menuManager.NavigateToMenu("Error", e.Message);
     }
 }
Ejemplo n.º 19
0
 //Steam callback action
 private void LobbySearch(LobbyMatchList_t callback)
 {
     //Create new lobby if none are open
     if (callback.m_nLobbiesMatching <= 0)
     {
         SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePublic, networkManager.maxConnections);
     }
     //Only joins the first lobby found (so not truly random but whatever)
     SteamMatchmaking.JoinLobby(SteamMatchmaking.GetLobbyByIndex(0));
 }
Ejemplo n.º 20
0
 public static void Create(string name, int memberLimit, bool friendsOnly, Action callback, Action callbackFail)
 {
     CoopLobbyManager.Initialize();
     CoopLobbyManager.createCallback           = callback;
     CoopLobbyManager.createFailCallback       = callbackFail;
     CoopLobbyManager.createValues             = new CoopLobbyInfo(0UL);
     CoopLobbyManager.createValues.Name        = name;
     CoopLobbyManager.createValues.MemberLimit = memberLimit;
     SteamMatchmaking.CreateLobby((!friendsOnly) ? ELobbyType.k_ELobbyTypePublic : ELobbyType.k_ELobbyTypeFriendsOnly, memberLimit);
 }
Ejemplo n.º 21
0
        public void Host(CSteamID selfSteamId, ELobbyType lobbyType, OnLobbyReady func = null)
        {
            if (Disposed)
            {
                throw new ObjectDisposedException("SteamP2PServer", "This object has been disposed and can not be used to connect, please use a new SteamP2PServer");
            }

            try
            {
                Client          = new CachedSteamP2PClient(selfSteamId);
                Me              = new NetworkingPlayer(ServerPlayerCounter++, selfSteamId, true, this);
                Me.InstanceGuid = InstanceGuid.ToString();

                m_CallbackLobbyCreated = Callback <LobbyCreated_t> .Create((LobbyCreated_t data) =>
                {
                    LobbyID = (CSteamID)data.m_ulSteamIDLobby;
                    if (func != null)
                    {
                        func();
                    }
                });

                m_CreateLobbyResult = SteamMatchmaking.CreateLobby(lobbyType, 5);
                // Do any generic initialization in result of the successful bind
                OnBindSuccessful();

                // Create the thread that will be listening for new data from connected clients and start its execution
                Task.Queue(ReadClients);

                // Create the thread that will check for player timeouts
                Task.Queue(() =>
                {
                    commonServerLogic.CheckClientTimeout((player) =>
                    {
                        Disconnect(player, true);
                        OnPlayerTimeout(player);
                        CleanupDisconnections();
                    });
                });

                //Let myself know I connected successfully
                OnPlayerConnected(Me);
                // Set myself as a connected client
                Me.Connected = true;
                StartAcceptingConnections();
            }
            catch (Exception e)
            {
                Logging.BMSLog.LogException(e);
                // Do any generic initialization in result of the binding failure
                OnBindFailure();

                throw new FailedBindingException("Failed to bind to host/port, see inner exception", e);
            }
        }
    /////////////////////////////////////////////////////////////////////////////
    // Join / Update / Entering Lobbies / Leaving Lobbies


    public void CreateLobby()
    {
        SteamAPICall_t handle = SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePublic, 2);

        OnLobbyCreatedCallResult.Set(handle);

        if (DebugTextOn)
        {
            Debug.Log("SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePublic, 1) : " + handle);
        }
    }
Ejemplo n.º 23
0
        public void Create(bool inviteOnly, APIDispatchDelegate <LobbyCreated_t> callResult)
        {
            //IL_000c: Unknown result type (might be due to invalid IL or missing references)
            //IL_0011: Unknown result type (might be due to invalid IL or missing references)
            //IL_001f: Unknown result type (might be due to invalid IL or missing references)
            SteamAPICall_t val = SteamMatchmaking.CreateLobby((ELobbyType)((!inviteOnly) ? 1 : 0), 256);

            _lobbyCreatedExternalCallback = callResult;
            _lobbyCreated.Set(val, (APIDispatchDelegate <LobbyCreated_t>)null);
            State = LobbyState.Creating;
        }
Ejemplo n.º 24
0
    public void HostLobby()
    {
        mainMenu.SetActive(false);

        if (useSteam)
        {
            SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypeFriendsOnly, 4);
            return;
        }
        NetworkManager.singleton.StartHost();
    }
Ejemplo n.º 25
0
        public static void CreateLobby(bool privateLobby)
        {
            if (isLobbyConnected())
            {
                return;
            }
            Logger.Debug($"Creating a lobby");
            SteamAPICall_t handle = SteamMatchmaking.CreateLobby(privateLobby ? ELobbyType.k_ELobbyTypeFriendsOnly : ELobbyType.k_ELobbyTypePublic, Config.Instance.MaxLobbySize);

            OnLobbyCreatedCallResult.Set(handle);
        }
Ejemplo n.º 26
0
    // Token: 0x06000968 RID: 2408 RVA: 0x000453B0 File Offset: 0x000435B0
    public void RegisterServer(string name, bool password, string version, bool publicServer, string worldName)
    {
        this.UnregisterServer();
        SteamAPICall_t hAPICall = SteamMatchmaking.CreateLobby(publicServer ? ELobbyType.k_ELobbyTypePublic : ELobbyType.k_ELobbyTypeFriendsOnly, 32);

        this.m_lobbyCreated.Set(hAPICall, null);
        this.m_registerServerName = name;
        this.m_registerPassword   = password;
        this.m_registerVerson     = version;
        ZLog.Log("Registering lobby");
    }
Ejemplo n.º 27
0
    // Use this for initialization
    void Start()
    {
        lobbyCreated = CallResult <LobbyCreated_t> .Create((cb, failure) =>
        {
            Debug.Log(failure);
            Debug.Log(cb.m_eResult);
        });

        SteamAPICall_t call = SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePrivate, 4);

        lobbyCreated.Set(call);
    }
Ejemplo n.º 28
0
    public void HostLobby()
    {
        landingPagePanel.SetActive(false);

        if (useSteam)
        {
            SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypeFriendsOnly, 4); // friends only lobby, with max of 4 players
            return;
        }

        NetworkManager.singleton.StartHost();
    }
Ejemplo n.º 29
0
        public override void OnMatchCreate(bool success, string extendedInfo, MatchInfo matchInfo)
        {
            base.OnMatchCreate(success, extendedInfo, matchInfo);
            _currentMatchID = (System.UInt64)matchInfo.networkId;

            SteamMatchmaking.SetUNETMatchID(matchInfo.networkId);
            SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePublic, maxPlayers);

            //SteamMatchmaking.SetLobbyData((CSteamID)result.m_ulSteamIDLobby, "name", matchNameInput.text);

            //Debug.Log("UNET MATCH ID ------ " + _currentMatchID);
        }
Ejemplo n.º 30
0
 private void startLobby(LobbyType lobbyType)
 {
     ButtonsHolder.SetActive(false);
     if (lobbyType == LobbyType.PRIVATE)
     {
         SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypeFriendsOnly, networkManager.maxConnections);
     }
     if (lobbyType == LobbyType.PUBLIC)
     {
         SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePublic, networkManager.maxConnections);
     }
 }