Materialize catalog cards so pages animate on build
Card rows in the Combos/theme tabs emplaced their cards without ever calling Card:start_materialize, so cards popped in with no animation when a tab opened or a page was switched. Every vanilla collection page materializes as it emplaces (create_UIBox_your_collection_jokers). Each card now materializes on emplace; begin_page() lets only the first card of a page build play the sound, matching vanilla's i>1 or j>1 silence flag. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -714,6 +714,14 @@ local function reveal_params()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Cards must be materialized as they are emplaced, the way every vanilla
|
||||||
|
-- collection page does it -- otherwise they pop in with no animation when a
|
||||||
|
-- tab or a page is built. Only the first card of a page build plays the
|
||||||
|
-- whoosh; the rest are silent (vanilla's `i>1 or j>1` flag). Each tab def
|
||||||
|
-- calls begin_page() so the counter tracks one page, not one row.
|
||||||
|
local page_cards = 0
|
||||||
|
local function begin_page() page_cards = 0 end
|
||||||
|
|
||||||
-- `face_down` renders the cards back-up (used for unfielded famous pairs);
|
-- `face_down` renders the cards back-up (used for unfielded famous pairs);
|
||||||
-- face-down cards also show no hover tooltip, keeping the mystery.
|
-- face-down cards also show no hover tooltip, keeping the mystery.
|
||||||
local function card_row_node(keys, scale, face_down)
|
local function card_row_node(keys, scale, face_down)
|
||||||
@@ -732,6 +740,8 @@ local function card_row_node(keys, scale, face_down)
|
|||||||
card.facing = 'back'
|
card.facing = 'back'
|
||||||
card.sprite_facing = 'back'
|
card.sprite_facing = 'back'
|
||||||
end
|
end
|
||||||
|
card:start_materialize(nil, page_cards > 0)
|
||||||
|
page_cards = page_cards + 1
|
||||||
area:emplace(card)
|
area:emplace(card)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -819,6 +829,7 @@ end
|
|||||||
|
|
||||||
-- One theme per page; the pager is labelled with theme names.
|
-- One theme per page; the pager is labelled with theme names.
|
||||||
local function theme_tab_def(group, page_no)
|
local function theme_tab_def(group, page_no)
|
||||||
|
begin_page()
|
||||||
page_no = math.min(page_no or 1, #group.themes)
|
page_no = math.min(page_no or 1, #group.themes)
|
||||||
local theme = group.themes[page_no]
|
local theme = group.themes[page_no]
|
||||||
local sources, payoffs, both = theme_members(theme.tag)
|
local sources, payoffs, both = theme_members(theme.tag)
|
||||||
@@ -886,6 +897,7 @@ end
|
|||||||
local PAIRS_PER_PAGE = 6
|
local PAIRS_PER_PAGE = 6
|
||||||
local sorted_pairs
|
local sorted_pairs
|
||||||
local function combos_tab_def(page_no)
|
local function combos_tab_def(page_no)
|
||||||
|
begin_page()
|
||||||
if not sorted_pairs or JCA._pairs_dirty then
|
if not sorted_pairs or JCA._pairs_dirty then
|
||||||
JCA._pairs_dirty = false
|
JCA._pairs_dirty = false
|
||||||
sorted_pairs = {}
|
sorted_pairs = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user