Add Progress tab: discovery completion overview
Fifth catalog tab (also reachable from the in-run Combos button) showing famous pairs fielded (x/31), per-group theme exploration bars (Engine/Economy/Hands), pairs fielded in the current run, and an overall discoveries tally with the how-to-discover hint. Text-only UI - no live Card objects, no pager. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -881,6 +881,73 @@ local function combos_tab_def(page_no)
|
|||||||
colour = G.C.CLEAR, minw = 8.5, minh = 5.6}, nodes = nodes}
|
colour = G.C.CLEAR, minw = 8.5, minh = 5.6}, nodes = nodes}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Progress tab: discovery completion at a glance. Text-only (no live Card
|
||||||
|
-- objects), so unlike the other tabs nothing here would break if cached —
|
||||||
|
-- but it is rebuilt each open like the rest, which keeps counts fresh.
|
||||||
|
|
||||||
|
local function progress_bar(nodes, label, found, total)
|
||||||
|
local frac = total > 0 and found / total or 0
|
||||||
|
local W = 3.6
|
||||||
|
local bar_nodes = {}
|
||||||
|
if frac > 0 then
|
||||||
|
bar_nodes[#bar_nodes + 1] = {n = G.UIT.C,
|
||||||
|
config = {minw = W * frac, minh = 0.26, colour = G.C.GREEN, r = 0.1}}
|
||||||
|
end
|
||||||
|
if frac < 1 then
|
||||||
|
bar_nodes[#bar_nodes + 1] = {n = G.UIT.C,
|
||||||
|
config = {minw = W * (1 - frac), minh = 0.26, colour = G.C.BLACK, r = 0.1}}
|
||||||
|
end
|
||||||
|
nodes[#nodes + 1] = {n = G.UIT.R, config = {align = 'cm', padding = 0.04}, nodes = {
|
||||||
|
{n = G.UIT.C, config = {align = 'cl', minw = 2.6}, nodes = {
|
||||||
|
{n = G.UIT.T, config = {text = label,
|
||||||
|
colour = G.C.UI.TEXT_LIGHT, scale = 0.3}},
|
||||||
|
}},
|
||||||
|
{n = G.UIT.C, config = {align = 'cl'}, nodes = bar_nodes},
|
||||||
|
{n = G.UIT.C, config = {align = 'cl', minw = 1.1}, nodes = {
|
||||||
|
{n = G.UIT.T, config = {text = (' %d/%d'):format(found, total),
|
||||||
|
colour = G.C.UI.TEXT_LIGHT, scale = 0.3}},
|
||||||
|
}},
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
local function progress_tab_def()
|
||||||
|
local nodes = {}
|
||||||
|
add_caption(nodes, 'Collection progress')
|
||||||
|
local pairs_found, pairs_total = 0, #JCA.pair_list
|
||||||
|
for _, p in ipairs(JCA.pair_list) do
|
||||||
|
if JCA.config.discovered[pair_key(p[1], p[2])] then
|
||||||
|
pairs_found = pairs_found + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
progress_bar(nodes, 'Famous pairs', pairs_found, pairs_total)
|
||||||
|
local themes_found, themes_total = 0, 0
|
||||||
|
for _, group in ipairs(THEME_TABS) do
|
||||||
|
local found = 0
|
||||||
|
for _, t in ipairs(group.themes) do
|
||||||
|
if JCA.config.themes_found[t.tag] then found = found + 1 end
|
||||||
|
end
|
||||||
|
progress_bar(nodes, group.label .. ' themes', found, #group.themes)
|
||||||
|
themes_found = themes_found + found
|
||||||
|
themes_total = themes_total + #group.themes
|
||||||
|
end
|
||||||
|
if G.GAME and G.GAME.jca_run_combos and next(G.GAME.jca_run_combos) then
|
||||||
|
local run = 0
|
||||||
|
for _ in pairs(G.GAME.jca_run_combos) do run = run + 1 end
|
||||||
|
nodes[#nodes + 1] = {n = G.UIT.R, config = {align = 'cm', padding = 0.04}, nodes = {
|
||||||
|
{n = G.UIT.T, config = {
|
||||||
|
text = run .. (run == 1 and ' famous pair' or ' famous pairs')
|
||||||
|
.. ' fielded this run',
|
||||||
|
colour = G.C.GOLD, scale = 0.3}},
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
add_info_rows(nodes,
|
||||||
|
('%d of %d discoveries logged. Field both jokers of a famous pair, or a source and a payoff of a theme, to log it.')
|
||||||
|
:format(pairs_found + themes_found, pairs_total + themes_total),
|
||||||
|
70, 0.26)
|
||||||
|
return {n = G.UIT.ROOT, config = {align = 'tm', padding = 0.05,
|
||||||
|
colour = G.C.CLEAR, minw = 8.5, minh = 5.6}, nodes = nodes}
|
||||||
|
end
|
||||||
|
|
||||||
-- Page cyclers swap the tab body in place (same pattern SMODS uses for its
|
-- Page cyclers swap the tab body in place (same pattern SMODS uses for its
|
||||||
-- achievements tab).
|
-- achievements tab).
|
||||||
local function register_pager(name, def_fn)
|
local function register_pager(name, def_fn)
|
||||||
@@ -913,6 +980,10 @@ local function catalog_tabs()
|
|||||||
tab_definition_function = function() return theme_tab_def(t, 1) end,
|
tab_definition_function = function() return theme_tab_def(t, 1) end,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
tabs[#tabs + 1] = {
|
||||||
|
label = 'Progress',
|
||||||
|
tab_definition_function = progress_tab_def,
|
||||||
|
}
|
||||||
return tabs
|
return tabs
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user