mirror of
https://github.com/ershisan99/Fantoms-Preview.git
synced 2025-12-16 20:49:23 +00:00
added button to get score along with delay before showing
This commit is contained in:
@@ -14,6 +14,9 @@ end
|
||||
|
||||
function FN.PRE.simulate()
|
||||
-- Guard against simulating in redundant places:
|
||||
if FN.PRE.five_second_coroutine and coroutine.status(FN.PRE.five_second_coroutine) == "suspended" then
|
||||
coroutine.resume(FN.PRE.five_second_coroutine)
|
||||
end
|
||||
if not (G.STATE == G.STATES.SELECTING_HAND or
|
||||
G.STATE == G.STATES.DRAW_TO_HAND or
|
||||
G.STATE == G.STATES.PLAY_TAROT)
|
||||
@@ -59,6 +62,9 @@ end
|
||||
local orig_hl = CardArea.parse_highlighted
|
||||
function CardArea:parse_highlighted()
|
||||
orig_hl(self)
|
||||
if not FN.PRE.lock_updates and FN.PRE.show_preview then
|
||||
FN.PRE.show_preview = false
|
||||
end
|
||||
FN.PRE.add_update_event("immediate")
|
||||
end
|
||||
|
||||
@@ -86,6 +92,8 @@ function FN.PRE.update_on_card_order_change(cardarea)
|
||||
then return end
|
||||
-- Important not to update on G.STATES.HAND_PLAYED, because it would reset the preview text!
|
||||
|
||||
if (G.STATE == G.STATES.HAND_PLAYED) then return end
|
||||
|
||||
local prev_order = nil
|
||||
if cardarea.config.type == 'joker' and cardarea.cards[1].ability.set == 'Joker' then
|
||||
if cardarea.cards[1].edition and cardarea.cards[1].edition.mp_phantom then
|
||||
@@ -118,7 +126,9 @@ function FN.PRE.update_on_card_order_change(cardarea)
|
||||
elseif cardarea.config.type == 'hand' then
|
||||
FN.PRE.hand_order = prev_order
|
||||
end
|
||||
|
||||
if FN.PRE.show_preview and not FN.PRE.lock_updates then
|
||||
FN.PRE.show_preview = false
|
||||
end
|
||||
FN.PRE.add_update_event("immediate")
|
||||
end
|
||||
end
|
||||
@@ -159,41 +169,59 @@ end
|
||||
function G.FUNCS.fn_pre_score_UI_set(e)
|
||||
local new_preview_text = ""
|
||||
local should_juice = false
|
||||
if FN.PRE.data then
|
||||
if true and (FN.PRE.data.score.min ~= FN.PRE.data.score.max) then
|
||||
-- Format as 'X - Y' :
|
||||
if e.config.id == "fn_pre_l" then
|
||||
new_preview_text = FN.PRE.format_number(FN.PRE.data.score.min) .. " - "
|
||||
if FN.PRE.is_enough_to_win(FN.PRE.data.score.min) then should_juice = true end
|
||||
elseif e.config.id == "fn_pre_r" then
|
||||
new_preview_text = FN.PRE.format_number(FN.PRE.data.score.max)
|
||||
if FN.PRE.is_enough_to_win(FN.PRE.data.score.max) then should_juice = true end
|
||||
if FN.PRE.lock_updates then
|
||||
if e.config.id == "fn_pre_l" then
|
||||
new_preview_text = " CALCULATING "
|
||||
should_juice = true
|
||||
end
|
||||
else
|
||||
if FN.PRE.data then
|
||||
if FN.PRE.show_preview and (FN.PRE.data.score.min ~= FN.PRE.data.score.max) then
|
||||
-- Format as 'X - Y' :
|
||||
if e.config.id == "fn_pre_l" then
|
||||
new_preview_text = FN.PRE.format_number(FN.PRE.data.score.min) .. " - "
|
||||
if FN.PRE.is_enough_to_win(FN.PRE.data.score.min) then should_juice = true end
|
||||
elseif e.config.id == "fn_pre_r" then
|
||||
new_preview_text = FN.PRE.format_number(FN.PRE.data.score.max)
|
||||
if FN.PRE.is_enough_to_win(FN.PRE.data.score.max) then should_juice = true end
|
||||
end
|
||||
else
|
||||
-- Format as single number:
|
||||
if e.config.id == "fn_pre_l" then
|
||||
if true then
|
||||
-- Spaces around number necessary to distinguish Min/Max text from Exact text,
|
||||
-- which is itself necessary to force a HUD update when switching between Min/Max and Exact.
|
||||
if FN.PRE.show_preview then
|
||||
new_preview_text = " " .. FN.PRE.format_number(FN.PRE.data.score.min) .. " "
|
||||
if FN.PRE.is_enough_to_win(FN.PRE.data.score.min) then should_juice = true end
|
||||
else
|
||||
if FN.PRE.is_enough_to_win(FN.PRE.data.score.min) then
|
||||
should_juice = true
|
||||
new_preview_text = " "
|
||||
else
|
||||
if FN.PRE.is_enough_to_win(FN.PRE.data.score.max) then
|
||||
new_preview_text = " "
|
||||
should_juice = true
|
||||
else
|
||||
new_preview_text = " "
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
new_preview_text = ""
|
||||
end
|
||||
end
|
||||
else
|
||||
-- Format as single number:
|
||||
-- Spaces around number necessary to distinguish Min/Max text from Exact text, same as above ^
|
||||
if e.config.id == "fn_pre_l" then
|
||||
if true then
|
||||
-- Spaces around number necessary to distinguish Min/Max text from Exact text,
|
||||
-- which is itself necessary to force a HUD update when switching between Min/Max and Exact.
|
||||
new_preview_text = " " .. FN.PRE.format_number(FN.PRE.data.score.min) .. " "
|
||||
if FN.PRE.is_enough_to_win(FN.PRE.data.score.min) then should_juice = true end
|
||||
else
|
||||
new_preview_text = number_format(FN.PRE.data.score.exact)
|
||||
if FN.PRE.is_enough_to_win(FN.PRE.data.score.exact) then should_juice = true end
|
||||
if true then new_preview_text = " ?????? "
|
||||
else new_preview_text = "??????"
|
||||
end
|
||||
else
|
||||
new_preview_text = ""
|
||||
end
|
||||
end
|
||||
else
|
||||
-- Spaces around number necessary to distinguish Min/Max text from Exact text, same as above ^
|
||||
if e.config.id == "fn_pre_l" then
|
||||
if true then new_preview_text = " ?????? "
|
||||
else new_preview_text = "??????"
|
||||
end
|
||||
else
|
||||
new_preview_text = ""
|
||||
end
|
||||
end
|
||||
|
||||
if (not FN.PRE.text.score[e.config.id:sub(-1)]) or new_preview_text ~= FN.PRE.text.score[e.config.id:sub(-1)] then
|
||||
|
||||
Reference in New Issue
Block a user