From 1d61783d2079990fb282105e1b96704da0074bbe Mon Sep 17 00:00:00 2001 From: nyarw Date: Sat, 31 Oct 2026 11:40:01 +0100 Subject: [PATCH 01/14] fix: show placeholder cover for maps without a cover --- scripts/scenes/MapCard.cs | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/scripts/scenes/MapCard.cs b/scripts/scenes/MapCard.cs index a5be65a9..3c92dc77 100644 --- a/scripts/scenes/MapCard.cs +++ b/scripts/scenes/MapCard.cs @@ -241,7 +241,12 @@ public void Bind(JsonElement map, CancellationTokenSource source) tweenRightPanelColor(rightPanel, rightPanelCorners, state); }; - _ = loadCover(map.GetProperty("covers").GetProperty("128"), coverImage, blurCoverImage, source); + JsonElement coverUrl = + map.TryGetProperty("covers", out var covers) && covers.ValueKind == JsonValueKind.Object && covers.TryGetProperty("128", out var cover128) + ? cover128 + : default; + + _ = loadCover(coverUrl, coverImage, blurCoverImage, Constants.DIFFICULTY_COLORS[difficulty], source); } private static async Task downloadMap(JsonElement fileUrl, string mapId, CancellationTokenSource source) @@ -277,17 +282,28 @@ private static async Task downloadMap(JsonElement fileUrl, string mapId, Ca } } - private static async Task loadCover(JsonElement coverUrl, TextureRect coverTexture, TextureRect blurCoverTexture, CancellationTokenSource source) + private static async Task loadCover( + JsonElement coverUrl, + TextureRect coverTexture, + TextureRect blurCoverTexture, + Color placeholderTint, + CancellationTokenSource source + ) { var token = source.Token; - Texture2D cover = null; + Texture2D cover = SkinManager.Instance.Skin.MapListGridCoverBackgroundImage; + Color tint = placeholderTint; try { - if (!token.IsCancellationRequested && coverUrl.ValueKind != JsonValueKind.Null) + if (!token.IsCancellationRequested && coverUrl.ValueKind == JsonValueKind.String) { var coverImage = await MapBrowserService.GetCoverImage(coverUrl.GetString(), token); - cover = ImageTexture.CreateFromImage(coverImage); + if (coverImage != null) + { + cover = ImageTexture.CreateFromImage(coverImage); + tint = Colors.White; + } } } catch (Exception exception) @@ -300,7 +316,9 @@ private static async Task loadCover(JsonElement coverUrl, TextureRect coverTextu return; coverTexture.Texture = cover; + coverTexture.SelfModulate = tint; blurCoverTexture.Texture = cover; + blurCoverTexture.SelfModulate = tint; } private static Map getDownloadedMap(string hash) From 6bbe8bec80b5f89622201e921a661fc06dda4215 Mon Sep 17 00:00:00 2001 From: nyarw Date: Sat, 31 Oct 2026 11:40:01 +0100 Subject: [PATCH 02/14] fix: remove client-side installed filter and use 18 results per page --- scenes/map_browser.tscn | 13 ------------ scripts/scenes/MapBrowser.cs | 41 +++++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 30 deletions(-) diff --git a/scenes/map_browser.tscn b/scenes/map_browser.tscn index 609bb9fa..e943b1c3 100644 --- a/scenes/map_browser.tscn +++ b/scenes/map_browser.tscn @@ -314,19 +314,6 @@ popup/item_1/id = 1 popup/item_2/text = "Both" popup/item_2/id = 2 -[node name="Installed" type="OptionButton" parent="Holder/Background/Layout/TopBarBackground/Margin/TopBar/Filters" unique_id=1262770447] -layout_mode = 2 -size_flags_horizontal = 3 -alignment = 1 -selected = 2 -item_count = 3 -popup/item_0/text = "Online" -popup/item_0/id = 1 -popup/item_1/text = "Downloaded" -popup/item_1/id = 0 -popup/item_2/text = "Both" -popup/item_2/id = 2 - [node name="ActiveFilters" type="HBoxContainer" parent="Holder/Background/Layout/TopBarBackground/Margin/TopBar" unique_id=1401022026] visible = false layout_mode = 2 diff --git a/scripts/scenes/MapBrowser.cs b/scripts/scenes/MapBrowser.cs index a08c7b38..22c489c3 100644 --- a/scripts/scenes/MapBrowser.cs +++ b/scripts/scenes/MapBrowser.cs @@ -22,7 +22,6 @@ public partial class MapBrowser : Control private Button refresh; private MenuButton difficulty; private OptionButton status; - private OptionButton installed; private Timer searchTimer; private HBoxContainer filters; private ScrollContainer results; @@ -35,6 +34,9 @@ private enum SortDirection Ascending, } + // multiple of 3 because the results grid has 3 columns + private const int page_size = 18; + private CancellationTokenSource source = new(); public override void _Ready() @@ -51,7 +53,6 @@ public override void _Ready() refresh = searchBar.GetNode