From 2e694d4952d3f151e5b93c48e6c6c3ce439e236c Mon Sep 17 00:00:00 2001 From: TaikoZhong <108016253+GanYiZhong@users.noreply.github.com> Date: Mon, 5 Oct 2026 14:12:42 +0800 Subject: [PATCH] song select: refresh a folder's song count text when the count changes The folder texts are cached on first draw, but the engine fills in a folder's song count with a background scan after the boxes are first drawn, so the count text stayed at 0 for the rest of the session (e.g. the folder under the cursor at startup kept showing 0 songs). The cache now remembers the count it was built with and rebuilds that one text when box.tja_count changes. Co-Authored-By: Claude Opus 5.5 --- .../song_select/file_navigator/box_folder.lua | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Scripts/song_select/file_navigator/box_folder.lua b/Scripts/song_select/file_navigator/box_folder.lua index 66607e8e..e7ae1632 100644 --- a/Scripts/song_select/file_navigator/box_folder.lua +++ b/Scripts/song_select/file_navigator/box_folder.lua @@ -15,8 +15,14 @@ local function is_2p_screen() return (tex.current_screen and tex.current_screen() or "") == "SONG_SELECT_2P" end +local function make_count_text(count) + local count_cfg = tex.get_skin_config("song_tja_count") or { font_size = 35 } + return text.create_raw_text(base.format_song_count(count), count_cfg.font_size or 35, WHITE, BLACK, false, 5.0, 2.0, 1.0) +end + -- Folder text objects (hori_name, tja_count_text, explanation) from FolderBox::load_text, --- cached per box on self. +-- cached per box on self. The song count is filled in by a background scan after the box is +-- first drawn, so its text is rebuilt whenever the count changes (it stayed at 0 otherwise). local function folder_texts(self, box) self._folder_texts = self._folder_texts or {} local key = box:path() @@ -27,8 +33,8 @@ local function folder_texts(self, box) local hori_cfg = tex.get_skin_config("song_hori_name") or { font_size = 40 } local hori_name = text.create_raw_text(name, hori_cfg.font_size or 40, WHITE, BLACK, false, 5.0, 2.0, 1.0) - local count_cfg = tex.get_skin_config("song_tja_count") or { font_size = 35 } - local tja_count_text = text.create_raw_text(base.format_song_count(box.tja_count or 0), count_cfg.font_size or 35, WHITE, BLACK, false, 5.0, 2.0, 1.0) + local count = box.tja_count or 0 + local tja_count_text = make_count_text(count) local explanation = box:explanation() or {} local exp_cfg = tex.get_skin_config("box_folder_explanation") or { font_size = 34 } @@ -47,8 +53,14 @@ local function folder_texts(self, box) end end - t = { hori_name = hori_name, tja_count_text = tja_count_text, explanation = exp_texts } + t = { hori_name = hori_name, tja_count_text = tja_count_text, count = count, explanation = exp_texts } self._folder_texts[key] = t + else + local count = box.tja_count or 0 + if count ~= t.count then + t.tja_count_text = make_count_text(count) + t.count = count + end end return t end -- 2.54.0