public static async Task LoadPage(int offset, HostedGameFilters filters)
        {
            // Send API request
            var result = await BSSBMasterAPI.Browse(offset, filters);

            // Update state
            _offset           = offset;
            _lastServerResult = result;

            // If we got results, process and index the lobby info
            var nextLobbiesOnPage = new List <HostedGameData>();

            if (_lastServerResult != null)
            {
                foreach (var lobby in _lastServerResult.Lobbies)
                {
                    _lobbyObjects[lobby.Id.Value] = lobby;
                    nextLobbiesOnPage.Add(lobby);
                }
            }

            _lobbiesOnPage = nextLobbiesOnPage;

            // Fire update event for the UI
            OnUpdate.Invoke();
        }
Пример #2
0
        public static async Task LoadPage(int offset, string searchQuery, bool filterFull = false, bool filterInProgress = false, bool filterModded = false)
        {
            // Send API request
            var result = await BSSBMasterAPI.Browse(offset, searchQuery, filterFull, filterInProgress, filterModded);

            // Update state
            _offset           = offset;
            _lastServerResult = result;

            // If we got results, process and index the lobby info
            var nextLobbiesOnPage = new List <HostedGameData>();

            if (_lastServerResult != null)
            {
                foreach (var lobby in _lastServerResult.Lobbies)
                {
                    _lobbyObjects[lobby.Id.Value] = lobby;
                    nextLobbiesOnPage.Add(lobby);
                }

                // Server message
                if (!String.IsNullOrEmpty(_lastServerResult.Message))
                {
                    FloatingNotification.Instance.ShowMessage("Server Browser Message", _lastServerResult.Message,
                                                              FloatingNotification.NotificationStyle.Cerise, Sprites.Portal);
                }
            }

            _lobbiesOnPage = nextLobbiesOnPage;

            // Fire update event for the UI
            OnUpdate.Invoke();
        }