예제 #1
0
        public static void OnLobbyUpdated(LobbyDataUpdate_t lobby)
        {
            var client = ServiceLocator.Get <IClient>();

            client.UpdateLobbyInformation();
            LuaContext.FireEvent(LuaConstants.STEAM_LOBBY_UPDATE);
        }
        void OnLobbyDataUpdate(LobbyDataUpdate_t evt)
        {
            var id = new CSteamID(evt.m_ulSteamIDLobby);

            if (_connectedLobbies.TryGetValue(id, out SteamLobby lobby))
            {
                if (evt.m_ulSteamIDLobby == evt.m_ulSteamIDMember)
                {
                    // Lobby metadata updated
                    lobby.DispatchUpdate();
                }
                else
                {
                    LobbyMember member;
                    var         handle = new AccountHandle(evt.m_ulSteamIDMember);
                    if (lobby.Members.TryGetValue(handle, out member))
                    {
                        member.DispatchUpdate();
                    }
                    else
                    {
                        Debug.LogWarning($"[Steam] Unexpected Lobby update event for lobby: {id}");
                    }
                }
            }
            else
            {
                Debug.LogWarning($"[Steam] Unexpected lobby update event for lobby: {id}");
            }
        }
예제 #3
0
        void OnLobbyDataUpdated(LobbyDataUpdate_t callback)
        {
            if (callback.Success == 1) //1 if success, 0 if failure
            {
                if (ManualLobbyDataCallbacks.ContainsKey(callback.SteamIDLobby))
                {
                    ManualLobbyDataCallbacks[callback.SteamIDLobby]?.Invoke(Lobby.FromSteam(client, callback.SteamIDLobby));
                }

                //find the lobby that has been updated
                Lobby lobby = Lobbies.Find(x => x != null && x.LobbyID == callback.SteamIDLobby);

                //if this lobby isn't yet in the list of lobbies, we know that we should add it
                if (lobby == null)
                {
                    if (requests.Contains(callback.SteamIDLobby))
                    {
                        lobby = Lobby.FromSteam(client, callback.SteamIDLobby);
                        Lobbies.Add(lobby);
                        checkFinished();
                    }
                }

                //otherwise lobby data in general was updated and you should listen to see what changed
                if (requests.Contains(callback.SteamIDLobby))
                {
                    OnLobbiesUpdated?.Invoke();
                }
            }
        }
예제 #4
0
    void UpdateStartState(LobbyDataUpdate_t cb)
    {
        readyUsers.Clear();
        if (Client.Users == null || Client.Users.Count == 0)
        {
            return;
        }

        for (int i = 0; i < Client.Users.Count; i++)
        {
            string data = SteamMatchmaking.GetLobbyMemberData(Client.Lobby.LobbyID, Client.Users[i].SteamID, "Ready");
            if (data == "")
            {
                continue;
            }
            int index;
            if (int.TryParse(data, out index))
            {
                if (index == 1)
                {
                    readyUsers.Add(Client.Users[i].SteamID);
                }
            }
        }
        SetStartButtonState();
        ControlStart();
    }
예제 #5
0
 public void OnDataUpdate(LobbyDataUpdate_t pCallback)
 {
     if (SteamMatches.s_OnDataUpdate != null)
     {
         SteamMatches.s_OnDataUpdate.Invoke();
     }
 }
예제 #6
0
    // Token: 0x06000967 RID: 2407 RVA: 0x000452B4 File Offset: 0x000434B4
    private void OnLobbyDataUpdate(LobbyDataUpdate_t data)
    {
        CSteamID csteamID = new CSteamID(data.m_ulSteamIDLobby);

        if (csteamID == this.m_queuedJoinLobby)
        {
            ZLog.Log("Got lobby data, for queued lobby");
            uint     num;
            ushort   num2;
            CSteamID joinUserID;
            if (SteamMatchmaking.GetLobbyGameServer(csteamID, out num, out num2, out joinUserID))
            {
                this.m_joinUserID = joinUserID;
            }
            this.m_queuedJoinLobby = CSteamID.Nil;
            return;
        }
        ZLog.Log("Got requested lobby data");
        foreach (KeyValuePair <CSteamID, string> keyValuePair in this.m_requestedFriendGames)
        {
            if (keyValuePair.Key == csteamID)
            {
                ServerData lobbyServerData = this.GetLobbyServerData(csteamID);
                if (lobbyServerData != null)
                {
                    lobbyServerData.m_name = keyValuePair.Value + " [" + lobbyServerData.m_name + "]";
                    this.m_friendServers.Add(lobbyServerData);
                    this.m_serverListRevision++;
                }
            }
        }
    }
    //will be called when someone enters/leaves/updates lobby data/ joins the game
    //updating the player list here would be a good idea
    private void OnLobbyDataUpdate(LobbyDataUpdate_t pCallback)
    {
        Debug.Log("Lobby Update: SteamIDMember - " + pCallback.m_ulSteamIDMember
                  + " - Success: " + pCallback.m_bSuccess + " - Lobby: " + pCallback.m_ulSteamIDLobby);

        //update the player list here
        GetPlayerList();
    }
예제 #8
0
 void OnLobbyDataUpdated(LobbyDataUpdate_t callback)
 {
     if (callback.Success == 1) //1 if success, 0 if failure
     {
         lock (pendingCallbacks)
         {
             pendingCallbacks.Add(callback.SteamIDLobby);
         }
     }
 }
예제 #9
0
 private static void LobbyDataUpdate(LobbyDataUpdate_t param)
 {
     if (param.m_bSuccess == 1)
     {
         CoopLobbyInfo coopLobbyInfo = CoopLobbyManager.FindLobby(param.m_ulSteamIDLobby);
         if (coopLobbyInfo != null)
         {
             coopLobbyInfo.UpdateData();
         }
     }
 }
예제 #10
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);
            }
        }
예제 #11
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;
         }
     }
 }
예제 #12
0
    public void OnLobbyDataUpdated(LobbyDataUpdate_t callback)
    {
        Debug.Log("Lobby Data Updated");
        Debug.Log("Success: " + callback.m_bSuccess);
        Debug.Log("LobbyId: " + callback.m_ulSteamIDLobby);
        Debug.Log("MemberId: " + callback.m_ulSteamIDMember);
        CSteamID cSteamID = new CSteamID(callback.m_ulSteamIDMember);

        Debug.Log(cSteamID.IsValid());
        Debug.Log(SteamFriends.GetFriendPersonaName(cSteamID));
        Debug.Log(SteamFriends.GetFriendPersonaName(SteamUser.GetSteamID()));
    }
    //this won't be in this cass, is just for testing
    //will be managed differently: client will send data when enemy is hit, host will decrease life and send datas back for clients to update enemies lives
    //TO DELETE

    void InitCoroutine(LobbyDataUpdate_t cb)
    {
        if (coroutineStart || !ControlUsersStatus())
        {
            return;
        }

        Server.Init();
        Client.LeaveCurrentLobby();
        Client.SendPacketToInGameUsers(emptyArray, 0, 0, PacketType.LeaveLobby, EP2PSend.k_EP2PSendReliable);
        StartCoroutine(SpawnEnemiesAtStart());
        coroutineStart = true;
    }
예제 #14
0
 void OnGetLobbyInfo(LobbyDataUpdate_t result)
 {
     for (int i = 0; i < lobbyIDS.Count; i++)
     {
         if (lobbyIDS[i].m_SteamID == result.m_ulSteamIDLobby)
         {
             CSteamID id = (CSteamID)lobbyIDS[i].m_SteamID;
             if (SteamMatchmaking.GetLobbyData(id, "status") == "open")
             {
                 lobbyDisplay.Add(new KeyValuePair <string, CSteamID>(SteamMatchmaking.GetLobbyData(id, "name"), id));
             }
             return;
         }
     }
 }
예제 #15
0
        private void OnLobbyDataUpdate(LobbyDataUpdate_t result)
        {
            var rawID = result.m_ulSteamIDLobby;

            //Debug.WriteLine("OnLobbyDataUpdate: rawID=" + rawID + " success=" + result.m_bSuccess);

            if (result.m_bSuccess == 1)
            {
                stats.OnLobbyDataUpdateCount++;
                UpdateLobby(rawID);
            }
            else
            {
                MarkLobbyDead(rawID);
            }
        }
예제 #16
0
        private void OnLobbyDataUpdated(LobbyDataUpdate_t result)
        {
            if (!BoltNetwork.IsServer)
            {
                string serverName = SteamMatchmaking.GetLobbyData(_steamLobbyID, _lobbyNameParameterName);
                Debug.Log("[STEAM] Bolt server name updated : " + serverName);

                if (serverName != "")
                {
                    StartCoroutine(JoinBoltLobby(serverName));
                }
            }
            else
            {
                string boltServerID = SteamMatchmaking.GetLobbyData(_steamLobbyID, _lobbyNameParameterName);
                Debug.Log("[STEAM] Bolt server name successfully updated : " + boltServerID);
            }
        }
예제 #17
0
        internal void OnLobbyDataUpdatedAPI(LobbyDataUpdate_t callback, bool error)
        {
            if (error || (callback.SteamIDLobby != CurrentLobby))
            {
                return;
            }
            if (callback.SteamIDLobby == CurrentLobby) //actual lobby data was updated by owner
            {
                UpdateLobbyData();
            }

            if (UserIsInCurrentLobby(callback.SteamIDMember)) //some member of this lobby updated their information
            {
                if (OnLobbyMemberDataUpdated != null)
                {
                    OnLobbyMemberDataUpdated(callback.SteamIDMember);
                }
            }
        }
예제 #18
0
        void OnLobbyDataUpdated(LobbyDataUpdate_t callback)
        {
            if (callback.Success == 1) //1 if success, 0 if failure
            {
                //find the lobby that has been updated
                Lobby lobby = Lobbies.Find(x => x.LobbyID == callback.SteamIDLobby);

                //if this lobby isn't yet in the list of lobbies, we know that we should add it
                if (lobby == null)
                {
                    Lobbies.Add(lobby);
                    checkFinished();
                }

                //otherwise lobby data in general was updated and you should listen to see what changed
                if (OnLobbiesUpdated != null)
                {
                    OnLobbiesUpdated();
                }
            }
        }
예제 #19
0
    private void OnLobbyChatUpdate(LobbyDataUpdate_t lobbyDataUpdate)
    {
        ulong steamid = lobbyDataUpdate.m_ulSteamIDMember;

        print("Player joining... " + steamid);

        string joinedCID = SteamMatchmaking.GetLobbyMemberData(
            m_lobbyID,
            new CSteamID(steamid),
            "cid");

        if (joinedCID == null)
        {
            return;
        }
        if (lobbyDataUpdate.m_bSuccess == 1)
        {
            Match.AddPlayer(steamid, int.Parse(joinedCID));

            int neededPlayers = int.Parse(SteamMatchmaking.GetLobbyData(m_lobbyID, "NeededPlayers"));
            int playerCount   = SteamMatchmaking.GetNumLobbyMembers(m_lobbyID);

            if (new CSteamID(steamid) == Match.HostID)
            {
                Match.HostServer = true;
                Match.AddPlayer(steamid, ClientPlayer.Singleton.Cid);
            }
            Debug.Log($"{playerCount} / {neededPlayers}");
            if (playerCount >= neededPlayers)
            {
                Debug.Log($"Required players met. Starting...");
                m_matchSetup.Setup(Match.HostID);
            }
        }
        else
        {
            Match.RemovePlayer(steamid);
        }
    }
예제 #20
0
    public void OnLobbyDataUpdate(LobbyDataUpdate_t pCallback)
    {
        if (C.LOG_INVITE)
        {
            Debug.Log("Premade lobby: OnLobbyDataUpdate");
        }

        CheckLock();

        /// Lobby data update
        if (pCallback.m_ulSteamIDMember == pCallback.m_ulSteamIDLobby)
        {
            string foundLobby = SteamMatchmaking.GetLobbyData(teambuilderLobbyId, "foundLobby");
            if (foundLobby != "")
            {
                if (C.LOG_INVITE)
                {
                    Debug.Log("Game lobby found, jumping to it");
                }

                /// Jump to found lobby
                var lobbyId = new CSteamID(ulong.Parse(foundLobby));

                /// Not for owner because he's already there at this moment
                if (!IsLobbyOwner())
                {
                    SteamNetworkManager.Instance.JoinLobby(lobbyId);
                    MainMenuManager.Instance.ProceedToLobby();
                }
            }
        }

        /// Member data update
        else
        {
            UpdateTeammatesPresence();
        }
    }
예제 #21
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;
                }
            }
        }
 /// <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);
     }
 }
 public void OnLobbyDataUpdate(LobbyDataUpdate_t pCallback)
 {
     Debug.Log("Lobby Update: SteamIDMember - " + pCallback.m_ulSteamIDMember
               + " - Success: " + pCallback.m_bSuccess + " - Lobby: " + pCallback.m_ulSteamIDLobby);
 }
예제 #24
0
 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();
             }
         }
     }
 }
예제 #25
0
 void UpdateUsersID(LobbyDataUpdate_t cb)
 {
     UpdateUsers();
 }
예제 #26
0
 void OnLobbyDataUpdate(LobbyDataUpdate_t pCallback)
 {
     Debug.Log("[" + LobbyDataUpdate_t.k_iCallback + " - LobbyDataUpdate] - " + pCallback.m_ulSteamIDLobby + " -- " + pCallback.m_ulSteamIDMember + " -- " + pCallback.m_bSuccess);
 }
예제 #27
0
        public void OnLobbyDataUpdate(LobbyDataUpdate_t pCallback)
        {
            if (pCallback.m_ulSteamIDLobby == pCallback.m_ulSteamIDMember)
            {
                LobbyInfo info = new LobbyInfo(SteamMatchmaking.GetLobbyData(new CSteamID(pCallback.m_ulSteamIDLobby), "LOBBY_INFO"));

                if (pCallback.m_ulSteamIDLobby == 0)
                {
                    return;
                }
                Logger.Debug($"Received: {info.ToString()}");
                if (pCallback.m_ulSteamIDLobby == SteamAPI.getLobbyID().m_SteamID)
                {
                    SteamAPI.UpdateLobbyInfo(info);
                    if (DidScreenChange(info.Screen, LobbyInfo.SCREEN_TYPE.WAITING))
                    {
                        currentScreen = info.Screen;
                        Logger.Debug($"Song has been selected, going to the waiting screen");
                        WaitingMenu.Instance.Present();
                    }
                    else if (DidScreenChange(info.Screen, LobbyInfo.SCREEN_TYPE.MENU))
                    {
                        currentScreen = info.Screen;
                        Logger.Debug($"Song has finished, updating state to menu");
                        GameController.Instance.SongFinished(null, null, null, null);
                    }
                    else if (DidScreenChange(info.Screen, LobbyInfo.SCREEN_TYPE.PLAY_SONG))
                    {
                        currentScreen = info.Screen;
                        Logger.Debug($"Host requested to play the current song {info.CurrentSongId}");

                        LevelSO song = SongListUtils.GetInstalledSong();
                        if (SteamAPI.IsHost())
                        {
                            SteamAPI.setLobbyStatus("Playing " + song.songName + " by " + song.songAuthorName);
                        }

                        SteamAPI.ClearPlayerReady(new CSteamID(SteamAPI.GetUserID()), true);
                        SongListUtils.StartSong(song, SteamAPI.GetSongDifficulty(), info.GameplayModifiers);
                    }
                }
                else
                {
                    SteamAPI.SetOtherLobbyData(pCallback.m_ulSteamIDLobby, info);
                }
            }
            else
            {
                string status = SteamMatchmaking.GetLobbyMemberData(new CSteamID(pCallback.m_ulSteamIDLobby), new CSteamID(pCallback.m_ulSteamIDMember), "STATUS");
                if (status == "DISCONNECTED")
                {
                    SteamAPI.DisconnectPlayer(pCallback.m_ulSteamIDMember);
                }
                else if (status.StartsWith("KICKED"))
                {
                    ulong playerId = Convert.ToUInt64(status.Substring(7));
                    if (playerId != 0 && playerId == SteamAPI.GetUserID())
                    {
                        SteamAPI.Disconnect();
                    }
                }
            }
        }
예제 #28
0
 void OnGetLobbyInfo(LobbyDataUpdate_t result)
 {
     ButtonControl();
 }
예제 #29
0
 void OnLobbyDataUpdate(LobbyDataUpdate_t lobbyDataUpdate_T)
 {
     Sender.roomid = (CSteamID)lobbyDataUpdate_T.m_ulSteamIDLobby;
     UpdateLobbyInfo(ref m_CurrentLobby);
     SetBasic();
 }
 void OnLobbyDataUpdate(LobbyDataUpdate_t pCallback)
 {
     Console.WriteLine("[" + LobbyDataUpdate_t.k_iCallback + " - LobbyDataUpdate] - " + pCallback.m_ulSteamIDLobby + " -- " + pCallback.m_ulSteamIDMember + " -- " + pCallback.m_bSuccess);
 }