Ejemplo n.º 1
0
 public void SendEnd(EndData se)
 {
     if (!started || Learning)
     {
         return;
     }
     Learning           = true;
     WaitingSkillLevels = true;
     Debug.Log("Round++,Now:" + RoundNow);
     //sts = se;
     Src[Sender.clientNum]  = se;
     SLtb[Sender.clientNum] = true;
     Debug.Log("End Message " + Sender.clientNum + " Set");
     Bond.IO.Safe.OutputBuffer ob2 = new Bond.IO.Safe.OutputBuffer(128);
     Bond.Protocols.CompactBinaryWriter <Bond.IO.Safe.OutputBuffer> boc = new Bond.Protocols.CompactBinaryWriter <Bond.IO.Safe.OutputBuffer>(ob2);
     Serialize.To(boc, se);
     byte[] sendBytes = new byte[ob2.Data.Array.Length + 1];
     sendBytes[0] = (byte)2;
     ob2.Data.Array.CopyTo(sendBytes, 1);
     foreach (CSteamID i in TOmb)
     {
         if (i != SteamUser.GetSteamID())
         {
             SteamNetworking.SendP2PPacket(i, sendBytes, (uint)sendBytes.Length, EP2PSend.k_EP2PSendReliable);
         }
     }
     Debug.Log("End Sent");
     EndingCompare();
     TotalRounds = int.Parse(SteamMatchmaking.GetLobbyData(Sender.roomid, "Total_Rounds"));
     LearnTime   = int.Parse(SteamMatchmaking.GetLobbyData(Sender.roomid, "Learn_Time"));
 }
    public void DesplayList()
    {
        var nLobbies = m_Lobbies.Length;

        if (m_items != null && m_items.Length > 0)
        {
            foreach (var t in m_items)
            {
                Destroy(t.gameObject);
            }
        }

        var rect_transform = container.GetComponent <RectTransform>();

        rect_transform.sizeDelta = new Vector2(rect_transform.sizeDelta.x, nLobbies * item_prefab.GetComponent <RectTransform>().sizeDelta.y);

        m_items = new SingleLobbyButton[nLobbies];
        for (var i = 0; i < nLobbies; ++i)
        {
            m_items[i] = Instantiate(item_prefab);
            m_items[i].gameObject.SetActive(true);
            m_items[i].name             = gameObject.name + " item at (" + i + ")";
            m_items[i].transform.parent = container.transform;
            m_items[i].ID.text          = i.ToString();
            m_items[i].Name.text        = SteamMatchmaking.GetLobbyData(m_Lobbies[i].m_SteamID, "name");
            if (m_items[i].Name.text == "")
            {
                m_items[i].Name.text = "NULL";
            }
            m_items[i].MumberCount.text = m_Lobbies[i].m_Members.Length + "/" + m_Lobbies[i].m_MemberLimit;
            m_items[i].server_id        = m_Lobbies[i].m_SteamID;
            m_items[i].button.onClick.AddListener(delegate {
            });
        }
    }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
0
    void SetBasic()
    {
        int Mcount = SteamMatchmaking.GetNumLobbyMembers(Sender.roomid);

        ULS.CreateDs(Mcount);
        for (int i = 0; i < Mcount; i++)
        {
            ULS.UDs[i].GetComponent <UserDetailScript>().HomeWork(SteamMatchmaking.GetLobbyMemberByIndex(Sender.roomid, i));
        }
        PlayersJoined.text = Mcount + " players joined";
        Roomname.text      = SteamMatchmaking.GetLobbyData(Sender.roomid, "name");
        if (SteamMatchmaking.GetLobbyOwner(Sender.roomid) == SteamUser.GetSteamID())
        {
            MPanel.SetActive(true);
        }
        else
        {
            MPanel.SetActive(false);
        }
        DataShowScript[] dss = GetComponentsInChildren <DataShowScript>(DPanel);
        foreach (DataShowScript d in dss)
        {
            d.GetMyData();
        }
        //if (Mcount == 2) GameStart();
    }
Ejemplo n.º 5
0
        public void ReadLobbyData()
        {
            string hostplayernameData = SteamMatchmaking.GetLobbyData(LobbyID, "hostplayername");
            string levelnameData      = SteamMatchmaking.GetLobbyData(LobbyID, "levelname");
            string gamemodeData       = SteamMatchmaking.GetLobbyData(LobbyID, "gamemode");

            HostName  = string.IsNullOrEmpty(hostplayernameData) ? "" : hostplayernameData;
            LevelName = ParseLevelName(levelnameData);
            GameMode  = ParseGameMode(gamemodeData);

            NumPlayers = SteamMatchmaking.GetNumLobbyMembers(LobbyID);
            MaxPlayers = Math.Max(MaxPlayers, NumPlayers);

            UpdateTime    = DateTime.Now;
            Alive         = true;
            UpdatePending = false;

            /*int dataCount = SteamMatchmaking.GetLobbyDataCount(lobbyID);
             * for (int i = 0; i < dataCount; i++)
             * {
             *  string Key;
             *  string Value;
             *  SteamMatchmaking.GetLobbyDataByIndex(lobbyID, i, out Key, 255, out Value, 255);
             *  Debug.WriteLine("Data#" + i + ": " + Key + " -> " + Value);
             * }*/
        }
Ejemplo n.º 6
0
        public static void OnLobbyMatchList(LobbyMatchList_t pCallback, bool bIOFailure)
        {
            if (!SteamManager.Initialized)
            {
                Logger.Error("CONNECTION FAILED");
                return;
            }
            uint numLobbies = pCallback.m_nLobbiesMatching;

            Logger.Debug($"Found {numLobbies} total lobbies");
            LobbyData.Clear();
            MultiplayerListing.refreshLobbyList();
            try
            {
                for (int i = 0; i < numLobbies; i++)
                {
                    CSteamID lobbyId = SteamMatchmaking.GetLobbyByIndex(i);
                    if (lobbyId.m_SteamID == _lobbyInfo.LobbyID.m_SteamID)
                    {
                        continue;
                    }
                    LobbyInfo info = new LobbyInfo(SteamMatchmaking.GetLobbyData(lobbyId, "LOBBY_INFO"));

                    SetOtherLobbyData(lobbyId.m_SteamID, info, false);
                    Logger.Info($"{info.HostName} has {info.UsedSlots} users in it and is currently {info.Status}");
                }
            } catch (Exception e)
            {
                Logger.Error(e);
            }

            MultiplayerListing.refreshLobbyList();
        }
Ejemplo n.º 7
0
        public void LobbyEntered(LobbyEnter_t enterLobby)
        {
            connectedPlayers.Clear();
            otherPlayers.Clear();

            lobbyID = (CSteamID)enterLobby.m_ulSteamIDLobby;
            int playerCount = SteamMatchmaking.GetNumLobbyMembers(lobbyID);

            MultiplayerChat.chatStrings.Add("Entered Lobby!");

            //Send packets to all players, to establish P2P connections with them
            if (playerCount > 1)
            {
                for (int i = 0; i < playerCount; i++)
                {
                    CSteamID lobbyMember = SteamMatchmaking.GetLobbyMemberByIndex(lobbyID, i);
                    SteamNetworking.SendP2PPacket(lobbyMember, new byte[] { 255 }, 1, EP2PSend.k_EP2PSendReliable, 0);
                    connectedPlayers.Add(lobbyMember.m_SteamID);

                    if (lobbyMember != SteamUser.GetSteamID())
                    {
                        otherPlayers.Add(lobbyMember.m_SteamID);
                    }
                }
            }

            //Set up network data
            NetworkGameManager.managerID = ulong.Parse(SteamMatchmaking.GetLobbyData(lobbyID, MANAGER_ID));
            NetworkGameManager.playerID  = SteamUser.GetSteamID().m_SteamID;

            connectedPlayers.Add(SteamUser.GetSteamID().m_SteamID);

            MultiplayerChat.chatStrings.Add("This game's manager is " + SteamFriends.GetFriendPersonaName((CSteamID)NetworkGameManager.managerID));
            isInGame = true;
        }
Ejemplo n.º 8
0
        public void LobbyEntered(LobbyEnter_t enterLobby)
        {
            connectedPlayers.Clear();
            otherPlayers.Clear();
            ResetManagers();
            {
                if (!(RainWorldHK.mainRW.processManager.currentMainLoop is SteamMultiplayerMenu))
                {
                    ProcessManagerHK.ImmediateSwitchCustom(RainWorldHK.mainRW.processManager, new SteamMultiplayerMenu(RainWorldHK.mainRW.processManager));
                }
            }

            joining = false;
            lobbyID = (CSteamID)enterLobby.m_ulSteamIDLobby;
            int playerCount = SteamMatchmaking.GetNumLobbyMembers((CSteamID)enterLobby.m_ulSteamIDLobby);

            MultiplayerChat.AddChat("Entered Lobby!");

            //Send packets to all players, to establish P2P connections with them
            if (playerCount > 1)
            {
                for (int i = 0; i < playerCount; i++)
                {
                    CSteamID lobbyMember = SteamMatchmaking.GetLobbyMemberByIndex(lobbyID, i);
                    SteamNetworking.SendP2PPacket(lobbyMember, new byte[] { 255 }, 1, EP2PSend.k_EP2PSendReliable, 0);
                    SteamNetworking.SendP2PPacket(lobbyMember, new byte[] { 255 }, 1, EP2PSend.k_EP2PSendReliable, 1);
                    SteamNetworking.SendP2PPacket(lobbyMember, new byte[] { 255 }, 1, EP2PSend.k_EP2PSendReliable, 2);
                    if (!connectedPlayers.Contains(lobbyMember.m_SteamID))
                    {
                        connectedPlayers.Add(lobbyMember.m_SteamID);
                        PlayerJoinedManagers(lobbyMember.m_SteamID);
                    }
                    if (lobbyMember != SteamUser.GetSteamID())
                    {
                        otherPlayers.Add(lobbyMember.m_SteamID);
                    }
                }
            }

            //Set up network data
            NetworkGameManager.managerID = ulong.Parse(SteamMatchmaking.GetLobbyData(lobbyID, MANAGER_ID));
            NetworkGameManager.playerID  = SteamUser.GetSteamID().m_SteamID;
            if (NetworkGameManager.managerID != NetworkGameManager.playerID)
            {
                lobbyInfo = new LobbyInfo((CSteamID)enterLobby.m_ulSteamIDLobby);
                lobbyInfo.UpdateLobbyInfo((CSteamID)enterLobby.m_ulSteamIDLobby);
                lobbyInfo.owner = new CSteamID(NetworkGameManager.managerID);
            }

            if (!connectedPlayers.Contains(SteamUser.GetSteamID().m_SteamID))
            {
                connectedPlayers.Add(SteamUser.GetSteamID().m_SteamID);
                PlayerJoinedManagers(SteamUser.GetSteamID().m_SteamID);
            }

            MultiplayerChat.AddChat("This game's manager is " + SteamFriends.GetFriendPersonaName((CSteamID)NetworkGameManager.managerID));
            isInGame = true;
            Log("Entered Lobby! \nThis game's manager is " + SteamFriends.GetFriendPersonaName((CSteamID)NetworkGameManager.managerID));
        }
Ejemplo n.º 9
0
 public unsafe string GetLobbyData(string name)
 {
     if (id == 0)
     {
         return("");
     }
     return(SteamMatchmaking.GetLobbyData(_id, name));
 }
Ejemplo n.º 10
0
 public void GetMyData()
 {
     DataValueText.text = SteamMatchmaking.GetLobbyData(Sender.roomid, DataName);
     if (MPanel.activeInHierarchy)
     {
         SetObject.SetActive(true);
     }
 }
Ejemplo n.º 11
0
 public void GetMyData()
 {
     DataValueText.text = SteamMatchmaking.GetLobbyData(Sender.roomid, DataName);
     if (MPanel.activeInHierarchy)
     {
         SetObject.GetComponent <CanvasGroup>().interactable = true;
     }
 }
    public Lobby GetLobbyDataInfo(CSteamID lobby)
    {
        Lobby _lobby = new Lobby();

        _lobby.name  = SteamMatchmaking.GetLobbyData(lobby, "name");
        _lobby.lobby = lobby;
        return(_lobby);
    }
        private static GameServer[] HandleGameLobbies(LobbyMatchList_t param)
        {
            var lobbies = new List <GameServer>();

            for (int i = 0; i < param.m_nLobbiesMatching; i++)
            {
                var lobbyId = SteamMatchmaking.GetLobbyByIndex(i);

                if (SteamMatchmaking.RequestLobbyData(lobbyId))
                {
                    var indicator = SteamMatchmaking.GetLobbyData(lobbyId, LobbyDataKeys.STEAM_SPY_INDICATOR);

                    if (!indicator.IsNullOrEmpty() && indicator == SteamConstants.INDICATOR)
                    {
                        var ownerId = SteamMatchmaking.GetLobbyData(lobbyId, LobbyDataKeys.HOST_STEAM_ID);
                        var id      = ownerId.ParseToUlongOrDefault();

                        if (id == 0)
                        {
                            continue;
                        }

                        var ownerSteamId = new CSteamID(id);

                        if (ownerSteamId == SteamUser.GetSteamID())
                        {
                            continue;
                        }

                        var server = new GameServer();

                        server.HostSteamId = ownerSteamId;

                        var rowCount = SteamMatchmaking.GetLobbyDataCount(lobbyId);

                        string key;
                        string value;

                        for (int k = 0; k < rowCount; k++)
                        {
                            if (SteamMatchmaking.GetLobbyDataByIndex(lobbyId, k, out key, 100, out value, 100))
                            {
                                server.Set(key, value);
                            }
                        }

                        if (!server.HasPlayers)
                        {
                            continue;
                        }

                        lobbies.Add(server);
                    }
                }
            }

            return(lobbies.ToArray());
        }
Ejemplo n.º 14
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);
        }
 void OnLobbyEntered(LobbyEnter_t result)
 {
     if (!isHost)
     {
         networkAddress = SteamMatchmaking.GetLobbyData((CSteamID)result.m_ulSteamIDLobby, "ServerIP");
         awaitMsg.gameObject.SetActive(false);
         StartClient();
     }
 }
Ejemplo n.º 16
0
 void OnEnable()
 {
     Roomname.text = SteamMatchmaking.GetLobbyData(Sender.roomid, "name");
     CVS2.SetActive(true);
     Startbutton.gameObject.SetActive(false);
     Readytoggle.interactable = true;
     MPanel.GetComponent <CanvasGroup>().interactable = true;
     UpdateLobbyInfo(ref m_CurrentLobby);
     SetBasic();
 }
Ejemplo n.º 17
0
        private void onLobbyDataUpdate(LobbyDataUpdate_t pCallback)
        {
            CSteamID steamLobby = new CSteamID(pCallback.m_ulSteamIDLobby);
            GalaxyID lobbyID    = parseConnectionString(SteamMatchmaking.GetLobbyData(steamLobby, "connect"));

            lobbyOwners[lobbyID.ToUint64()] = SteamMatchmaking.GetLobbyOwner(steamLobby);
            if (lobbyID != null)
            {
                GalaxyInstance.Matchmaking().RequestLobbyData(lobbyID);
            }
        }
Ejemplo n.º 18
0
 void OnGetLobbyInfo(LobbyDataUpdate_t result)
 {
     for (int i = 0; i < lobbyIDS.Count; i++)
     {
         if (lobbyIDS[i].m_SteamID == result.m_ulSteamIDLobby)
         {
             print("lobby " + i + "::" + SteamMatchmaking.GetLobbyData((CSteamID)lobbyIDS[i].m_SteamID, "name"));
             return;
         }
     }
 }
Ejemplo n.º 19
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);
 }
Ejemplo n.º 20
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();
     }
 }
Ejemplo n.º 21
0
    private void OnLobbyEntered(LobbyEnter_t callback)
    {
        if (NetworkServer.active)
        {
            return;
        }

        string hostAddress = SteamMatchmaking.GetLobbyData(new CSteamID(callback.m_ulSteamIDLobby), HOST_ADDRESS_KEY);

        MyNetworkManager.singleton.networkAddress = hostAddress;
        MyNetworkManager.singleton.StartClient();
    }
Ejemplo n.º 22
0
        public static void SetOtherLobbyData(ulong lobbyId, LobbyInfo info, bool refresh = true)
        {
            string version = SteamMatchmaking.GetLobbyData(new CSteamID(lobbyId), "version");

            info.UsedSlots = SteamMatchmaking.GetNumLobbyMembers(new CSteamID(lobbyId));
            if (info.UsedSlots > 0 && info.HostName != "" && version == PACKET_VERSION)
            {
                LobbyData.Add(lobbyId, info);

                MultiplayerListing.refreshLobbyList();
            }
        }
    public void GetLobbyByIndex(int index)
    {
        CSteamID m_LobbyValue = SteamMatchmaking.GetLobbyByIndex(index);

        Debug.Log("SteamMatchmaking.SteamMatchmaking.GetLobbyByIndex(0) : " + m_LobbyValue);

        LobbyValue _lobby = new LobbyValue();

        _lobby.name       = SteamMatchmaking.GetLobbyData(m_LobbyValue, "name");
        _lobby.lobbyIndex = index;
        _lobby.lobby      = m_LobbyValue;
        m_LobbyList.Add(_lobby);
    }
    private void OnLobbyEntered(LobbyEnter_t pCallback, bool ioFailed)
    {
        Debug.Log("enter room success");

        m_LobbyId = new CSteamID(pCallback.m_ulSteamIDLobby);

        var lobbyname = SteamMatchmaking.GetLobbyData(m_LobbyId, "name");

        Debug.Log("lobbyname: " + lobbyname);
        GameObject.Find("LobbyPanel").GetComponent <LobbyPanel>().createLobby(lobbyname);
        m_IsInLobby = true;
        UpdateLobby();
    }
Ejemplo n.º 25
0
    private void LoobyEnter(LobbyEnter_t callback)
    {
        if (NetworkServer.active)
        {
            return;
        }
        string hostAddress = SteamMatchmaking.GetLobbyData(new CSteamID(callback.m_ulSteamIDLobby), "HostAddress");

        NetworkManager.singleton.networkAddress = hostAddress;
        NetworkManager.singleton.StartClient();

        mainMenu.SetActive(false);
    }
Ejemplo n.º 26
0
        private void onLobbyEnter(LobbyEnter_t pCallback)
        {
            CSteamID lobbyID = new CSteamID(pCallback.m_ulSteamIDLobby);

            if (!(SteamMatchmaking.GetLobbyOwner(lobbyID) == SteamUser.GetSteamID()))
            {
                lobbyRequested = parseConnectionString(SteamMatchmaking.GetLobbyData(lobbyID, "connect"));
                SteamMatchmaking.LeaveLobby(lobbyID);
                if (lobbyRequested != null)
                {
                    Game1.multiplayer.inviteAccepted();
                }
            }
        }
Ejemplo n.º 27
0
 void Update()
 {
     SteamAPI.RunCallbacks();
     if (lobby.m_SteamID != 0)
     {
         if (CheckPlay)
         {
             if (SteamMatchmaking.GetLobbyData(lobby, "ready") == "1")
             {
                 Play();
             }
         }
     }
 }
Ejemplo n.º 28
0
    protected void OnGotLobbyList(LobbyMatchList_t pCallback, bool bIOfailure)
    {
        uint numLobbies = pCallback.m_nLobbiesMatching;

        Debug.Log(numLobbies + " lobbies found.");
        GameMatchmakingInfo[] lobbies = new GameMatchmakingInfo[numLobbies];
        for (int i = 0; i < numLobbies; i++)
        {
            lobbies[i].id   = SteamMatchmaking.GetLobbyByIndex(i).m_SteamID;
            lobbies[i].name = SteamMatchmaking.GetLobbyData(new CSteamID(lobbies[i].id), "name");

            lobbies[i].callback = OnGetLobbySelection;
        }
        networkUIController.RequestLobbySelection(OnGetLobbySelection, lobbies);
    }
Ejemplo n.º 29
0
    private void OnLobbyEntered(LobbyEnter_t callback)
    {
        if (NetworkServer.active)
        {
            return;
        }                                     // Server connects differently
        string hostAddress = SteamMatchmaking.GetLobbyData(
            new CSteamID(callback.m_ulSteamIDLobby),
            HostAddressKey
            );

        networkManager.networkAddress = hostAddress;
        networkManager.StartClient();
        connectionUI.SetActive(false);
    }
 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.";
         }
     }
 }