예제 #1
0
        // PUBLIC

        public void StartNextGame()
        {
            if (BoltNetwork.IsServer)
            {
                SWMatchmaking.SetLobbyData(_lobbyData);

                var token = new Multiplayer.RoomProtocolToken()
                {
                    Gamemode     = _lobbyData.ChosenGamemode,
                    PlayersCount = SWMatchmaking.GetCurrentLobbyPlayerCount()
                };
                BoltNetwork.LoadScene(_lobbyData.ChosenMapName, token);
            }
        }
예제 #2
0
        public override void Disconnected(BoltConnection connection)
        {
            var joinToken = (JoinToken)connection.ConnectToken;

            if (BoltNetwork.IsServer)
            {
                var             playerCount          = SWMatchmaking.GetCurrentLobbyPlayerCount();
                LobbyPlayerLeft lobbyPlayerLeftEvent = LobbyPlayerLeft.Create();
                lobbyPlayerLeftEvent.LobbyPlayerCount = playerCount;
                lobbyPlayerLeftEvent.PlayerID         = (int)connection.ConnectionId;
                lobbyPlayerLeftEvent.PlayerNickname   = joinToken.Nickname;
                lobbyPlayerLeftEvent.Send();
            }
        }
예제 #3
0
        private void CheckTimer()
        {
            if (BoltNetwork.IsServer && _timer > _secondsBeforeLaunchingGame && (1 + SWMatchmaking.GetCurrentLobbyPlayerCount()) >= _minimumPlayersToAutomaticLaunch)
            {
                ResetTimer();
                if (OnAutomaticLaunch != null)
                {
                    OnAutomaticLaunch.Invoke();
                }
            }
            else if (BoltNetwork.IsClient && _timer > _secondsBeforeCreatingGame && !_createGamePanelOpen)
            {
                _createGamePanelOpen = true;

                if (OnNoLobbyFound != null)
                {
                    OnNoLobbyFound.Invoke();
                }
            }
        }