public void LobbyCreated(LobbyCreated_t result)
        {
            SteamMatchmaking.JoinLobby((CSteamID)result.m_ulSteamIDLobby);
            MultiplayerChat.AddChat("Created Lobby!");

            SteamMatchmaking.SetLobbyData((CSteamID)result.m_ulSteamIDLobby, MANAGER_ID, SteamUser.GetSteamID().ToString());
        }
Exemplo n.º 2
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)));
            }
        }
    }
    ////////////////////////////////////////////////////
    //Join Lobby Requests
    ////////////////////////////////////////////////////

    public void JoinLobby(CSteamID _Lobby)
    {
        SteamAPICall_t handle = SteamMatchmaking.JoinLobby(_Lobby);

        OnLobbyEnterCallResult.Set(handle);
        // currentLobby.lobby = _Lobby;
        print("SteamMatchmaking.JoinLobby(" + _Lobby + ") : " + handle);
    }
Exemplo n.º 4
0
    void AcceptInvite(GameLobbyJoinRequested_t cb)
    {
        Client.LeaveCurrentLobby();
        FindObjectOfType <MenuMgr>().ReturnToSelection();
        SteamAPICall_t request = SteamMatchmaking.JoinLobby((CSteamID)cb.m_steamIDLobby);

        SteamCallbackReceiver.Set <LobbyEnter_t>(request);
    }
Exemplo n.º 5
0
    void OnGameLobbyJoinRequested(GameLobbyJoinRequested_t pCallback)
    {
        //SteamworksDotNetTest.Game1.backgroundColor = Microsoft.Xna.Framework.Color.Green;
        Console.WriteLine("[" + GameLobbyJoinRequested_t.k_iCallback + " - GameLobbyJoinRequested] - " + pCallback.m_steamIDLobby + " -- " + pCallback.m_steamIDFriend);
        SteamMatchmakingTest.m_Lobby = pCallback.m_steamIDLobby;

        SteamMatchmaking.JoinLobby(pCallback.m_steamIDLobby);      //Joins the lobby. VERY IMPORTANT :)
        waitingForLobbyJoin = true;
    }
Exemplo n.º 6
0
 // Token: 0x06002EDD RID: 11997 RVA: 0x00132280 File Offset: 0x00130680
 public static void joinLobby(CSteamID newLobby)
 {
     if (Lobbies.inLobby)
     {
         Lobbies.leaveLobby();
     }
     Terminal.print("Join lobby: " + newLobby, null, Provider.STEAM_IC, Provider.STEAM_DC, true);
     SteamMatchmaking.JoinLobby(newLobby);
 }
Exemplo n.º 7
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));
 }
Exemplo n.º 8
0
 public void Join(CSteamID lobbyId, CallResult <LobbyEnter_t> .APIDispatchDelegate callResult)
 {
     if (State == LobbyState.Inactive)
     {
         State = LobbyState.Connecting;
         _lobbyEnterExternalCallback = callResult;
         SteamAPICall_t hAPICall = SteamMatchmaking.JoinLobby(lobbyId);
         _lobbyEnter.Set(hAPICall);
     }
 }
Exemplo n.º 9
0
 public void Join(CSteamID lobbyId, CallResult <LobbyEnter_t> .APIDispatchDelegate callResult)
 {
     if (this.State != LobbyState.Inactive)
     {
         return;
     }
     this.State = LobbyState.Connecting;
     this._lobbyEnterExternalCallback = callResult;
     this._lobbyEnter.Set(SteamMatchmaking.JoinLobby(lobbyId), (CallResult <LobbyEnter_t> .APIDispatchDelegate)null);
 }
    ///<summary>
    /// Join a lobby
    /// <param>CSteamID object of the lobby wanting to join</param>
    ///</summary>
    public void JoinLobby(CSteamID _Lobby)
    {
        SteamAPICall_t handle = SteamMatchmaking.JoinLobby(_Lobby);

        OnLobbyEnterCallResult.Set(handle);

        if (DebugTextOn)
        {
            Debug.Log("SteamMatchmaking.JoinLobby(" + _Lobby + ") : " + handle);
        }
    }
Exemplo n.º 11
0
 public static void Join(CoopLobbyInfo info, Action callback, Action <string> callbackFail)
 {
     CoopLobbyManager.Initialize();
     CoopLobby.LeaveActive();
     if (info.LobbyId.IsValid())
     {
         CoopLobbyManager.enterCallback     = callback;
         CoopLobbyManager.enterFailCallback = callbackFail;
         SteamMatchmaking.JoinLobby(info.LobbyId);
     }
 }
 public override void Connect()
 {
     if (SteamManager.Initialized)
     {
         SteamMatchmaking.JoinLobby(new CSteamID(LobbyID));
     }
     else
     {
         Debug.Log("Error - Steamworks is not initialized!");
     }
 }
Exemplo n.º 13
0
 protected void OnGetPassword(string pwd)
 {
     if (SteamMatchmaking.GetLobbyData(lobby, "pwd").Equals(pwd))
     {
         m_JoinedLobby.Set(SteamMatchmaking.JoinLobby(lobby));
     }
     else
     {
         Debug.Log("Password doesn't match!");
         networkUIController.AlertPasswordMismatch();
     }
 }
Exemplo n.º 14
0
    public void JoinLobby(CSteamID lobbyId)
    {
        if (!SteamManager.Initialized)
        {
            lobbyConnectionState = SessionConnectionState.FAILED;
            return;
        }

        lobbyConnectionState = SessionConnectionState.CONNECTING;
        SteamMatchmaking.JoinLobby(lobbyId);
        // ...continued in OnLobbyEntered callback
    }
Exemplo n.º 15
0
        public static void JoinLobby(CSteamID LobbyID,
                                     Action <bool> OnJoinLobby,
                                     Action <int, UInt64> OnChatUpdate,
                                     Action <String, UInt64, String> OnChatMsg,
                                     Action OnDataUpdate)
        {
            SetLobbyCallbacks(OnJoinLobby, OnChatUpdate, OnChatMsg, OnDataUpdate);

            SteamAPICall_t hSteamAPICall = (SteamAPICall_t)SteamMatchmaking.JoinLobby(LobbyID);

            g_CallResultJoinLobby.Set(hSteamAPICall);
        }
Exemplo n.º 16
0
 public void Join(CSteamID lobbyId, APIDispatchDelegate <LobbyEnter_t> callResult)
 {
     //IL_0017: Unknown result type (might be due to invalid IL or missing references)
     //IL_0018: Unknown result type (might be due to invalid IL or missing references)
     //IL_001d: Unknown result type (might be due to invalid IL or missing references)
     //IL_0024: Unknown result type (might be due to invalid IL or missing references)
     if (State == LobbyState.Inactive)
     {
         State = LobbyState.Connecting;
         _lobbyEnterExternalCallback = callResult;
         SteamAPICall_t val = SteamMatchmaking.JoinLobby(lobbyId);
         _lobbyEnter.Set(val, (APIDispatchDelegate <LobbyEnter_t>)null);
     }
 }
Exemplo n.º 17
0
 public void JoinLobby(CSteamID lobby)
 {
     {
         if (RainWorldHK.mainRW.processManager.currentMainLoop is SteamMultiplayerMenu)
         {
             if (lobbyID.m_SteamID != 0)
             {
                 LeaveLobby();
             }
         }
     }
     joining = true;
     SteamMatchmaking.JoinLobby(lobby);
 }
        internal async Task JoinLobby(SteamLobby lobby)
        {
            Assert.IsNotNull(lobby);
            var id = new CSteamID(lobby.Id);

            if (_connectedLobbies.ContainsKey(id))
            {
                throw new InvalidOperationException("[Steam] Already connected to lobby.");
            }
            await SteamMatchmaking.JoinLobby(id).ToTask <LobbyEnter_t>();

            _connectedLobbies.Add(id, lobby);
            lobby.Members.Refresh();
        }
Exemplo n.º 19
0
        public async Task JoinLobby(LobbyInfo lobby)
        {
            if (!SteamManager.Initialized)
            {
                throw new InvalidOperationException("Cannot join Steam lobby if SteamManager is not initalized.");
            }
            var lobbyEnter = await SteamMatchmaking.JoinLobby(new CSteamID(lobby.Id)).ToTask <LobbyEnter_t>();

            var response = (EChatRoomEnterResponse)lobbyEnter.m_EChatRoomEnterResponse;

            if (response != EChatRoomEnterResponse.k_EChatRoomEnterResponseSuccess)
            {
                throw new Exception($"Failed to join lobby: {response}");
            }
        }
Exemplo n.º 20
0
 public void LobbyJoinRequested(GameLobbyJoinRequested_t request)
 {//Shift-Tab Menu
     {
         if (RainWorldHK.mainRW.processManager.currentMainLoop is SteamMultiplayerMenu)
         {
             if (lobbyID.m_SteamID != 0)
             {
                 LeaveLobby();
             }
         }
         ProcessManagerHK.ImmediateSwitchCustom(RainWorldHK.mainRW.processManager, new SteamMultiplayerMenu(RainWorldHK.mainRW.processManager));
     }
     joining = true;
     SteamMatchmaking.JoinLobby(request.m_steamIDLobby);
 }
 public void JoinLobby(CSteamID lobby)
 {
     {
         patch_ProcessManager patchPM = ((patch_ProcessManager)Patches.patch_Rainworld.mainRW.processManager);
         if (patchPM.currentMainLoop is SteamMultiplayerMenu)
         {
             if (lobbyID.m_SteamID != 0)
             {
                 LeaveLobby();
             }
         }
     }
     joining = true;
     SteamMatchmaking.JoinLobby(lobby);
 }
 void OnGetLobbiesList(LobbyMatchList_t result)
 {
     for (int i = 0; i < result.m_nLobbiesMatching; i++)
     {
         if (SteamMatchmaking.GetLobbyData((CSteamID)SteamMatchmaking.GetLobbyByIndex(i), "ServerIP") != "")
         {
             SteamMatchmaking.JoinLobby((CSteamID)SteamMatchmaking.GetLobbyByIndex(i));
             return;
         }
         else
         {
             awaitMsg.text = "No matches found.";
         }
     }
 }
 public void LobbyJoinRequested(GameLobbyJoinRequested_t request)  //Shift-Tab Menu
 {
     {
         patch_ProcessManager patchPM = ((patch_ProcessManager)Patches.patch_Rainworld.mainRW.processManager);
         if (patchPM.currentMainLoop is SteamMultiplayerMenu)
         {
             if (lobbyID.m_SteamID != 0)
             {
                 LeaveLobby();
             }
         }
         patchPM.ImmediateSwitchCustom(new SteamMultiplayerMenu(patchPM));
     }
     joining = true;
     SteamMatchmaking.JoinLobby(request.m_steamIDLobby);
 }
Exemplo n.º 24
0
 public static Lobby JoinLobby(ulong lobbyID)
 {
     if (!_initialized)
     {
         return(null);
     }
     if (lobby == null || lobbyID != lobby.id)
     {
         if (lobby != null)
         {
             LeaveLobby(lobby);
         }
         lobby = new Lobby(lobbyID);
     }
     SetCallResult <LobbyEnter_t>(SteamMatchmaking.JoinLobby(new CSteamID(lobbyID)));
     return(lobby);
 }
Exemplo n.º 25
0
 protected override GalaxyID getStartupLobby()
 {
     string[] args = Environment.GetCommandLineArgs();
     for (int i = 0; i < args.Length; i++)
     {
         if (args[i] == "+connect_lobby")
         {
             try
             {
                 SteamMatchmaking.JoinLobby(new CSteamID(Convert.ToUInt64(args[i + 1])));
                 return(null);
             }
             catch (Exception)
             {
             }
         }
     }
     return(null);
 }
Exemplo n.º 26
0
    // Callback for SteamMatchmaking RequestLobbyList
    private void OnLobbyMatchList(LobbyMatchList_t lobbyMatchList, bool bIOfailure)
    {
        uint num = lobbyMatchList.m_nLobbiesMatching;

        print(num);
        // If no lobbies create one
        if (num < 1)
        {
            SteamAPICall_t result = SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePublic, 2);
            m_CallResultLobbyCreated.Set(result, OnLobbyCreated);
        }
        else
        {
            CSteamID       lobby  = SteamMatchmaking.GetLobbyByIndex(0);
            SteamAPICall_t result = SteamMatchmaking.JoinLobby(lobby);
        }

        SteamAPI.RunCallbacks();
    }
    private void _on_joinSelectedButton_pressed()
    {
        if (joinSelectedButton.Text == "Join selected...")
        {
            global.playingAsHost = false;

            // Parse string from invitation tree into a CSteamID and join the lobby
            joinID = (CSteamID)ulong.Parse(invitationTree.GetSelected().GetText(1), System.Globalization.NumberStyles.None);
            SteamMatchmaking.JoinLobby(joinID);

            // Visual stuff
            joinSelectedButton.Text = "Leave lobby";
        }
        else if (joinSelectedButton.Text == "Leave lobby")
        {
            SteamMatchmaking.LeaveLobby(joinID);
            joinSelectedButton.Text = "Join selected...";
            chatField.Editable      = false;
        }
    }
Exemplo n.º 28
0
        public static void JoinLobby(CSteamID lobbyId)
        {
            if (!SteamManager.Initialized)
            {
                Connection = ConnectionState.FAILED;
                Logger.Error("CONNECTION FAILED");
                return;
            }
            if (_lobbyInfo.LobbyID.m_SteamID > 0)
            {
                Logger.Debug($"We are already in another lobby, lets disconnect first");
                Disconnect();
            }
            Connection         = ConnectionState.CONNECTING;
            _lobbyInfo.LobbyID = lobbyId;
            Scoreboard.Instance.UpsertScoreboardEntry(Controllers.PlayerController.Instance._playerInfo.playerId, Controllers.PlayerController.Instance._playerInfo.playerName);

            Logger.Debug($"Joining a new steam lobby {lobbyId}");
            SteamMatchmaking.JoinLobby(lobbyId);
        }
Exemplo n.º 29
0
        public void LobbyCreated(LobbyCreated_t result)
        {
            SteamMatchmaking.JoinLobby((CSteamID)result.m_ulSteamIDLobby);
            lobbyID   = (CSteamID)result.m_ulSteamIDLobby;
            lobbyInfo = new LobbyInfo((CSteamID)result.m_ulSteamIDLobby);
            MultiplayerChat.AddChat("Created Lobby!");
            joining = false;

            SteamMatchmaking.SetLobbyData((CSteamID)result.m_ulSteamIDLobby, MANAGER_ID, SteamUser.GetSteamID().ToString());
            lobbyInfo.owner = SteamUser.GetSteamID();
            SteamMatchmaking.SetLobbyData((CSteamID)result.m_ulSteamIDLobby, "AllowDebug", (debugAllowed ? "True" : "False"));
            lobbyInfo.debugAllowed = debugAllowed;
            SteamMatchmaking.SetLobbyData((CSteamID)result.m_ulSteamIDLobby, "SpearsHit", (spearsHit ? "True" : "False"));
            lobbyInfo.spearsHit = spearsHit;
            //SteamMatchmaking.SetLobbyData((CSteamID)result.m_ulSteamIDLobby, "OtherStart", (otherStart ? "True" : "False"));
            //lobbyInfo.otherStart = otherStart;
            lobbyInfo.memberLimit = lobbyMax;
            lobbyInfo.memberNum   = 1;
            SteamMatchmaking.SetLobbyData((CSteamID)result.m_ulSteamIDLobby, "Version", Monkland.VERSION);
            lobbyInfo.version = Monkland.VERSION;
        }
Exemplo n.º 30
0
        public override async Task <NetworkConnection> Connect(NetworkConnectionConfig config)
        {
            ValidateSteamInitalized();
            if (config.LobbyInfo == null)
            {
                throw new ArgumentException("Cannot connect to Steam networking except through a lobby.");
            }
            var id = new CSteamID(config.LobbyInfo.Id);

            Debug.Log($"[Steam] Joining lobby: {config.LobbyInfo.Id}");
            var lobbyEnter = await SteamMatchmaking.JoinLobby(id).ToTask <LobbyEnter_t>();

            var responseCode = (EChatRoomEnterResponse)lobbyEnter.m_EChatRoomEnterResponse;

            if (responseCode != EChatRoomEnterResponse.k_EChatRoomEnterResponseSuccess)
            {
                throw new NetworkingException($"Could not join lobby {lobbyEnter.m_ulSteamIDLobby}. Error: {responseCode}.");
            }
            await SteamUtility.WaitFor <LobbyDataUpdate_t>();

            currentLobbyId = new CSteamID(lobbyEnter.m_ulSteamIDLobby);
            lobbyOwner     = SteamMatchmaking.GetLobbyOwner(currentLobbyId);
            // Send initial connection packet.
            Debug.Log($"[Steam] Sending initial connection packet to lobby owner {lobbyOwner}...");
            SendPacket(lobbyOwner, null, 0);
            var connection  = AddConnection(lobbyOwner);
            var connectTask = connection.ConnectTask;

            if (await Task.WhenAny(connectTask, Task.Delay(20000)) == connectTask)
            {
                Debug.Log("[Steam] Connected to host");
                return(connection);
            }
            else
            {
                throw new NetworkingException("Could not connect to lobby host. Timeout: 20 seconds passed.");
            }
        }