示例#1
0
        // Token: 0x06000002 RID: 2 RVA: 0x000021C4 File Offset: 0x000003C4
        private static void OnGetLobbiesList(LobbyMatchList_t result)
        {
            Console.WriteLine(result.m_nLobbiesMatching);
            int num = 0;

            while ((long)num < (long)((ulong)result.m_nLobbiesMatching))
            {
                CSteamID lobbyByIndex = SteamMatchmaking.GetLobbyByIndex(num);
                Console.WriteLine(lobbyByIndex);
                string lobbyData = SteamMatchmaking.GetLobbyData(lobbyByIndex, "name");
                try
                {
                    Console.WriteLine(lobbyData.Substring(0, lobbyData.Length - 8));
                }
                catch
                {
                    Console.WriteLine("Unknown");
                }
                try
                {
                    Console.WriteLine((int)(Convert.ToInt16(SteamMatchmaking.GetLobbyData(lobbyByIndex, "type")) - 1549));
                }
                catch
                {
                    Console.WriteLine(4);
                }
                Console.WriteLine(SteamMatchmaking.GetNumLobbyMembers(lobbyByIndex));
                Console.WriteLine(SteamMatchmaking.GetLobbyMemberLimit(lobbyByIndex));
                Console.WriteLine(SteamMatchmaking.GetLobbyData(lobbyByIndex, "lobbydata"));
                num++;
            }
            Program.finished = true;
        }
示例#2
0
        private static void OnLobbyCreated(LobbyCreated_t pCallback, bool bIOFailure)
        {
            if (!SteamManager.Initialized)
            {
                Logger.Error("CONNECTION FAILED");
                return;
            }
            if (!bIOFailure)
            {
                Scoreboard.Instance.UpsertScoreboardEntry(Controllers.PlayerController.Instance._playerInfo.playerId, Controllers.PlayerController.Instance._playerInfo.playerName);
                _lobbyInfo.LobbyID    = new CSteamID(pCallback.m_ulSteamIDLobby);
                _lobbyInfo.TotalSlots = SteamMatchmaking.GetLobbyMemberLimit(_lobbyInfo.LobbyID);
                _lobbyInfo.HostName   = GetUserName();
                Logger.Debug($"Lobby has been created");
                var hostUserId = SteamMatchmaking.GetLobbyOwner(_lobbyInfo.LobbyID);
                SteamMatchmaking.SetLobbyData(_lobbyInfo.LobbyID, "version", PACKET_VERSION);

                var me = SteamUser.GetSteamID();
                Connection = ConnectionState.CONNECTED;
                if (hostUserId.m_SteamID == me.m_SteamID)
                {
                    setLobbyStatus("Waiting In Menu");

                    SendLobbyInfo(true);
                }
            }
        }
        /// <summary>
        ///     Called when the local player joins the lobby.
        /// </summary>
        /// <param name="connection"></param>
        private void OnLobbyLocalPeerConnected(SteamConnection connection)
        {
            network.LocalConnection = connection;
            network.MaxPlayers      = SteamMatchmaking.GetLobbyMemberLimit(connection.LobbyID);
            network.OnSetDefaultLobbyMemberData(connection);

            // Get Lobby Member Data
            int numMembers = SteamMatchmaking.GetNumLobbyMembers(connection.LobbyID);

            for (int i = 0; i < numMembers; i++)
            {
                CSteamID id = SteamMatchmaking.GetLobbyMemberByIndex(connection.LobbyID, i);
                if (id == connection.SteamID)
                {
                    continue;
                }
                connection.AddConnection(id);
            }

            //GetModule<AuthModule>().BeginAuthentication(authenticationLevel);
            if (connection.IsHost)
            {
                HostSetup?.Invoke(connection);
            }
            else
            {
                ClientSetup?.Invoke(connection);
            }

            connection.IsConnected = true;
        }
示例#4
0
        void UpdateLobbyInfo(LobbyInfo info)
        {
            var lobbyId = new CSteamID(info.Id);

            info.Name           = SteamMatchmaking.GetLobbyData(lobbyId, kNameKey);
            info.OnwerName      = SteamMatchmaking.GetLobbyData(lobbyId, kOwnerName);
            info.CurrentPlayers = SteamMatchmaking.GetNumLobbyMembers(lobbyId);
            info.MaxPlayers     = SteamMatchmaking.GetLobbyMemberLimit(lobbyId);
        }
示例#5
0
 public void UpdateData()
 {
     this.Name = SteamMatchmaking.GetLobbyData(this.LobbyId, "name");
     this.Guid = SteamMatchmaking.GetLobbyData(this.LobbyId, "guid");
     if (!int.TryParse(SteamMatchmaking.GetLobbyData(this.LobbyId, "currentmembers"), out this.CurrentMembers))
     {
         this.CurrentMembers = 0;
     }
     this.Destroyed   = (SteamMatchmaking.GetLobbyData(this.LobbyId, "destroyed") == "YES");
     this.MemberLimit = SteamMatchmaking.GetLobbyMemberLimit(this.LobbyId);
 }
示例#6
0
    //join match based on ELO, game mode, etc
    //host new game if none found
    public void ui_join_match()
    {
        foreach (var lobby in SteamHub.LobbyList)
        {
            int lobbyMaxMembers = SteamMatchmaking.GetLobbyMemberLimit(lobby.LobbyId);

            if (lobby.MembersCount < lobbyMaxMembers)
            {
                SteamHub.Lobby_Join(lobby);
            }

            break;
        }
    }
    void UpdateLobbyInfo( CSteamID steamIDLobby, ref Lobby outLobby )
    {
        outLobby.m_SteamID = steamIDLobby;
        outLobby.m_Owner = SteamMatchmaking.GetLobbyOwner( steamIDLobby );
        outLobby.m_Members = new LobbyMembers[SteamMatchmaking.GetNumLobbyMembers(steamIDLobby)];
        outLobby.m_MemberLimit = SteamMatchmaking.GetLobbyMemberLimit(steamIDLobby);

        int nDataCount = SteamMatchmaking.GetLobbyDataCount(steamIDLobby);
        outLobby.m_Data = new LobbyMetaData[nDataCount];
        for (int i = 0; i < nDataCount; ++i)
        {
            bool lobbyDataRet = SteamMatchmaking.GetLobbyDataByIndex(steamIDLobby, i, out outLobby.m_Data[i].m_Key, Constants.k_nMaxLobbyKeyLength, out outLobby.m_Data[i].m_Value, Constants.k_cubChatMetadataMax);
            if (!lobbyDataRet)
            {
                Debug.LogError("SteamMatchmaking.GetLobbyDataByIndex returned false.");
                continue;
            }

        }
    }
	void OnLobbyEnter(LobbyEnter_t pCallback, bool bIOFailure) {
		if (bIOFailure) {
			ESteamAPICallFailure reason = SteamUtils.GetAPICallFailureReason(m_LobbyEnterCallResult.Handle);
			Debug.LogError("OnLobbyEnter encountered an IOFailure due to: " + reason);
			return; // TODO: Recovery
		}

		Debug.Log("[" + LobbyEnter_t.k_iCallback + " - LobbyEnter] - " + pCallback.m_ulSteamIDLobby + " -- " + pCallback.m_rgfChatPermissions + " -- " + pCallback.m_bLocked + " -- " + (EChatRoomEnterResponse)pCallback.m_EChatRoomEnterResponse);
		
		m_LobbyEnterResponse = (EChatRoomEnterResponse)pCallback.m_EChatRoomEnterResponse;
		
		if(m_LobbyEnterResponse != EChatRoomEnterResponse.k_EChatRoomEnterResponseSuccess) {
			ChangeState(EChatClientState.FailedToJoin);
			return;
		}
		
		m_CurrentLobby.m_SteamID = (CSteamID)pCallback.m_ulSteamIDLobby;
		m_CurrentLobby.m_Members = new LobbyMembers[SteamMatchmaking.GetNumLobbyMembers(m_CurrentLobby.m_SteamID)];
		m_CurrentLobby.m_MemberLimit = SteamMatchmaking.GetLobbyMemberLimit(m_CurrentLobby.m_SteamID);

		ChangeState(EChatClientState.InLobby);
	}
示例#9
0
        /// <summary>
        /// Handle the RequestLobbyData Steam API callback
        /// </summary>
        /// <param name="result">The <see cref="LobbyDataUpdate_t"/> result set</param>
        private void OnLobbyDataUpdated(LobbyDataUpdate_t result)
        {
            for (int i = 0; i < serverList.Count; i++)
            {
                if (serverList[i].SteamId.m_SteamID == result.m_ulSteamIDLobby)
                {
                    // Lobby no longer exists so remove it from the list
                    if (result.m_bSuccess == 0)
                    {
                        RemoveServer(i);
                        return;
                    }

                    serverList[i].ListItem.serverName.text = SteamMatchmaking.GetLobbyData(serverList[i].SteamId, "name");
                    serverList[i].ListItem.gameType.text   = SteamMatchmaking.GetLobbyData(serverList[i].SteamId, "fnr_gameType");
                    serverList[i].ListItem.gameMode.text   = SteamMatchmaking.GetLobbyData(serverList[i].SteamId, "fnr_gameMode");
                    var maxPlayers  = SteamMatchmaking.GetLobbyMemberLimit(serverList[i].SteamId);
                    var currPlayers = SteamMatchmaking.GetNumLobbyMembers(serverList[i].SteamId);
                    serverList[i].ListItem.playerCount.text = $"{currPlayers}/{maxPlayers}";
                    return;
                }
            }
        }
示例#10
0
            public bool UpdateLobbyInfo(CSteamID lobbyID)
            {
                bool success = true;

                if (lobbyID.m_SteamID == 0)
                {
                    return(false);
                }
                this.ID = lobbyID;
                string ownerData = SteamMatchmaking.GetLobbyData(lobbyID, MANAGER_ID);

                if (string.IsNullOrEmpty(ownerData))
                {
                    success = false;
                }
                else
                {
                    this.owner = new CSteamID(ulong.Parse(ownerData));
                }
                if (owner.m_SteamID == 0)
                {
                    success = false;
                }
                this.debugAllowed = (SteamMatchmaking.GetLobbyData(lobbyID, "AllowDebug") == "True");
                this.spearsHit    = (SteamMatchmaking.GetLobbyData(lobbyID, "SpearsHit") == "True");
                //this.otherStart = (SteamMatchmaking.GetLobbyData(lobbyID, "OtherStart") == "True");
                this.version = SteamMatchmaking.GetLobbyData(lobbyID, "Version");
                if (string.IsNullOrEmpty(this.version))
                {
                    this.version = Monkland.VERSION;
                    success      = false;
                }
                this.memberLimit = SteamMatchmaking.GetLobbyMemberLimit(lobbyID);
                this.memberNum   = SteamMatchmaking.GetNumLobbyMembers(lobbyID);
                return(success);
            }
示例#11
0
    void UpdateLobbyInfo(ref Lobby outLobby)
    {
        outLobby.m_SteamID     = Sender.roomid;
        outLobby.m_Owner       = SteamMatchmaking.GetLobbyOwner(Sender.roomid);
        outLobby.m_Members     = new LobbyMembers[SteamMatchmaking.GetNumLobbyMembers(Sender.roomid)];
        outLobby.m_MemberLimit = SteamMatchmaking.GetLobbyMemberLimit(Sender.roomid);

        int nDataCount = SteamMatchmaking.GetLobbyDataCount(Sender.roomid);

        outLobby.m_Data = new LobbyMetaData[nDataCount];

        int Ucount = SteamMatchmaking.GetNumLobbyMembers(Sender.roomid);

        //ULS.CreateDs(Ucount);
        for (int i = 0; i < nDataCount; ++i)
        {
            bool lobby_data_ret = SteamMatchmaking.GetLobbyDataByIndex(Sender.roomid, i, out outLobby.m_Data[i].m_Key, Constants.k_nMaxLobbyKeyLength, out outLobby.m_Data[i].m_Value, Constants.k_cubChatMetadataMax);
            if (lobby_data_ret)
            {
                continue;
            }
            Debug.LogError("SteamMatchmaking.GetLobbyDataByIndex returned false.");
            continue;
        }
        //Notready.text = SteamMatchmaking.GetLobbyMemberData(Sender.roomid, SteamUser.GetSteamID(), "key_ready");
        int rc = 0;
        int gc = 0;

        for (int i = 0; i < outLobby.m_Members.Length; i++)
        {
            outLobby.m_Members[i].m_SteamID = SteamMatchmaking.GetLobbyMemberByIndex(Sender.roomid, i);
            //ULS.UDs[i].GetComponent<UserDetailScript>().HomeWork(outLobby.m_Members[i].m_SteamID);
            outLobby.m_Members[i].m_Data = new LobbyMetaData[1];
            LobbyMetaData lmd = new LobbyMetaData();
            lmd.m_Key   = "key_ready";
            lmd.m_Value = SteamMatchmaking.GetLobbyMemberData(Sender.roomid, outLobby.m_Members[i].m_SteamID, lmd.m_Key);
            if (lmd.m_Value == "READY")
            {
                rc++;
            }
            if (lmd.m_Value == "GREEN")
            {
                gc++;
            }
            outLobby.m_Members[i].m_Data[0] = lmd;
            //ULS.UDs[i].GetComponent<UserDetailScript>().Uready.text = lmd.m_Value;
            if (outLobby.m_Members[i].m_SteamID == SteamUser.GetSteamID())
            {
                MPControl(lmd.m_Value);
            }
        }
        if (rc == outLobby.m_MemberLimit)
        {
            if (rc == 1)
            {
                TestStart();
            }
            else
            {
                GameStart(rc);
            }
        }
        if (gc == outLobby.m_MemberLimit && SteamMatchmaking.GetLobbyOwner(Sender.roomid) == SteamUser.GetSteamID())
        {
            Debug.Log("All Players Green");
            Startbutton.interactable = true;
        }
    }
    public void RenderOnGUI()
    {
        //GUILayout.BeginArea(new Rect(Screen.width - 120, 0, 120, Screen.height));
        Console.WriteLine("Variables:");
        Console.WriteLine("m_Lobby: " + m_Lobby);
        //GUILayout.EndArea();

        Console.WriteLine("GetFavoriteGameCount() : " + SteamMatchmaking.GetFavoriteGameCount());

        {
            AppId_t AppID;
            uint    IP;
            ushort  ConnPort;
            ushort  QueryPort;
            uint    Flags;
            uint    LastPlayedOnServer;
            bool    ret = SteamMatchmaking.GetFavoriteGame(0, out AppID, out IP, out ConnPort, out QueryPort, out Flags, out LastPlayedOnServer);
            Console.WriteLine("GetFavoriteGame(0, out AppID, out IP, out ConnPort, out QueryPort, out Flags, out LastPlayedOnServer) : " + ret + " -- " + AppID + " -- " + IP + " -- " + ConnPort + " -- " + QueryPort + " -- " + Flags + " -- " + LastPlayedOnServer);
        }

        // 3494815209 = 208.78.165.233 = Valve Payload Server (Virginia srcds150 #1)
        //if (GUILayout.Button("AddFavoriteGame((AppId_t)480, 3494815209, 27015, 27015, Constants.k_unFavoriteFlagFavorite, CurrentUnixTime"))
        {
            uint CurrentUnixTime = (uint)(System.DateTime.UtcNow.Subtract(new System.DateTime(1970, 1, 1))).TotalSeconds;
            Console.WriteLine("SteamMatchmaking.AddFavoriteGame(" + (AppId_t)480 + ", 3494815209, 27015, 27015, Constants.k_unFavoriteFlagFavorite, " + CurrentUnixTime + ") : " + SteamMatchmaking.AddFavoriteGame((AppId_t)480, 3494815209, 27015, 27015, Constants.k_unFavoriteFlagFavorite, CurrentUnixTime));
        }

        //if (GUILayout.Button("RemoveFavoriteGame((AppId_t)480, 3494815209, 27015, 27015, Constants.k_unFavoriteFlagFavorite)"))
        {
            Console.WriteLine("SteamMatchmaking.RemoveFavoriteGame(" + (AppId_t)480 + ", 3494815209, 27015, 27015, Constants.k_unFavoriteFlagFavorite) : " + SteamMatchmaking.RemoveFavoriteGame((AppId_t)480, 3494815209, 27015, 27015, Constants.k_unFavoriteFlagFavorite));
        }

        //if (GUILayout.Button("RequestLobbyList()"))
        {
            SteamAPICall_t handle = SteamMatchmaking.RequestLobbyList();
            OnLobbyMatchListCallResult.Set(handle);
            Console.WriteLine("SteamMatchmaking.RequestLobbyList() : " + handle);
        }

        //if (GUILayout.Button("AddRequestLobbyListStringFilter(\"SomeStringKey\", \"SomeValue\", ELobbyComparison.k_ELobbyComparisonNotEqual)"))
        {
            SteamMatchmaking.AddRequestLobbyListStringFilter("SomeStringKey", "SomeValue", ELobbyComparison.k_ELobbyComparisonNotEqual);
            Console.WriteLine("SteamMatchmaking.AddRequestLobbyListStringFilter(\"SomeStringKey\", \"SomeValue\", ELobbyComparison.k_ELobbyComparisonNotEqual)");
        }

        //if (GUILayout.Button("AddRequestLobbyListNumericalFilter(\"SomeIntKey\", 0, ELobbyComparison.k_ELobbyComparisonNotEqual)"))
        {
            SteamMatchmaking.AddRequestLobbyListNumericalFilter("SomeIntKey", 0, ELobbyComparison.k_ELobbyComparisonNotEqual);
            Console.WriteLine("SteamMatchmaking.AddRequestLobbyListNumericalFilter(\"SomeIntKey\", 0, ELobbyComparison.k_ELobbyComparisonNotEqual)");
        }

        //if (GUILayout.Button("AddRequestLobbyListNearValueFilter(\"SomeIntKey\", 0)"))
        {
            SteamMatchmaking.AddRequestLobbyListNearValueFilter("SomeIntKey", 0);
            Console.WriteLine("SteamMatchmaking.AddRequestLobbyListNearValueFilter(\"SomeIntKey\", 0)");
        }

        //if (GUILayout.Button("AddRequestLobbyListFilterSlotsAvailable(3)"))
        {
            SteamMatchmaking.AddRequestLobbyListFilterSlotsAvailable(3);
            Console.WriteLine("SteamMatchmaking.AddRequestLobbyListFilterSlotsAvailable(3)");
        }

        //if (GUILayout.Button("AddRequestLobbyListDistanceFilter(ELobbyDistanceFilter.k_ELobbyDistanceFilterWorldwide)"))
        {
            SteamMatchmaking.AddRequestLobbyListDistanceFilter(ELobbyDistanceFilter.k_ELobbyDistanceFilterWorldwide);
            Console.WriteLine("SteamMatchmaking.AddRequestLobbyListDistanceFilter(ELobbyDistanceFilter.k_ELobbyDistanceFilterWorldwide)");
        }

        //if (GUILayout.Button("AddRequestLobbyListResultCountFilter(1)"))
        {
            SteamMatchmaking.AddRequestLobbyListResultCountFilter(1);
            Console.WriteLine("SteamMatchmaking.AddRequestLobbyListResultCountFilter(1)");
        }

        //if (GUILayout.Button("AddRequestLobbyListCompatibleMembersFilter((CSteamID)0)"))
        {
            SteamMatchmaking.AddRequestLobbyListCompatibleMembersFilter((CSteamID)0);
            Console.WriteLine("SteamMatchmaking.AddRequestLobbyListCompatibleMembersFilter((CSteamID)0)");
        }

        //if (GUILayout.Button("GetLobbyByIndex(0)"))
        {
            m_Lobby = SteamMatchmaking.GetLobbyByIndex(0);
            Console.WriteLine("SteamMatchmaking.SteamMatchmaking.GetLobbyByIndex(0) : " + m_Lobby);
        }

        //if (GUILayout.Button("CreateLobby(ELobbyType.k_ELobbyTypePublic, 1)"))
        {
            SteamAPICall_t handle = SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePublic, 1);
            OnLobbyCreatedCallResult.Set(handle);
            Console.WriteLine("SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePublic, 1) : " + handle);
        }

        //if (GUILayout.Button("JoinLobby(m_Lobby)"))
        {
            SteamAPICall_t handle = SteamMatchmaking.JoinLobby(m_Lobby);
            OnLobbyEnterCallResult.Set(handle);
            Console.WriteLine("SteamMatchmaking.JoinLobby(" + m_Lobby + ") : " + handle);
        }

        //if (GUILayout.Button("LeaveLobby(m_Lobby)"))
        {
            SteamMatchmaking.LeaveLobby(m_Lobby);
            m_Lobby = CSteamID.Nil;
            Console.WriteLine("SteamMatchmaking.LeaveLobby(" + m_Lobby + ")");
        }

        //if (GUILayout.Button("InviteUserToLobby(m_Lobby, SteamUser.GetSteamID())"))
        {
            Console.WriteLine("SteamMatchmaking.InviteUserToLobby(" + m_Lobby + ", SteamUser.GetSteamID()) : " + SteamMatchmaking.InviteUserToLobby(m_Lobby, SteamUser.GetSteamID()));
        }

        Console.WriteLine("GetNumLobbyMembers(m_Lobby) : " + SteamMatchmaking.GetNumLobbyMembers(m_Lobby));

        Console.WriteLine("GetLobbyMemberByIndex(m_Lobby, 0) : " + SteamMatchmaking.GetLobbyMemberByIndex(m_Lobby, 0));

        Console.WriteLine("SteamMatchmaking.GetLobbyData(m_Lobby, \"name\") : " + SteamMatchmaking.GetLobbyData(m_Lobby, "name"));

        //if (GUILayout.Button("SetLobbyData(m_Lobby, \"name\", \"Test Lobby!\")"))
        {
            Console.WriteLine("SteamMatchmaking.SetLobbyData(" + m_Lobby + ", \"name\", \"Test Lobby!\") : " + SteamMatchmaking.SetLobbyData(m_Lobby, "name", "Test Lobby!"));
        }

        Console.WriteLine("GetLobbyDataCount(m_Lobby) : " + SteamMatchmaking.GetLobbyDataCount(m_Lobby));

        {
            string Key;
            string Value;
            bool   ret = SteamMatchmaking.GetLobbyDataByIndex(m_Lobby, 0, out Key, 255, out Value, 255);
            Console.WriteLine("SteamMatchmaking.GetLobbyDataByIndex(m_Lobby, 0, out Key, 255, out Value, 255) : " + ret + " -- " + Key + " -- " + Value);
        }

        //if (GUILayout.Button("DeleteLobbyData(m_Lobby, \"name\")"))
        {
            Console.WriteLine("SteamMatchmaking.DeleteLobbyData(" + m_Lobby + ", \"name\") : " + SteamMatchmaking.DeleteLobbyData(m_Lobby, "name"));
        }

        {
            Console.WriteLine("SteamMatchmaking.GetLobbyMemberData(m_Lobby, SteamUser.GetSteamID(), \"test\") : " + SteamMatchmaking.GetLobbyMemberData(m_Lobby, SteamUser.GetSteamID(), "test"));
        }

        //if (GUILayout.Button("SetLobbyMemberData(m_Lobby, \"test\", \"This is a test Key!\")"))
        {
            SteamMatchmaking.SetLobbyMemberData(m_Lobby, "test", "This is a test Key!");
            Console.WriteLine("SteamMatchmaking.SetLobbyMemberData(" + m_Lobby + ", \"test\", \"This is a test Key!\")");
        }

        //if (GUILayout.Button("SendLobbyChatMsg(m_Lobby, MsgBody, MsgBody.Length)"))
        {
            byte[] MsgBody = System.Text.Encoding.UTF8.GetBytes("Test Message!");
            Console.WriteLine("SteamMatchmaking.SendLobbyChatMsg(" + m_Lobby + ", MsgBody, MsgBody.Length) : " + SteamMatchmaking.SendLobbyChatMsg(m_Lobby, MsgBody, MsgBody.Length));
        }

        //GetLobbyChatEntry(CSteamID steamIDLobby, int iChatID, out CSteamID pSteamIDUser, byte[] pvData, int cubData, out EChatEntryType peChatEntryType); // Only called from within OnLobbyChatMsg!

        //if (GUILayout.Button("RequestLobbyData(m_Lobby)"))
        {
            Console.WriteLine("SteamMatchmaking.RequestLobbyData(" + m_Lobby + ") : " + SteamMatchmaking.RequestLobbyData(m_Lobby));
        }

        //if (GUILayout.Button("SetLobbyGameServer(m_Lobby, 2130706433, 1337, CSteamID.NonSteamGS)"))
        {
            SteamMatchmaking.SetLobbyGameServer(m_Lobby, 2130706433, 1337, CSteamID.NonSteamGS); //127.0.0.1
            Console.WriteLine("SteamMatchmaking.SetLobbyGameServer(" + m_Lobby + ", 2130706433, 1337, CSteamID.NonSteamGS)");
        }

        {
            uint     GameServerIP;
            ushort   GameServerPort;
            CSteamID SteamIDGameServer;
            bool     ret = SteamMatchmaking.GetLobbyGameServer(m_Lobby, out GameServerIP, out GameServerPort, out SteamIDGameServer);
            Console.WriteLine("GetLobbyGameServer(m_Lobby, out GameServerIP, out GameServerPort, out SteamIDGameServer) : " + ret + " -- " + GameServerIP + " -- " + GameServerPort + " -- " + SteamIDGameServer);
        }

        //if (GUILayout.Button("SetLobbyMemberLimit(m_Lobby, 6)"))
        {
            Console.WriteLine("SteamMatchmaking.SteamMatchmaking.SetLobbyMemberLimit(" + m_Lobby + ", 6) : " + SteamMatchmaking.SetLobbyMemberLimit(m_Lobby, 6));
        }

        Console.WriteLine("GetLobbyMemberLimit(m_Lobby) : " + SteamMatchmaking.GetLobbyMemberLimit(m_Lobby));

        //if (GUILayout.Button("SetLobbyType(m_Lobby, ELobbyType.k_ELobbyTypePublic))"))
        {
            Console.WriteLine("SteamMatchmaking.SetLobbyType(" + m_Lobby + ", ELobbyType.k_ELobbyTypePublic)) : " + SteamMatchmaking.SetLobbyType(m_Lobby, ELobbyType.k_ELobbyTypePublic));
        }

        //if (GUILayout.Button("SetLobbyJoinable(m_Lobby, true)"))
        {
            Console.WriteLine("SteamMatchmaking.SetLobbyJoinable(" + m_Lobby + ", true) : " + SteamMatchmaking.SetLobbyJoinable(m_Lobby, true));
        }

        //if (GUILayout.Button("GetLobbyOwner(m_Lobby)"))
        {
            Console.WriteLine("SteamMatchmaking.GetLobbyOwner(" + m_Lobby + ") : " + SteamMatchmaking.GetLobbyOwner(m_Lobby));
        }

        //if (GUILayout.Button("SetLobbyOwner(m_Lobby, SteamUser.GetSteamID())"))
        {
            Console.WriteLine("SteamMatchmaking.SteamMatchmaking.SetLobbyOwner(" + m_Lobby + ", SteamUser.GetSteamID()) : " + SteamMatchmaking.SetLobbyOwner(m_Lobby, SteamUser.GetSteamID()));
        }

        //if (GUILayout.Button("SetLinkedLobby(m_Lobby, m_Lobby)"))
        {
            Console.WriteLine("SteamMatchmaking.SteamMatchmaking.SetLinkedLobby(" + m_Lobby + ", " + m_Lobby + ") : " + SteamMatchmaking.SetLinkedLobby(m_Lobby, m_Lobby));
        }
    }
 //get the limit for the given lobby
 public int GetLobbyMemberLimit(CSteamID lobby)
 {
     return(SteamMatchmaking.GetLobbyMemberLimit(lobby));
 }
示例#14
0
        public static int GetLobbyCapacity(int Index)
        {
            CSteamID steamIDLobby = GetLobby(Index);

            return(SteamMatchmaking.GetLobbyMemberLimit(steamIDLobby));
        }
示例#15
0
    private void MyCallbacks_LobbyListUpdated()
    {
        // Clear the Lobby List and Members List Panels
        foreach (Transform child in LobbyDetailsPanel.transform)
        {
            GameObject.Destroy(child.gameObject);
        }
        foreach (Transform child in LobbyMembersListPanel.transform)
        {
            GameObject.Destroy(child.gameObject);
        }

        // Instantiate the gameobject for the Each Lobby panel row
        foreach (var lobby in SteamHub.LobbyList)
        {
            string lobbyName = lobby.GetData <String>("name");
            if (lobbyName == null || lobbyName == "")
            {
                lobbyName = "<unnamed>";
            }

            GameObject lobbyRow = (GameObject)Instantiate(LobbyDetailsRowPanelPrefab, new Vector3(1, 1, 1), Quaternion.identity);
            lobbyRow.transform.SetParent(LobbyDetailsPanel.transform, false);
            lobbyRow.transform.localScale = new Vector3(1, 1, 1);
            lobbyRow.name = "Lobby details row for Lobby ID #" + lobby.LobbyId.ToString();

            Text t2 = lobbyRow.transform.Find("Lobby Details Text").GetComponent <Text>();

            Boolean isLobbyActive = (SteamHub.LobbyActive != null && lobby.LobbyId == SteamHub.LobbyActive.LobbyId);



            int lobbyMaxMembers = SteamMatchmaking.GetLobbyMemberLimit(lobby.LobbyId);


            String str = isLobbyActive ? "(A) " : "     ";
            str += "Lobby \"" + lobbyName + "\" #";
            str += lobby.LobbyId.ToString() + ": ";
            // str += "[" + lobby.MembersCount.ToString() + "/" + lobbyMaxMembers.ToString() + "] ";
            str += lobby.IsOwner ? " (OWNER)" : "";

            t2.text = str;

            Text t1 = lobbyRow.transform.Find("NumberOfPlayerText").GetComponent <Text>();
            t1.text = lobby.MembersCount.ToString() + "/" + lobbyMaxMembers.ToString();

            Image fill = lobbyRow.transform.Find("VisualFeedback").GetComponent <Image>();
            fill.fillAmount = (float)lobby.MembersCount / lobbyMaxMembers;

            Button joinButton = lobbyRow.transform.Find("Join Button").GetComponent <Button>();
            if (isLobbyActive)
            {
                // Provide a leave button
                Text joinButtonLabelText = (Text)joinButton.transform.GetChild(0).GetComponent <Text>();
                joinButtonLabelText.text = "LEAVE";
                var lob = lobby;    // Capture it for the lambda
                joinButton.onClick.AddListener(() => ui_click_leaveLobbyButtonPressed(joinButton, lob));

                // Instantiate the gameobject for the Each Lobby panel row
                foreach (var m in lobby.AllMembers)
                {
                    GameObject memberRow = (GameObject)Instantiate(LobbyMemberDetailsRowPanelPrefab, new Vector3(1, 1, 1), Quaternion.identity);
                    memberRow.transform.SetParent(LobbyMembersListPanel.transform, false);
                    memberRow.transform.localScale = new Vector3(1, 1, 1);
                    memberRow.name = "Member details row for Member ID #" + m.m_SteamID.ToString();
                    Text t3 = memberRow.transform.Find("Member Details Text").GetComponent <Text>();

                    Image LargeAvatar = memberRow.transform.Find("ProfileImage").GetComponent <Image>();

                    int  FriendAvatar = SteamFriends.GetSmallFriendAvatar(m);
                    uint ImageWidth;
                    uint ImageHeight;
                    bool ret = Steamworks.SteamUtils.GetImageSize(FriendAvatar, out ImageWidth, out ImageHeight);

                    if (ret && ImageWidth > 0 && ImageHeight > 0)
                    {
                        byte[] Image = new byte[ImageWidth * ImageHeight * 4];

                        ret = Steamworks.SteamUtils.GetImageRGBA(FriendAvatar, Image, (int)(ImageWidth * ImageHeight * 4));
                        if (ret)
                        {
                            m_LargeAvatar = new Texture2D((int)ImageWidth, (int)ImageHeight, TextureFormat.RGBA32, false, true);
                            m_LargeAvatar.LoadRawTextureData(Image);
                            m_LargeAvatar.Apply();

                            LargeAvatar.GetComponent <Image>().sprite = Sprite.Create(m_LargeAvatar, new Rect(0, 0, 32, 32), new Vector2(32, 32));
                        }
                    }


                    string mName  = SteamFriends.GetFriendPersonaName(m);
                    string inGame = "";
                    if (lobby.GetData <string>(m.ToString()) == "true")
                    {
                        inGame = " (IN GAME) ";
                    }
                    t3.text = inGame + "Member \"" + mName + "\" ID #" + m.m_SteamID.ToString();

                    Button kickButton = memberRow.transform.Find("Kick Button").GetComponent <Button>();
                    if (lobby.IsOwner)
                    {
                        var lobKick      = lobby; // Capture it for the lambda that follows
                        var memberToKick = m;
                        kickButton.onClick.AddListener(() => ui_click_kickFromLobbyButtonPressed(kickButton, lobKick, memberToKick));
                    }
                    else
                    {
                        kickButton.interactable = false;
                    }

                    if (lobby.OwnerId == (CSteamID)m.m_SteamID)
                    {
                        kickButton.interactable = false;
                    }
                }
            }
            else
            {
                // Provide a join button
                var lobJoin = lobby;    // Capture it for the lambda that follows
                joinButton.onClick.AddListener(() => ui_click_joinLobbyButtonPressed(joinButton, lobJoin));
            }
        }

        // Yay all done
    }
    public void OnGUI()
    {
        //only show this menu if we have a lobby
        if (currentLobby == null)
        {
            GUILayout.Label("Create A Lobby");

            GUILayout.Label("Lobby Name:");
            lobbyName = GUILayout.TextField(lobbyName, 20);
            GUILayout.Label("Lobby Summary: ");
            lobbySummary = GUILayout.TextField(lobbySummary, 20);

            if (GUILayout.Button("Create Lobby"))
            {
                //create a lobby here - public, 2 players
                CreateLobby(ELobbyType.k_ELobbyTypePublic, 2);
            }


            GUILayout.FlexibleSpace();

            if (GUILayout.Button("Get A List of Lobbies"))
            {
                RequestLobbyList();
            }

            //list all the lobbies and create join buttons for them
            for (int i = 0; i < m_LobbyList.Count; i++)
            {
                GUILayout.BeginHorizontal();

                //display lobby name
                GUILayout.Label(m_LobbyList [i].name);
                //join button
                if (GUILayout.Button("Join"))
                {
                    //join the lobby
                    JoinLobby(m_LobbyList [i].lobby);
                    //set the lobby to our class level var
                    m_Lobby = m_LobbyList [i].lobby;
                }

                GUILayout.EndHorizontal();
            }
        }
        else
        {
            //general lobby information
            GUILayout.Label("Lobby Name: " + currentLobby.name);
            GUILayout.Label("Lobby: " + currentLobby.lobby);
            GUILayout.Label("GetNumLobbyMembers(m_Lobby) : " + SteamMatchmaking.GetNumLobbyMembers(currentLobby.lobby) + " | " + SteamMatchmaking.GetLobbyMemberLimit(currentLobby.lobby));
            GUILayout.Label("Lobby Owner: " + SteamFriends.GetFriendPersonaName(SteamMatchmaking.GetLobbyOwner(currentLobby.lobby)));

            //give the user an option to leave the lobby
            if (GUILayout.Button("Leave Lobby"))
            {
                LeaveLobby(currentLobby.lobby);
            }

            if (m_ChatMessages.Count != 0)
            {
                //display all the chat messages we need
                GUILayout.Label("Chat Messages: ");

                //list all the lobbies and create join buttons for them
                for (int i = 0; i < m_ChatMessages.Count; i++)
                {
                    GUILayout.BeginHorizontal();
                    //display the steam user name that sent the message
                    GUILayout.Label(m_ChatMessages[i].steamPersonaName + ": ");
                    //display the chat message
                    GUILayout.Label(m_ChatMessages[i].message);
                    GUILayout.EndHorizontal();
                }
            }

            //create an area for us to write chat messages
            GUILayout.Space(10);
            GUILayout.Label("Lobby Chat Message: ");
            lobbyChatMessage = GUILayout.TextField(lobbyChatMessage, 100);
            if (GUILayout.Button(">> Send Lobby Chat Message <<"))
            {
                byte[] MsgBody = System.Text.Encoding.UTF8.GetBytes(lobbyChatMessage);
                SteamMatchmaking.SendLobbyChatMsg(currentLobby.lobby, MsgBody, MsgBody.Length);
                // print("SteamMatchmaking.SendLobbyChatMsg(" + currentLobby.lobby + ", MsgBody, MsgBody.Length) : " + SteamMatchmaking.SendLobbyChatMsg(currentLobby.lobby, MsgBody, MsgBody.Length));
            }
            GUILayout.Space(10);

            //only display this button if we have 2 people in the lobby
            if (SteamMatchmaking.GetNumLobbyMembers(currentLobby.lobby) == 2)
            {
                if (GUILayout.Button("Start Game"))
                {
                    Debug.Log("Punch It Chewie");
                }
            }
        }
    }
示例#17
0
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height));
        GUILayout.Label("Variables:");
        GUILayout.Label("m_Lobby: " + m_Lobby);
        GUILayout.EndArea();

        GUILayout.BeginVertical("box");
        m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33));

        GUILayout.Label("GetFavoriteGameCount() : " + SteamMatchmaking.GetFavoriteGameCount());

        {
            AppId_t AppID;
            uint    IP;
            ushort  ConnPort;
            ushort  QueryPort;
            uint    Flags;
            uint    LastPlayedOnServer;
            bool    ret = SteamMatchmaking.GetFavoriteGame(0, out AppID, out IP, out ConnPort, out QueryPort, out Flags, out LastPlayedOnServer);
            GUILayout.Label("GetFavoriteGame(0, out AppID, out IP, out ConnPort, out QueryPort, out Flags, out LastPlayedOnServer) : " + ret + " -- " + AppID + " -- " + IP + " -- " + ConnPort + " -- " + QueryPort + " -- " + Flags + " -- " + LastPlayedOnServer);
        }

        if (GUILayout.Button("AddFavoriteGame(TestConstants.Instance.k_AppId_TeamFortress2, TestConstants.k_IpAddress208_78_165_233_uint, TestConstants.k_Port27015, TestConstants.k_Port27015, Constants.k_unFavoriteFlagFavorite, CurrentUnixTime)"))
        {
            uint CurrentUnixTime = (uint)(System.DateTime.UtcNow.Subtract(new System.DateTime(1970, 1, 1))).TotalSeconds;
            int  ret             = SteamMatchmaking.AddFavoriteGame(TestConstants.Instance.k_AppId_TeamFortress2, TestConstants.k_IpAddress208_78_165_233_uint, TestConstants.k_Port27015, TestConstants.k_Port27015, Constants.k_unFavoriteFlagFavorite, CurrentUnixTime);
            print("SteamMatchmaking.AddFavoriteGame(" + TestConstants.Instance.k_AppId_TeamFortress2 + ", " + TestConstants.k_IpAddress208_78_165_233_uint + ", " + TestConstants.k_Port27015 + ", " + TestConstants.k_Port27015 + ", " + Constants.k_unFavoriteFlagFavorite + ", " + CurrentUnixTime + ") : " + ret);
        }

        if (GUILayout.Button("RemoveFavoriteGame(TestConstants.Instance.k_AppId_TeamFortress2, TestConstants.k_IpAddress208_78_165_233_uint, TestConstants.k_Port27015, TestConstants.k_Port27015, Constants.k_unFavoriteFlagFavorite)"))
        {
            bool ret = SteamMatchmaking.RemoveFavoriteGame(TestConstants.Instance.k_AppId_TeamFortress2, TestConstants.k_IpAddress208_78_165_233_uint, TestConstants.k_Port27015, TestConstants.k_Port27015, Constants.k_unFavoriteFlagFavorite);
            print("SteamMatchmaking.RemoveFavoriteGame(" + TestConstants.Instance.k_AppId_TeamFortress2 + ", " + TestConstants.k_IpAddress208_78_165_233_uint + ", " + TestConstants.k_Port27015 + ", " + TestConstants.k_Port27015 + ", " + Constants.k_unFavoriteFlagFavorite + ") : " + ret);
        }

        if (GUILayout.Button("RequestLobbyList()"))
        {
            SteamAPICall_t handle = SteamMatchmaking.RequestLobbyList();
            OnLobbyMatchListCallResult.Set(handle);
            print("SteamMatchmaking.RequestLobbyList() : " + handle);
        }

        if (GUILayout.Button("AddRequestLobbyListStringFilter(\"SomeStringKey\", \"SomeValue\", ELobbyComparison.k_ELobbyComparisonNotEqual)"))
        {
            SteamMatchmaking.AddRequestLobbyListStringFilter("SomeStringKey", "SomeValue", ELobbyComparison.k_ELobbyComparisonNotEqual);
            print("SteamMatchmaking.AddRequestLobbyListStringFilter(" + "\"SomeStringKey\"" + ", " + "\"SomeValue\"" + ", " + ELobbyComparison.k_ELobbyComparisonNotEqual + ")");
        }

        if (GUILayout.Button("AddRequestLobbyListNumericalFilter(\"SomeIntKey\", 0, ELobbyComparison.k_ELobbyComparisonNotEqual)"))
        {
            SteamMatchmaking.AddRequestLobbyListNumericalFilter("SomeIntKey", 0, ELobbyComparison.k_ELobbyComparisonNotEqual);
            print("SteamMatchmaking.AddRequestLobbyListNumericalFilter(" + "\"SomeIntKey\"" + ", " + 0 + ", " + ELobbyComparison.k_ELobbyComparisonNotEqual + ")");
        }

        if (GUILayout.Button("AddRequestLobbyListNearValueFilter(\"SomeIntKey\", 0)"))
        {
            SteamMatchmaking.AddRequestLobbyListNearValueFilter("SomeIntKey", 0);
            print("SteamMatchmaking.AddRequestLobbyListNearValueFilter(" + "\"SomeIntKey\"" + ", " + 0 + ")");
        }

        if (GUILayout.Button("AddRequestLobbyListFilterSlotsAvailable(3)"))
        {
            SteamMatchmaking.AddRequestLobbyListFilterSlotsAvailable(3);
            print("SteamMatchmaking.AddRequestLobbyListFilterSlotsAvailable(" + 3 + ")");
        }

        if (GUILayout.Button("AddRequestLobbyListDistanceFilter(ELobbyDistanceFilter.k_ELobbyDistanceFilterWorldwide)"))
        {
            SteamMatchmaking.AddRequestLobbyListDistanceFilter(ELobbyDistanceFilter.k_ELobbyDistanceFilterWorldwide);
            print("SteamMatchmaking.AddRequestLobbyListDistanceFilter(" + ELobbyDistanceFilter.k_ELobbyDistanceFilterWorldwide + ")");
        }

        if (GUILayout.Button("AddRequestLobbyListResultCountFilter(1)"))
        {
            SteamMatchmaking.AddRequestLobbyListResultCountFilter(1);
            print("SteamMatchmaking.AddRequestLobbyListResultCountFilter(" + 1 + ")");
        }

        if (GUILayout.Button("AddRequestLobbyListCompatibleMembersFilter((CSteamID)0)"))
        {
            SteamMatchmaking.AddRequestLobbyListCompatibleMembersFilter((CSteamID)0);
            print("SteamMatchmaking.AddRequestLobbyListCompatibleMembersFilter(" + (CSteamID)0 + ")");
        }

        if (GUILayout.Button("GetLobbyByIndex(0)"))
        {
            m_Lobby = SteamMatchmaking.GetLobbyByIndex(0);
            print("SteamMatchmaking.GetLobbyByIndex(" + 0 + ") : " + m_Lobby);
        }

        if (GUILayout.Button("CreateLobby(ELobbyType.k_ELobbyTypePublic, 1)"))
        {
            SteamAPICall_t handle = SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePublic, 1);
            OnLobbyCreatedCallResult.Set(handle);
            print("SteamMatchmaking.CreateLobby(" + ELobbyType.k_ELobbyTypePublic + ", " + 1 + ") : " + handle);
        }

        if (GUILayout.Button("JoinLobby(m_Lobby)"))
        {
            SteamAPICall_t handle = SteamMatchmaking.JoinLobby(m_Lobby);
            OnLobbyEnterCallResult.Set(handle);
            print("SteamMatchmaking.JoinLobby(" + m_Lobby + ") : " + handle);
        }

        if (GUILayout.Button("LeaveLobby(m_Lobby)"))
        {
            SteamMatchmaking.LeaveLobby(m_Lobby);
            m_Lobby = CSteamID.Nil;
            print("SteamMatchmaking.LeaveLobby(" + m_Lobby + ")");
        }

        if (GUILayout.Button("InviteUserToLobby(m_Lobby, SteamUser.GetSteamID())"))
        {
            bool ret = SteamMatchmaking.InviteUserToLobby(m_Lobby, SteamUser.GetSteamID());
            print("SteamMatchmaking.InviteUserToLobby(" + m_Lobby + ", " + SteamUser.GetSteamID() + ") : " + ret);
        }

        GUILayout.Label("GetNumLobbyMembers(m_Lobby) : " + SteamMatchmaking.GetNumLobbyMembers(m_Lobby));

        GUILayout.Label("GetLobbyMemberByIndex(m_Lobby, 0) : " + SteamMatchmaking.GetLobbyMemberByIndex(m_Lobby, 0));

        GUILayout.Label("GetLobbyData(m_Lobby, \"name\") : " + SteamMatchmaking.GetLobbyData(m_Lobby, "name"));

        if (GUILayout.Button("SetLobbyData(m_Lobby, \"name\", \"Test Lobby!\")"))
        {
            bool ret = SteamMatchmaking.SetLobbyData(m_Lobby, "name", "Test Lobby!");
            print("SteamMatchmaking.SetLobbyData(" + m_Lobby + ", " + "\"name\"" + ", " + "\"Test Lobby!\"" + ") : " + ret);
        }

        GUILayout.Label("GetLobbyDataCount(m_Lobby) : " + SteamMatchmaking.GetLobbyDataCount(m_Lobby));

        {
            string Key;
            string Value;
            bool   ret = SteamMatchmaking.GetLobbyDataByIndex(m_Lobby, 0, out Key, 255, out Value, 255);
            GUILayout.Label("GetLobbyDataByIndex(m_Lobby, 0, out Key, 255, out Value, 255) : " + ret + " -- " + Key + " -- " + Value);
        }

        if (GUILayout.Button("DeleteLobbyData(m_Lobby, \"name\")"))
        {
            bool ret = SteamMatchmaking.DeleteLobbyData(m_Lobby, "name");
            print("SteamMatchmaking.DeleteLobbyData(" + m_Lobby + ", " + "\"name\"" + ") : " + ret);
        }

        GUILayout.Label("GetLobbyMemberData(m_Lobby, SteamUser.GetSteamID(), \"test\") : " + SteamMatchmaking.GetLobbyMemberData(m_Lobby, SteamUser.GetSteamID(), "test"));

        if (GUILayout.Button("SetLobbyMemberData(m_Lobby, \"test\", \"This is a test Key!\")"))
        {
            SteamMatchmaking.SetLobbyMemberData(m_Lobby, "test", "This is a test Key!");
            print("SteamMatchmaking.SetLobbyMemberData(" + m_Lobby + ", " + "\"test\"" + ", " + "\"This is a test Key!\"" + ")");
        }

        if (GUILayout.Button("SendLobbyChatMsg(m_Lobby, MsgBody, MsgBody.Length)"))
        {
            byte[] MsgBody = System.Text.Encoding.UTF8.GetBytes("Test Message!");
            bool   ret     = SteamMatchmaking.SendLobbyChatMsg(m_Lobby, MsgBody, MsgBody.Length);
            print("SteamMatchmaking.SendLobbyChatMsg(" + m_Lobby + ", " + MsgBody + ", " + MsgBody.Length + ") : " + ret);
        }

        //SteamMatchmaking.GetLobbyChatEntry() // Only called from within OnLobbyChatMsg!

        if (GUILayout.Button("RequestLobbyData(m_Lobby)"))
        {
            bool ret = SteamMatchmaking.RequestLobbyData(m_Lobby);
            print("SteamMatchmaking.RequestLobbyData(" + m_Lobby + ") : " + ret);
        }

        if (GUILayout.Button("SetLobbyGameServer(m_Lobby, TestConstants.k_IpAddress127_0_0_1_uint, TestConstants.k_Port27015, CSteamID.NonSteamGS)"))
        {
            SteamMatchmaking.SetLobbyGameServer(m_Lobby, TestConstants.k_IpAddress127_0_0_1_uint, TestConstants.k_Port27015, CSteamID.NonSteamGS);
            print("SteamMatchmaking.SetLobbyGameServer(" + m_Lobby + ", " + TestConstants.k_IpAddress127_0_0_1_uint + ", " + TestConstants.k_Port27015 + ", " + CSteamID.NonSteamGS + ")");
        }

        {
            uint     GameServerIP;
            ushort   GameServerPort;
            CSteamID SteamIDGameServer;
            bool     ret = SteamMatchmaking.GetLobbyGameServer(m_Lobby, out GameServerIP, out GameServerPort, out SteamIDGameServer);
            GUILayout.Label("GetLobbyGameServer(m_Lobby, out GameServerIP, out GameServerPort, out SteamIDGameServer) : " + ret + " -- " + GameServerIP + " -- " + GameServerPort + " -- " + SteamIDGameServer);
        }

        if (GUILayout.Button("SetLobbyMemberLimit(m_Lobby, 6)"))
        {
            bool ret = SteamMatchmaking.SetLobbyMemberLimit(m_Lobby, 6);
            print("SteamMatchmaking.SetLobbyMemberLimit(" + m_Lobby + ", " + 6 + ") : " + ret);
        }

        GUILayout.Label("GetLobbyMemberLimit(m_Lobby) : " + SteamMatchmaking.GetLobbyMemberLimit(m_Lobby));

        if (GUILayout.Button("SetLobbyType(m_Lobby, ELobbyType.k_ELobbyTypePublic)"))
        {
            bool ret = SteamMatchmaking.SetLobbyType(m_Lobby, ELobbyType.k_ELobbyTypePublic);
            print("SteamMatchmaking.SetLobbyType(" + m_Lobby + ", " + ELobbyType.k_ELobbyTypePublic + ") : " + ret);
        }

        if (GUILayout.Button("SetLobbyJoinable(m_Lobby, true)"))
        {
            bool ret = SteamMatchmaking.SetLobbyJoinable(m_Lobby, true);
            print("SteamMatchmaking.SetLobbyJoinable(" + m_Lobby + ", " + true + ") : " + ret);
        }

        if (GUILayout.Button("GetLobbyOwner(m_Lobby)"))
        {
            CSteamID ret = SteamMatchmaking.GetLobbyOwner(m_Lobby);
            print("SteamMatchmaking.GetLobbyOwner(" + m_Lobby + ") : " + ret);
        }

        if (GUILayout.Button("SetLobbyOwner(m_Lobby, SteamUser.GetSteamID())"))
        {
            bool ret = SteamMatchmaking.SetLobbyOwner(m_Lobby, SteamUser.GetSteamID());
            print("SteamMatchmaking.SetLobbyOwner(" + m_Lobby + ", " + SteamUser.GetSteamID() + ") : " + ret);
        }

        if (GUILayout.Button("SetLinkedLobby(m_Lobby, m_Lobby)"))
        {
            bool ret = SteamMatchmaking.SetLinkedLobby(m_Lobby, m_Lobby);
            print("SteamMatchmaking.SetLinkedLobby(" + m_Lobby + ", " + m_Lobby + ") : " + ret);
        }

        //SteamMatchmaking.CheckForPSNGameBootInvite() // PS3 Only.

        GUILayout.EndScrollView();
        GUILayout.EndVertical();
    }
 private void OnLobbyDataUpdate(LobbyDataUpdate_t callback)
 {
     if (callback.m_bSuccess == 1)
     {
         if (this.m_LobbyToJoinId == (CSteamID)callback.m_ulSteamIDLobby)
         {
             if (!SteamMatchmaking.GetLobbyData(this.m_LobbyToJoinId, "game_ver").Equals(GreenHellGame.s_GameVersion.ToString()))
             {
                 if (P2PLogFilter.logWarn)
                 {
                     Debug.LogWarning("[TransportLayerSteam] Connection to lobby aborted - different game versions.");
                 }
                 this.m_LobbyToJoinId = CSteamID.Nil;
                 return;
             }
             CSteamID lobbyToJoinId = this.m_LobbyToJoinId;
             this.Shutdown();
             SteamMatchmaking.JoinLobby(lobbyToJoinId);
             this.m_LobbyToJoinId = CSteamID.Nil;
             this.m_IsInLobby     = true;
             return;
         }
         else
         {
             CSteamID lobbyOwner = SteamMatchmaking.GetLobbyOwner(this.m_LobbyId);
             if (lobbyOwner.m_SteamID != this.m_LobbyOwner.m_SteamID)
             {
                 if (P2PLogFilter.logWarn)
                 {
                     Debug.LogWarning("[TransportLayerSteam] Lobby owner changed");
                 }
                 CSteamID lobbyOwner2 = this.m_LobbyOwner;
                 this.m_LobbyOwner = lobbyOwner;
                 int  numLobbyMembers = SteamMatchmaking.GetNumLobbyMembers(this.m_LobbyId);
                 bool flag            = true;
                 for (int i = 0; i < numLobbyMembers; i++)
                 {
                     if (SteamMatchmaking.GetLobbyMemberByIndex(this.m_LobbyId, i).m_SteamID == lobbyOwner2.m_SteamID)
                     {
                         flag = false;
                         break;
                     }
                 }
                 if (flag)
                 {
                     if (P2PLogFilter.logWarn)
                     {
                         Debug.LogWarning("[TransportLayerSteam] Lobby owner left! Disconnecting.");
                     }
                     foreach (KeyValuePair <CSteamID, int> keyValuePair in this.m_Connections)
                     {
                         this.m_ConnectionsBrokenInternal.Push(keyValuePair.Value);
                     }
                     this.Shutdown();
                 }
             }
             else if (this.m_QueriedLobbyList != null)
             {
                 P2PLobbyInfo p2PLobbyInfo = this.m_QueriedLobbyList.FirstOrDefault((P2PLobbyInfo l) => ((P2PAddressSteam)l.m_Address).m_SteamID == (CSteamID)callback.m_ulSteamIDLobby);
                 if (p2PLobbyInfo != null)
                 {
                     CSteamID steamID = ((P2PAddressSteam)p2PLobbyInfo.m_Address).m_SteamID;
                     if (!SteamMatchmaking.GetLobbyData(steamID, "game_ver").Equals(GreenHellGame.s_GameVersion.ToString()))
                     {
                         this.m_QueriedLobbyList.Remove(p2PLobbyInfo);
                     }
                     else
                     {
                         p2PLobbyInfo.m_MemberCount = SteamMatchmaking.GetNumLobbyMembers(steamID);
                         p2PLobbyInfo.m_SlotCount   = SteamMatchmaking.GetLobbyMemberLimit(steamID);
                         p2PLobbyInfo.m_Name        = SteamMatchmaking.GetLobbyData(steamID, "name");
                         p2PLobbyInfo.m_Ready       = true;
                     }
                     bool flag2 = true;
                     using (List <P2PLobbyInfo> .Enumerator enumerator2 = this.m_QueriedLobbyList.GetEnumerator())
                     {
                         while (enumerator2.MoveNext())
                         {
                             if (!enumerator2.Current.m_Ready)
                             {
                                 flag2 = false;
                                 break;
                             }
                         }
                     }
                     if (flag2)
                     {
                         P2PTransportLayer.OnLobbyListAcquired(this.m_QueriedLobbyList);
                         this.m_QueriedLobbyList = null;
                     }
                 }
             }
             if (this.m_LobbyId == (CSteamID)callback.m_ulSteamIDLobby)
             {
                 this.UpdateLobbyMembers();
             }
         }
     }
 }