////////////////
    /// 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);
    }
Exemple #2
0
        /// <summary>
        /// Sends a request to create a new lobby.
        /// </summary>
        /// <param name="appId">ID of the app the lobby will belong to.</param>
        /// <param name="lobbyType">The new lobby type.</param>
        /// <param name="maxMembers">The new maximum number of members that may occupy the lobby.</param>
        /// <param name="lobbyFlags">The new lobby flags. Defaults to 0.</param>
        /// <param name="metadata">The new metadata for the lobby. Defaults to <c>null</c> (treated as an empty dictionary).</param>
        /// <returns><c>null</c>, if the request could not be submitted i.e. not yet logged in. Otherwise, an <see cref="AsyncJob{CreateLobbyCallback}"/>.</returns>
        public AsyncJob <CreateLobbyCallback> CreateLobby(uint appId, ELobbyType lobbyType, int maxMembers, int lobbyFlags = 0,
                                                          IReadOnlyDictionary <string, string> metadata = null)
        {
            if (Client.CellID == null)
            {
                return(null);
            }

            var personaName = Client.GetHandler <SteamFriends>().GetPersonaName();

            var createLobby = new ClientMsgProtobuf <CMsgClientMMSCreateLobby>(EMsg.ClientMMSCreateLobby)
            {
                Body =
                {
                    app_id             = appId,
                    lobby_type         = ( int )lobbyType,
                    max_members        = maxMembers,
                    lobby_flags        = lobbyFlags,
                    metadata           = Lobby.EncodeMetadata(metadata),
                    cell_id            = Client.CellID.Value,
                    public_ip          = NetHelpers.GetIPAddress(Client.PublicIP),
                    persona_name_owner = personaName
                },
                SourceJobID = Client.GetNextJobID()
            };

            Send(createLobby, appId);

            lobbyManipulationRequests[createLobby.SourceJobID] = createLobby.Body;
            return(AttachIncompleteManipulationHandler(new AsyncJob <CreateLobbyCallback>(Client, createLobby.SourceJobID)));
        }
    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);
    }
Exemple #4
0
 public void CreateLobby(ELobbyType lobbyType, int maxMembers, OnLobbyCreated onLobbyCreated)
 {
     if (CommunityExpress.Instance.IsGameServerInitialized)
     {
         throw new Exception("A Lobby cannot be created after a Steam Game Server has been initialized.");
     }
     this._onLobbyCreated = onLobbyCreated;
     CommunityExpress.Instance.AddCreateLobbyCallback(Matchmaking.SteamUnityAPI_SteamMatchmaking_CreateLobby(this._matchmaking, lobbyType, maxMembers), new OnMatchmakingLobbyCreatedBySteam(this.OnLobbyCreatedCallback));
 }
Exemple #5
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);
            }
        }
Exemple #6
0
        public static void SetLobbyType(int LobbyType)
        {
            if (SteamCore.InOfflineMode())
            {
                return;
            }
            //REMOVE//if ( s_CurrentLobby.m_handle == null ) return;

            ELobbyType type = IntToLobbyType(LobbyType);

            SteamMatchmaking.SetLobbyType(s_CurrentLobby.m_handle, type);
        }
Exemple #7
0
 internal Lobby(SteamID steamId, ELobbyType lobbyType, int lobbyFlags, SteamID?ownerSteamId, IReadOnlyDictionary <string, string>?metadata,
                int maxMembers, int numMembers, IReadOnlyList <Member>?members, float?distance, long?weight)
 {
     SteamID      = steamId;
     LobbyType    = lobbyType;
     LobbyFlags   = lobbyFlags;
     OwnerSteamID = ownerSteamId;
     Metadata     = metadata ?? EmptyMetadata;
     MaxMembers   = maxMembers;
     NumMembers   = numMembers;
     Members      = members ?? EmptyMembers;
     Distance     = distance;
     Weight       = weight;
 }
Exemple #8
0
        public static ELobbyType IntToLobbyType(int LobbyType)
        {
            ELobbyType type = ELobbyType.k_ELobbyTypePublic;

            switch (LobbyType)
            {
            case LobbyType_Public: type = ELobbyType.k_ELobbyTypePublic; break;

            case LobbyType_FriendsOnly: type = ELobbyType.k_ELobbyTypeFriendsOnly; break;

            case LobbyType_Private: type = ELobbyType.k_ELobbyTypePrivate; break;
            }

            return(type);
        }
 public void SetLobbyID(uint lobbyID, ELobbyType type)
 {
     if ((_lobbyID != lobbyID) || (_lobbyType != type))
     {
         _lobbyID   = lobbyID;
         _lobbyType = type;
         if ((lobbyID == 0) || (type == ELobbyType.Private))
         {
             SteamFriends.SetRichPresence("connect", null);
         }
         else
         {
             SteamFriends.SetRichPresence("connect", "+connect_lobby " + _lobbyID);
         }
     }
 }
Exemple #10
0
        public static void CreateLobby(Action <bool> OnCreateLobby, int LobbyType)
        {
            if (SteamCore.InOfflineMode())
            {
                s_LocalLobbyData = new Dictionary <String, String>();

                OnCreateLobby(false);

                return;
            }

            s_OnCreateLobby = OnCreateLobby;

            ELobbyType type = IntToLobbyType(LobbyType);

            InteropHelp.TestIfAvailableClient();
            SteamAPICall_t hSteamAPICall = (SteamAPICall_t)SteamMatchmaking.CreateLobby(type, 4);

            g_CallResultLobbyCreated = new CallResult <LobbyCreated_t>(CallbackClass.instance.OnLobbyCreated);
            g_CallResultLobbyCreated.Set(hSteamAPICall); //, SteamStats.g_CallbackClassInstance, CallbackClass.OnLobbyCreated );
        }
Exemple #11
0
        /// <summary>
        /// Sends a request to create a new lobby.
        /// </summary>
        /// <param name="appId">ID of the app the lobby will belong to.</param>
        /// <param name="lobbyType">The new lobby type.</param>
        /// <param name="maxMembers">The new maximum number of members that may occupy the lobby.</param>
        /// <param name="lobbyFlags">The new lobby flags. Defaults to 0.</param>
        /// <param name="metadata">The new metadata for the lobby. Defaults to <c>null</c> (treated as an empty dictionary).</param>
        /// <returns><c>null</c>, if the request could not be submitted i.e. not yet logged in. Otherwise, an <see cref="AsyncJob{CreateLobbyCallback}"/>.</returns>
        public AsyncJob <CreateLobbyCallback>?CreateLobby(uint appId, ELobbyType lobbyType, int maxMembers, int lobbyFlags = 0,
                                                          IReadOnlyDictionary <string, string>?metadata = null)
        {
            if (Client.CellID == null)
            {
                return(null);
            }

            var personaName = Client.GetHandler <SteamFriends>() !.GetPersonaName();

            var createLobby = new ClientMsgProtobuf <CMsgClientMMSCreateLobby>(EMsg.ClientMMSCreateLobby)
            {
                Body =
                {
                    app_id               = appId,
                    lobby_type           = ( int )lobbyType,
                    max_members          = maxMembers,
                    lobby_flags          = lobbyFlags,
                    metadata             = Lobby.EncodeMetadata(metadata),
                    cell_id              = Client.CellID.Value,
                    deprecated_public_ip = NetHelpers.GetIPAddress(Client.PublicIP !),
                    persona_name_owner   = personaName
                },
 /// <summary>
 /// Creates a new empty (without metadata) lobby. The user will be added to the lobby on creation
 /// </summary>
 /// <param name="lobbyType">The type of lobby to be created ... see Valve's documentation regarding ELobbyType for more informaiton</param>
 /// <param name="memberCountLimit">The limit on the number of users that can join this lobby</param>
 public void CreateLobby(ELobbyType lobbyType, int memberCountLimit)
 {
     LobbySettings.CreateLobby(lobbyType, memberCountLimit);
 }
 public UInt64 CreateLobby(ELobbyType eLobbyType, Int32 cMaxMembers)
 {
     return(this.GetFunction <NativeCreateLobbyEI>(this.Functions.CreateLobby12)(this.ObjectAddress, eLobbyType, cMaxMembers));
 }
Exemple #14
0
    void CreateLobby(ELobbyType type)
    {
        SteamAPICall_t requestCreate = SteamMatchmaking.CreateLobby(type, Client.MaxNumOfPlayers);

        SteamCallbackReceiver.Set <LobbyCreated_t>(requestCreate);
    }
		/// <summary>
		/// <para> updates which type of lobby it is</para>
		/// <para> only lobbies that are k_ELobbyTypePublic or k_ELobbyTypeInvisible, and are set to joinable, will be returned by RequestLobbyList() calls</para>
		/// </summary>
		public static bool SetLobbyType(CSteamID steamIDLobby, ELobbyType eLobbyType) {
			InteropHelp.TestIfAvailableClient();
			return NativeMethods.ISteamMatchmaking_SetLobbyType(steamIDLobby, eLobbyType);
		}
 public bool SetLobbyType(CSteamID steamIDLobby, ELobbyType eLobbyType)
 {
     return(this.GetFunction <NativeSetLobbyTypeCE>(this.Functions.SetLobbyType28)(this.ObjectAddress, steamIDLobby.ConvertToUint64(), eLobbyType));
 }
		public static extern bool ISteamMatchmaking_SetLobbyType(CSteamID steamIDLobby, ELobbyType eLobbyType);
Exemple #18
0
 public UInt64 CreateLobby(ELobbyType eLobbyType, Int32 cMaxMembers)
 {
     UInt64 ret = 0; this.GetFunction <NativeCreateLobbyEI>(this.Functions.CreateLobby12)(this.ObjectAddress, ref ret, eLobbyType, cMaxMembers); return((UInt64)ret);
 }
Exemple #19
0
 /// updates which type of lobby it is
 /// only lobbies that are k_ELobbyTypePublic or k_ELobbyTypeInvisible, and are set to joinable, will be returned by RequestLobbyList() calls
 public static bool SetLobbyType(CSteamID steamIDLobby, ELobbyType eLobbyType)
 {
     return(false);
 }
Exemple #20
0
 /// Create a lobby on the Steam servers.
 /// If private, then the lobby will not be returned by any RequestLobbyList() call; the CSteamID
 /// of the lobby will need to be communicated via game channels or via InviteUserToLobby()
 /// this is an asynchronous request
 /// results will be returned by LobbyCreated_t callback and call result; lobby is joined &amp; ready to use at this point
 /// a LobbyEnter_t callback will also be received (since the local user is joining their own lobby)
 public static SteamAPICall_t CreateLobby(ELobbyType eLobbyType, int cMaxMembers)
 {
     return((SteamAPICall_t)0);
 }
Exemple #21
0
 //SteamAPICall_t CreateLobby( ELobbyType eLobbyType, int cMaxMembers );
 public static SteamAPICall_t createLobby(ELobbyType eLobbyType, int cMaxMembers)
 {
     return(SteamMatchmaking.CreateLobby(eLobbyType, cMaxMembers));
 }
		public static extern ulong ISteamMatchmaking_CreateLobby(ELobbyType eLobbyType, int cMaxMembers);
Exemple #23
0
 /// <summary>
 /// <para> Create a lobby on the Steam servers.</para>
 /// <para> If private, then the lobby will not be returned by any RequestLobbyList() call; the CSteamID</para>
 /// <para> of the lobby will need to be communicated via game channels or via InviteUserToLobby()</para>
 /// <para> this is an asynchronous request</para>
 /// <para> results will be returned by LobbyCreated_t callback and call result; lobby is joined &amp; ready to use at this point</para>
 /// <para> a LobbyEnter_t callback will also be received (since the local user is joining their own lobby)</para>
 /// </summary>
 public static SteamAPICall_t CreateLobby(ELobbyType eLobbyType, int cMaxMembers)
 {
     InteropHelp.TestIfAvailableClient();
     return((SteamAPICall_t)NativeMethods.ISteamMatchmaking_CreateLobby(eLobbyType, cMaxMembers));
 }
 public UInt64 CreateLobby(ELobbyType eLobbyType)
 {
     return(this.GetFunction <NativeCreateLobbyE>(this.Functions.CreateLobby10)(this.ObjectAddress, eLobbyType));
 }
Exemple #25
0
 public void CreateLobby(int mumbercount, ELobbyType type, string name)
 {
     LobbyName = name;
     CLobbyCreator.Set(SteamMatchmaking.CreateLobby(type, mumbercount), OnLobbyCreated);
 }
		/// <summary>
		/// <para> Create a lobby on the Steam servers.</para>
		/// <para> If private, then the lobby will not be returned by any RequestLobbyList() call; the CSteamID</para>
		/// <para> of the lobby will need to be communicated via game channels or via InviteUserToLobby()</para>
		/// <para> this is an asynchronous request</para>
		/// <para> results will be returned by LobbyCreated_t callback and call result; lobby is joined &amp; ready to use at this point</para>
		/// <para> a LobbyEnter_t callback will also be received (since the local user is joining their own lobby)</para>
		/// </summary>
		public static SteamAPICall_t CreateLobby(ELobbyType eLobbyType, int cMaxMembers) {
			InteropHelp.TestIfAvailableClient();
			return (SteamAPICall_t)NativeMethods.ISteamMatchmaking_CreateLobby(eLobbyType, cMaxMembers);
		}
 public void CreateLobby(LobbyHunterFilter LobbyFilter, string LobbyName = "", ELobbyType lobbyType = ELobbyType.k_ELobbyTypePublic)
 {
     throw new NotImplementedException();
 }
 public UInt64 CreateLobby(ELobbyType eLobbyType)
 {
     UInt64 ret = 0; this.GetFunction <NativeCreateLobbyE>(this.Functions.CreateLobby10)(this.ObjectAddress, ref ret, eLobbyType); return((UInt64)ret);
 }
Exemple #29
0
        /// <summary>
        /// Sends a request to update a lobby.
        /// </summary>
        /// <param name="appId">ID of app the lobby belongs to.</param>
        /// <param name="lobbySteamId">The SteamID of the lobby that should be updated.</param>
        /// <param name="lobbyType">The new lobby type.</param>
        /// <param name="maxMembers">The new maximum number of members that may occupy the lobby.</param>
        /// <param name="lobbyFlags">The new lobby flags. Defaults to 0.</param>
        /// <param name="metadata">The new metadata for the lobby. Defaults to <c>null</c> (treated as an empty dictionary).</param>
        /// <returns>An <see cref="AsyncJob{SetLobbyDataCallback}"/>.</returns>
        public AsyncJob <SetLobbyDataCallback> SetLobbyData(uint appId, SteamID lobbySteamId, ELobbyType lobbyType, int maxMembers, int lobbyFlags = 0,
                                                            IReadOnlyDictionary <string, string> metadata = null)
        {
            var setLobbyData = new ClientMsgProtobuf <CMsgClientMMSSetLobbyData>(EMsg.ClientMMSSetLobbyData)
            {
                Body =
                {
                    app_id          = appId,
                    steam_id_lobby  = lobbySteamId,
                    steam_id_member =                              0,
                    lobby_type      = ( int )lobbyType,
                    max_members     = maxMembers,
                    lobby_flags     = lobbyFlags,
                    metadata        = Lobby.EncodeMetadata(metadata),
                },
                SourceJobID = Client.GetNextJobID()
            };

            Send(setLobbyData, appId);

            lobbyManipulationRequests[setLobbyData.SourceJobID] = setLobbyData.Body;
            return(AttachIncompleteManipulationHandler(new AsyncJob <SetLobbyDataCallback>(Client, setLobbyData.SourceJobID)));
        }
Exemple #30
0
 /// <summary>
 /// <para> updates which type of lobby it is</para>
 /// <para> only lobbies that are k_ELobbyTypePublic or k_ELobbyTypeInvisible, and are set to joinable, will be returned by RequestLobbyList() calls</para>
 /// </summary>
 public static bool SetLobbyType(CSteamID steamIDLobby, ELobbyType eLobbyType)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamMatchmaking_SetLobbyType(steamIDLobby, eLobbyType));
 }
Exemple #31
0
 private static ulong SteamUnityAPI_SteamMatchmaking_CreateLobby(IntPtr matchmaking, ELobbyType lobbyType, int maxMembers);
Exemple #32
0
        public void CreateLobby(ELobbyType lobbyType, int maxUsers)
        {
            var call = SteamMatchmaking.CreateLobby(lobbyType, maxUsers);

            SteamCallback.lobbyCreated.Set(call);
        }
 public void SetLobbyID(uint lobbyID, ELobbyType type)
 {
 }