示例#1
0
        public static void Disconnect()
        {
            try
            {
                Logger.Debug($"Disconnect from current lobby");
                SteamMatchmaking.SetLobbyMemberData(_lobbyInfo.LobbyID, "STATUS", "DISCONNECTED");
                Controllers.PlayerController.Instance.StopBroadcasting();
                _lobbyInfo.HostName = "";
                SendLobbyInfo(true);

                Connection = ConnectionState.DISCONNECTED;
                SteamMatchmaking.LeaveLobby(_lobbyInfo.LobbyID);
                Controllers.PlayerController.Instance.DestroyAvatars();
                WaitingMenu.firstInit  = true;
                WaitingMenu.queuedSong = null;
                _lobbyInfo             = new LobbyInfo();
                UpdateUserInfo();
                Scoreboard.Instance.RemoveAll();
                SongListUtils.InSong = false;
                Controllers.PlayerController.Instance._playerInfo = new PlayerInfo(GetUserName(), GetUserID());
                LobbyData.Clear();
            } catch (Exception e)
            {
                Logger.Error(e);
            }
        }
示例#2
0
        public void LeaveLobby()
        {
            SendChatMessage(SteamFriends.GetPersonaName() + " Lefted the Lobby", false);
            NetworkControl.SendPacketsSafely(new P2PPackage(null, P2PPackageType.LeftLobby), false);
            NetworkControl.PlayerList.Clear();
            SteamMatchmaking.LeaveLobby(lobby);
            lobby = new CSteamID();

            foreach (var t in NetworkControl.instance.OnlineObjects)
            {
                if (t == null)
                {
                    continue;
                }
                Destroy(t.gameObject);
            }

            NetworkControl.instance.OnlineObjects.Clear();
            if (events.lobby_leaved != null)
            {
                events.lobby_leaved.Invoke();
            }
            Destroy(gameObject);
            if (scenes.CurrentScene != scenes.LobbyScene)
            {
                SceneManager.LoadScene(scenes.LobbyScene);
                scenes.CurrentScene = scenes.LobbyScene;
            }
        }
示例#3
0
    public void LeaveLobby()
    {
        GameObject safeground = GameObject.FindGameObjectWithTag("Ground");

        Destroy(safeground);
        GameObject[] pcs = GameObject.FindGameObjectsWithTag("Player");
        foreach (GameObject pc in pcs)
        {
            Destroy(pc);
        }
        if (hassession)
        {
            for (int i = 0; i < Sender.TOmb.Length; i++)
            {
                if (Sender.TOmb[i] != SteamUser.GetSteamID())
                {
                    SteamNetworking.CloseP2PSessionWithUser(Sender.TOmb[i]);
                }
            }
            hassession = false;
        }
        SteamMatchmaking.LeaveLobby(Sender.roomid);
        Readytoggle.isOn = false;
        SwitchToMenu01();
    }
示例#4
0
 private void OnApplicationQuit()
 {
     if (m_lobbyID != null)
     {
         SteamMatchmaking.LeaveLobby(m_lobbyID);
     }
 }
示例#5
0
        public void StopSteamClient()
        {
            if (remoteSteamId != CSteamID.Nil && steamNetworkingLoopCoroutine != null)
            {
                StopCoroutine(steamNetworkingLoopCoroutine);
                steamNetworkingLoopCoroutine = null;

                sessionErrorCallback.Dispose();
                sessionErrorCallback = null;

                steamLobbyChatUpdate.Dispose();
                steamLobbyChatUpdate = null;

                remoteSteamId = CSteamID.Nil;

                isClientConnected = false;

                SteamMatchmaking.LeaveLobby(steamLobbyId);
                steamLobbyId = CSteamID.Nil;
            }

            if (client != null)
            {
                StopClient();
            }
        }
示例#6
0
 private void updateLobbyPrivacy()
 {
     if (lobbyOwner != selfId)
     {
         return;
     }
     if (lobby != null)
     {
         GalaxyInstance.Matchmaking().SetLobbyType(lobby, privacyToLobbyType(privacy));
     }
     if (lobby == null)
     {
         if (steamLobby.HasValue)
         {
             SteamMatchmaking.LeaveLobby(steamLobby.Value);
         }
     }
     else if (!steamLobby.HasValue)
     {
         if (steamLobbyEnterCallback == null)
         {
             steamLobbyEnterCallback = Callback <LobbyEnter_t> .Create(onSteamLobbyEnter);
         }
         SteamMatchmaking.CreateLobby(privacyToSteamLobbyType(privacy), (int)memberLimit);
     }
     else
     {
         SteamMatchmaking.SetLobbyType(steamLobby.Value, privacyToSteamLobbyType(privacy));
         SteamMatchmaking.SetLobbyData(steamLobby.Value, "connect", getConnectionString());
     }
 }
示例#7
0
        public void StopSteamHost()
        {
            if (sessionRequestCallback != null && steamNetworkingLoopCoroutine != null)
            {
                StopCoroutine(steamNetworkingLoopCoroutine);
                steamNetworkingLoopCoroutine = null;

                StopCoroutine(pingSenderCoroutine);
                pingSenderCoroutine = null;

                sessionRequestCallback.Dispose();
                sessionRequestCallback = null;

                sessionErrorCallback.Dispose();
                sessionErrorCallback = null;

                steamLobbyChatUpdate.Dispose();
                steamLobbyChatUpdate = null;

                steamIdToConnection = null;

                SteamMatchmaking.LeaveLobby(steamLobbyId);
                steamLobbyId = CSteamID.Nil;
            }

            if (NetworkServer.active)
            {
                StopHost();
            }
        }
示例#8
0
        public static void LeaveLobby()
        {
            //REMOVE//if ( s_CurrentLobby.m_handle == null ) return;

            SteamMatchmaking.LeaveLobby(s_CurrentLobby.m_handle);
            s_CurrentLobby.m_handle.Clear();
        }
示例#9
0
 public void OnApplicationExit()
 {
     if (!lobby.Equals(CSteamID.Nil))
     {
         SteamMatchmaking.LeaveLobby(lobby);
     }
 }
示例#10
0
 public void Leave()
 {
     if (State == LobbyState.Active)
     {
         SteamMatchmaking.LeaveLobby(Id);
     }
     State = LobbyState.Inactive;
     _usersSeen.Clear();
 }
    public override bool Disconnect()
    {
        CSteamID lobbyOwner = SteamMatchmaking.GetLobbyOwner(new CSteamID(LobbyID));

        SteamMatchmaking.LeaveLobby(new CSteamID(LobbyID));
        HandleDisconnection();
        Connected = false;
        return(SteamNetworking.CloseP2PSessionWithUser(lobbyOwner));
    }
 // Token: 0x0600096B RID: 2411 RVA: 0x000454F1 File Offset: 0x000436F1
 public void UnregisterServer()
 {
     if (this.m_myLobby != CSteamID.Nil)
     {
         SteamMatchmaking.SetLobbyJoinable(this.m_myLobby, false);
         SteamMatchmaking.LeaveLobby(this.m_myLobby);
         this.m_myLobby = CSteamID.Nil;
     }
 }
示例#13
0
    private void OnPlayerLeftLobby(LobbyChatUpdate_t callback)
    {
        var cSteamId = new CSteamID(callback.m_ulSteamIDUserChanged);

        if (cSteamId == SteamMatchmaking.GetLobbyOwner(LobbyId))
        {
            SteamMatchmaking.LeaveLobby(LobbyId);
        }
    }
示例#14
0
 public void Leave()
 {
     if (this.State == LobbyState.Active)
     {
         SteamMatchmaking.LeaveLobby(this.Id);
     }
     this.State = LobbyState.Inactive;
     this._usersSeen.Clear();
 }
示例#15
0
 public void Reset()
 {
     SteamMatchmaking.LeaveLobby(LobbyID);
     LobbyID = new CSteamID(0);
     if (Users != null)
     {
         Users.Clear();
     }
     Owner = new CSteamID(0);
 }
示例#16
0
 public void Leave()
 {
     //IL_000a: Unknown result type (might be due to invalid IL or missing references)
     if (State == LobbyState.Active)
     {
         SteamMatchmaking.LeaveLobby(Id);
     }
     State = LobbyState.Inactive;
     _usersSeen.Clear();
 }
    public void LeaveLobby()
    {
        SteamMatchmaking.LeaveLobby(LobbyID);

        networkManager.StopServer();

        networkManager.StopHost();
        menuManager.DisplayLoading();
        menuManager.NavigateToMenu("Landing");
    }
示例#18
0
 // Token: 0x06002EDF RID: 11999 RVA: 0x00132323 File Offset: 0x00130723
 public static void leaveLobby()
 {
     if (!Lobbies.inLobby)
     {
         return;
     }
     Terminal.print("Leave lobby", null, Provider.STEAM_IC, Provider.STEAM_DC, true);
     Lobbies.isHost  = false;
     Lobbies.inLobby = false;
     SteamMatchmaking.LeaveLobby(Lobbies.currentLobby);
 }
        internal void LeaveLobby(SteamLobby lobby)
        {
            Assert.IsNotNull(lobby);
            var id = new CSteamID(lobby.Id);

            if (!_connectedLobbies.ContainsKey(id))
            {
                throw new InvalidOperationException("[Steam] Not connected to lobby.");
            }
            _connectedLobbies.Remove(id);
            SteamMatchmaking.LeaveLobby(id);
            lobby.Dispose();
        }
示例#20
0
        /// <summary>
        /// Disconnects this server and all of it's clients
        /// </summary>
        /// <param name="forced">Used to tell if this disconnect was intentional <c>false</c> or caused by an exception <c>true</c></param>
        public override void Disconnect(bool forced)
        {
            // Since we are disconnecting we need to stop the read thread
            Logging.BMSLog.Log("<color=cyan>SteamP2P server disconnecting...</color>");
            StopAcceptingConnections();
            readThreadCancel = true;

            lock (Players)
            {
                // Go through all of the players and disconnect them
                foreach (NetworkingPlayer player in Players)
                {
                    if (player != Me)
                    {
                        Disconnect(player, forced);
                    }
                }

                CleanupDisconnections();

                int counter = 0;
                for (; ; counter++)
                {
                    if (counter >= 10 || Players.Count == 1)
                    {
                        break;
                    }

                    Thread.Sleep(100);
                }

                // Send signals to the methods registered to the disconnect events
                if (!forced)
                {
                    OnDisconnected();
                }
                else
                {
                    OnForcedDisconnect();
                }

                // Stop listening for new connections
                Client.Close();
            }

            if (LobbyID.IsLobby())
            {
                SteamMatchmaking.LeaveLobby(LobbyID);
            }
        }
示例#21
0
 public void LeaveLobby()
 {
     SteamMatchmaking.LeaveLobby(SteamLobby.LobbyId);
     if (isServer)
     {
         SteamMatchmaking.LeaveLobby(SteamLobby.LobbyId);
         MyNetworkManager.singleton.StopHost();
     }
     else
     {
         SteamMatchmaking.LeaveLobby(SteamLobby.LobbyId);
         MyNetworkManager.singleton.StopClient();
     }
 }
示例#22
0
 public override void Disconnected(BoltConnection connection)
 {
     if (BoltNetwork.isClient && CoopClientCallbacks.OnDisconnected == null)
     {
         if (CoopLobby.IsInLobby)
         {
             SteamMatchmaking.LeaveLobby(CoopLobby.Instance.Info.LobbyId);
         }
         CoopPlayerCallbacks._allTrees = null;
         CoopPlayerCallbacks.WasDisconnectedFromServer = true;
         BoltLauncher.Shutdown();
         Application.LoadLevel("TitleScene");
     }
 }
示例#23
0
    public void LeaveTeambuilderLobby()
    {
        if (teambuilderLobbyId != CSteamID.Nil)
        {
            StopAllCoroutines();

            SteamMatchmaking.LeaveLobby(teambuilderLobbyId);
            SteamNetworkManager.Instance.premadeLobbyId = CSteamID.Nil;
            teambuilderLobbyId = CSteamID.Nil;

            FlushTeammatesPresence();
            MainMenuManager.Instance.MenuPlayLock(false);
        }
    }
示例#24
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();
                }
            }
        }
示例#25
0
 public unsafe static void LeaveLobby(Lobby which)
 {
     if (!_initialized)
     {
         return;
     }
     if (which != null)
     {
         SteamMatchmaking.LeaveLobby(new CSteamID(which.id));
     }
     if (lobby == which)
     {
         lobby = null;
     }
 }
示例#26
0
    // FOR TESTING
    private IEnumerator Test()
    {
        //test if lobby is created and leaves lobby (destroys on steams end)
        yield return(new WaitForSeconds(3.0f));

        SteamMatchmaking.AddRequestLobbyListStringFilter("Gamemode", "Ballers-1v1", ELobbyComparison.k_ELobbyComparisonEqual);
        SteamAPICall_t result = SteamMatchmaking.RequestLobbyList();

        m_CallResultLobbyMatchList.Set(result, OnLobbyMatchListTest);
        yield return(new WaitForSeconds(1.0f));

        print("leaving lobby...");
        SteamMatchmaking.LeaveLobby(m_lobbyID);
        m_lobbyID = CSteamID.Nil;
    }
示例#27
0
        public void LeaveLobby()
        {
            if (lobbyID.m_SteamID != 0)
            {
                SteamMatchmaking.LeaveLobby(lobbyID);
            }
            foreach (ulong player in otherPlayers)
            {
                SteamNetworking.CloseP2PSessionWithUser((CSteamID)player);
            }
            connectedPlayers.Clear();
            otherPlayers.Clear();

            lobbyID  = new CSteamID(0);
            isInGame = false;
        }
示例#28
0
        void CloseAllConnections()
        {
            if (currentLobbyId == CSteamID.Nil)
            {
                return;
            }
            SteamMatchmaking.LeaveLobby(currentLobbyId);
            var playerCount = SteamMatchmaking.GetNumLobbyMembers(currentLobbyId);

            for (var i = 0; i < playerCount; i++)
            {
                var id = SteamMatchmaking.GetLobbyMemberByIndex(currentLobbyId, i);
                SteamNetworking.CloseP2PSessionWithUser(id);
            }
            Debug.Log($"[Steam] Left lobby {currentLobbyId}");
            currentLobbyId = CSteamID.Nil;
        }
示例#29
0
 void OnLobbyEntered(LobbyEnter_t result)
 {
     if (current_lobbyID == result.m_ulSteamIDLobby)
     {
         return;
     }
     current_lobbyID = result.m_ulSteamIDLobby;
     if (result.m_EChatRoomEnterResponse == 1)
     {
         if (SteamMatchmaking.GetLobbyData((CSteamID)current_lobbyID, "status") != "open" || SteamMatchmaking.GetNumLobbyMembers((CSteamID)current_lobbyID) > 2)
         {
             SetText("joinfail");
             initializedStatus = -2;
             SteamMatchmaking.LeaveLobby((CSteamID)current_lobbyID);
             return;
         }
         otherUsr = SteamMatchmaking.GetLobbyMemberByIndex((CSteamID)current_lobbyID, 0);
         if ((CSteamID)otherUsr == SteamUser.GetSteamID())
         {
             Debug.Log("F**K!");
             return;
         }
         initializedStatus = 5;
         SetUpReadyButtons();
         lastTimeMessageReceived = Time.time;
         //Debug.Log ("OTHERUSR: "******"player", ((int)PD.p1Char).ToString());
         int score = 0;
         SteamUserStats.GetUserStat(otherUsr, "GAMESCORE", out score);
         if (player2Rank == null)
         {
             FontData f = PD.mostCommonFont.Clone(); f.color = Color.white;
             player2Rank = GetMeshText(new Vector3(0.745f, 1.8f), SteamFriends.GetFriendPersonaName(otherUsr), f);
             SteamUserStats.RequestUserStats(otherUsr);
         }
         parent.ForcePlayer2(int.Parse(SteamMatchmaking.GetLobbyData((CSteamID)current_lobbyID, "playerone")));
         myMesh.gameObject.SetActive(false);
     }
     else
     {
         SetText("joinfail");
         initializedStatus = -2;
         current_lobbyID   = 0;
     }
 }
        public static void LeaveFromCurrentLobby()
        {
            lock (LOCK)
            {
                if (_currentLobby.HasValue)
                {
                    var id = _currentLobby.Value;

                    SteamMatchmaking.SetLobbyJoinable(id, false);
                    SteamMatchmaking.SetLobbyData(id, LobbyDataKeys.HOST_STEAM_ID, "0");

                    SteamMatchmaking.LeaveLobby(id);
                    Console.WriteLine("Лобби покинуто " + id);
                    _currentLobby  = null;
                    _currentServer = null;
                }
            }
        }