@@ -1536,19 +1536,31 @@ function G.FUNCS.get_poker_hand_info(_cards)
15361536 return text , loc_disp_text , poker_hands , scoring_hand , disp_text
15371537end
15381538
1539- function create_UIBox_current_hands (simple )
1539+ function create_UIBox_current_hands (simple , in_collection )
15401540 G .current_hands = {}
15411541
1542+ local _pool = in_collection and SMODS .collection_pool (SMODS .PokerHands ) or nil
1543+ local handlist = in_collection and {} or nil
1544+ if _pool then
1545+ for _ , v in ipairs (_pool ) do
1546+ table.insert (handlist , v .key )
1547+ end
1548+ end
1549+
15421550 local visible_hands = {}
1543- for _ , v in ipairs (G .handlist ) do
1544- if SMODS .is_poker_hand_visible (v ) then
1545- table.insert (visible_hands , v )
1551+ if not handlist then
1552+ for _ , v in ipairs (G .handlist ) do
1553+ if SMODS .is_poker_hand_visible (v ) then
1554+ table.insert (visible_hands , v )
1555+ end
15461556 end
1557+ else
1558+ visible_hands = handlist
15471559 end
15481560
15491561 local index = 0
1550- for _ , v in ipairs (G .handlist ) do
1551- local ui_element = create_UIBox_current_hand_row (v , simple )
1562+ for _ , v in ipairs (handlist or G .handlist ) do
1563+ local ui_element = create_UIBox_current_hand_row (v , simple , in_collection )
15521564 G .current_hands [index + 1 ] = ui_element
15531565 if ui_element then
15541566 index = index + 1
@@ -1558,48 +1570,71 @@ function create_UIBox_current_hands(simple)
15581570 end
15591571 end
15601572
1561-
15621573 local hand_options = {}
15631574 for i = 1 , math.ceil (# visible_hands / 10 ) do
15641575 table.insert (hand_options ,
15651576 localize (' k_page' ) .. ' ' .. tostring (i ) .. ' /' .. tostring (math.ceil (# visible_hands / 10 )))
15661577 end
15671578
1568- local object = {n = G .UIT .ROOT , config = {align = " cm" , colour = G .C .CLEAR }, nodes = {
1569- {n = G .UIT .R , config = {align = " cm" , padding = 0.04 }, nodes =
1570- G .current_hands },
1571- -- UI consistency with vanilla
1572- # visible_hands > 12 and {n = G .UIT .R , config = {align = " cm" , padding = 0 }, nodes = {
1573- create_option_cycle ({
1574- options = hand_options ,
1575- w = 4.5 ,
1576- cycle_shoulders = true ,
1577- opt_callback = ' your_hands_page' ,
1578- focus_args = { snap_to = true , nav = ' wide' },
1579- current_option = 1 ,
1580- colour = G .C .RED ,
1581- no_pips = true
1582- })}} or nil ,
1583- }}
1579+ local object = {
1580+ n = G .UIT .ROOT ,
1581+ config = { align = " cm" , colour = G .C .CLEAR },
1582+ nodes = {
1583+ {
1584+ n = G .UIT .R ,
1585+ config = { align = " cm" , padding = 0.04 },
1586+ nodes =
1587+ G .current_hands
1588+ },
1589+ -- UI consistency with vanilla
1590+ # visible_hands > 12 and {
1591+ n = G .UIT .R ,
1592+ config = { align = " cm" , padding = 0 },
1593+ nodes = {
1594+ create_option_cycle ({
1595+ options = hand_options ,
1596+ w = 4.5 ,
1597+ cycle_shoulders = true ,
1598+ opt_callback = ' your_hands_page' ,
1599+ focus_args = { snap_to = true , nav = ' wide' },
1600+ current_option = 1 ,
1601+ colour = G .ACTIVE_MOD_UI and (G .ACTIVE_MOD_UI .ui_config or {}).collection_option_cycle_colour or
1602+ G .C .RED ,
1603+ no_pips = true ,
1604+ in_collection = in_collection
1605+ }) }
1606+ } or nil }
1607+ }
15841608
1585- local t = {n = G .UIT .ROOT , config = {align = " cm" , minw = 3 , padding = 0.1 , r = 0.1 , colour = G .C .CLEAR }, nodes = {
1586- {n = G .UIT .O , config = {
1587- id = ' hand_list' ,
1588- object = UIBox {
1589- definition = object , config = {offset = { x = 0 , y = 0 }, align = ' cm' }
1590- }
1591- }}}}
1592- return t
1609+ local t = {
1610+ n = G .UIT .O ,
1611+ config = {
1612+ id = ' hand_list' ,
1613+ object = UIBox {
1614+ definition = object , config = { offset = { x = 0 , y = 0 }, align = ' cm' }
1615+ }
1616+ }
1617+ }
1618+ return not in_collection and
1619+ { n = G .UIT .ROOT , config = { align = " cm" , minw = 3 , padding = 0.1 , r = 0.1 , colour = G .C .CLEAR }, nodes = { t } } or
1620+ t
15931621end
15941622
15951623G .FUNCS .your_hands_page = function (args )
15961624 if not args or not args .cycle_config then return end
15971625 G .current_hands = {}
1598-
1626+ local in_collection = args .cycle_config .in_collection
1627+ local _pool = in_collection and SMODS .collection_pool (SMODS .PokerHands ) or nil
1628+ local handlist = in_collection and {} or nil
1629+ if _pool then
1630+ for _ , v in ipairs (_pool ) do
1631+ table.insert (handlist , v .key )
1632+ end
1633+ end
15991634
16001635 local index = 0
1601- for _ , v in ipairs (G .handlist ) do
1602- local ui_element = create_UIBox_current_hand_row (v , simple )
1636+ for _ , v in ipairs (handlist or G .handlist ) do
1637+ local ui_element = create_UIBox_current_hand_row (v , simple , in_collection )
16031638 if index >= (0 + 10 * (args .cycle_config .current_option - 1 )) and index < 10 * args .cycle_config .current_option then
16041639 G .current_hands [index - (10 * (args .cycle_config .current_option - 1 )) + 1 ] = ui_element
16051640 end
@@ -1614,10 +1649,14 @@ G.FUNCS.your_hands_page = function(args)
16141649 end
16151650
16161651 local visible_hands = {}
1617- for _ , v in ipairs (G .handlist ) do
1618- if SMODS .is_poker_hand_visible (v ) then
1619- table.insert (visible_hands , v )
1652+ if not handlist then
1653+ for _ , v in ipairs (G .handlist ) do
1654+ if SMODS .is_poker_hand_visible (v ) then
1655+ table.insert (visible_hands , v )
1656+ end
16201657 end
1658+ else
1659+ visible_hands = handlist
16211660 end
16221661
16231662 local hand_options = {}
@@ -1626,10 +1665,16 @@ G.FUNCS.your_hands_page = function(args)
16261665 localize (' k_page' ) .. ' ' .. tostring (i ) .. ' /' .. tostring (math.ceil (# visible_hands / 10 )))
16271666 end
16281667
1629- local object = {n = G .UIT .ROOT , config = {align = " cm" , colour = G .C .CLEAR }, nodes = {
1630- {n = G .UIT .R , config = {align = " cm" , padding = 0.04 }, nodes = G .current_hands
1668+ local object = {
1669+ n = G .UIT .ROOT ,
1670+ config = { align = " cm" , colour = G .C .CLEAR },
1671+ nodes = {
1672+ { n = G .UIT .R , config = { align = " cm" , padding = 0.04 }, nodes = G .current_hands
16311673 },
1632- {n = G .UIT .R , config = {align = " cm" , padding = 0 }, nodes = {
1674+ {
1675+ n = G .UIT .R ,
1676+ config = { align = " cm" , padding = 0 },
1677+ nodes = {
16331678 create_option_cycle ({
16341679 options = hand_options ,
16351680 w = 4.5 ,
@@ -1638,9 +1683,10 @@ G.FUNCS.your_hands_page = function(args)
16381683 ' your_hands_page' ,
16391684 focus_args = { snap_to = true , nav = ' wide' },
16401685 current_option = args .cycle_config .current_option ,
1641- colour = G
1642- .C .RED ,
1643- no_pips = true
1686+ colour = G .ACTIVE_MOD_UI and (G .ACTIVE_MOD_UI .ui_config or {}).collection_option_cycle_colour or
1687+ G .C .RED ,
1688+ no_pips = true ,
1689+ in_collection = in_collection
16441690 })
16451691 }
16461692 }
@@ -1653,7 +1699,7 @@ G.FUNCS.your_hands_page = function(args)
16531699 hand_list .config .object :remove ()
16541700 end
16551701 hand_list .config .object = UIBox {
1656- definition = object , config = {offset = { x = 0 , y = 0 }, align = ' cm' , parent = hand_list }
1702+ definition = object , config = { offset = { x = 0 , y = 0 }, align = ' cm' , parent = hand_list }
16571703 }
16581704 end
16591705end
0 commit comments