private void LobbyBrowser_OnUpdate() { GameList.data.Clear(); CancelImageLoading(); if (!String.IsNullOrEmpty(HostedGameBrowser.ServerMessage)) { ServerMessageText.text = HostedGameBrowser.ServerMessage; ServerMessageText.enabled = true; } else { ServerMessageText.enabled = false; } if (!HostedGameBrowser.ConnectionOk) { StatusText.text = "Failed to get server list"; StatusText.color = Color.red; } else if (!HostedGameBrowser.AnyResultsOnPage) { if (HostedGameBrowser.TotalResultCount == 0) { if (IsSearching) { StatusText.text = "No servers found matching your search"; } else { StatusText.text = "Sorry, no servers found"; } } else { StatusText.text = "This page is empty"; RefreshButtonClick(); // this is awkward so force a refresh } StatusText.color = Color.red; } else { StatusText.text = $"Found {HostedGameBrowser.TotalResultCount} " + (HostedGameBrowser.TotalResultCount == 1 ? "server" : "servers") + $" (Page {HostedGameBrowser.PageIndex + 1} of {HostedGameBrowser.TotalPageCount})"; StatusText.color = Color.green; if (IsSearching) { StatusText.text += " (Filtered)"; } foreach (var lobby in HostedGameBrowser.LobbiesOnPage) { GameList.data.Add(new HostedGameCellData(_imageLoadCancellation, CellUpdateCallback, lobby)); } } if (!MpSession.GetLocalPlayerHasMultiplayerExtensions()) { StatusText.text += "\r\nMultiplayerExtensions not detected, hiding modded games"; StatusText.color = Color.yellow; FilterModdedButton.interactable = false; } AfterCellsCreated(); RefreshButton.interactable = true; SearchButton.interactable = (IsSearching || HostedGameBrowser.AnyResultsOnPage); SearchButton.SetButtonText(IsSearching ? "<color=#32CD32>Search</color>" : "Search"); PageUpButton.interactable = HostedGameBrowser.PageIndex > 0; PageDownButton.interactable = HostedGameBrowser.PageIndex < HostedGameBrowser.TotalPageCount - 1; }