Beispiel #1
0
        private void UpdateLobbyData(LobbyData data)
        {
            for (int i = 0; i < data.Players.Count; ++i)
            {
                if (!data.Players[i].IsHost && data.Players[i].Identification == Ip.ToString())
                {
                    PlayerIndex = (uint)i;
                    break;
                }
            }

            LobbyData = data;
            LobbyDataUpdated?.Invoke(this, EventArgs.Empty);
        }
 /// <summary>
 ///     Called when either the lobby or a lobby member has their data updated.
 /// </summary>
 /// <param name="pCallback"></param>
 private void OnLobbyDataUpdate(LobbyDataUpdate_t pCallback)
 {
     if (pCallback.m_ulSteamIDLobby != pCallback.m_ulSteamIDMember)
     {
         if (NetLogFilter.logInfo)
         {
             Debug.Log($"Lobby Member Data Updated | ({Time.time})");
         }
         CSteamID lobby  = new CSteamID(pCallback.m_ulSteamIDLobby);
         CSteamID member = new CSteamID(pCallback.m_ulSteamIDMember);
         string   info   = SteamMatchmaking.GetLobbyMemberData(lobby, member, LobbyMemberData);
         LobbyMemberDataUpdated?.Invoke(member, info);
     }
     else
     {
         if (NetLogFilter.logInfo)
         {
             Debug.Log($"Lobby Data Updated | ({Time.time})");
         }
         CSteamID lobby = new CSteamID(pCallback.m_ulSteamIDLobby);
         string   data  = SteamMatchmaking.GetLobbyData(lobby, LobbyData);
         LobbyDataUpdated?.Invoke(data);
     }
 }