Minor optimization and clean up for scenario name splash

This commit is contained in:
Pokachi 2023-01-01 14:10:50 -08:00
parent c90a9e753a
commit f3ab872688
3 changed files with 11 additions and 12 deletions

View File

@ -34,6 +34,7 @@ local chaosTokens = {}
local chaosTokensLastMat = nil local chaosTokensLastMat = nil
local IS_RESHUFFLING = false local IS_RESHUFFLING = false
local bagSearchers = {} local bagSearchers = {}
local hideTitleSplashWaitFunctionId = nil
local playmatAPI = require("playermat/PlaymatApi") local playmatAPI = require("playermat/PlaymatApi")
--------------------------------------------------------- ---------------------------------------------------------
@ -959,24 +960,23 @@ function onClick_defaultSettings()
end end
-- splash scenario title on setup -- splash scenario title on setup
titleSplashId = nil function titleSplash(scenarioName)
function titleSplash(params) if optionPanel['showTitleSplash'] then
if self.UI.getAttribute('showTitleSplash', "isOn") == "True" then
-- if there's any ongoing title being displayed, hide it and cancel the waiting function -- if there's any ongoing title being displayed, hide it and cancel the waiting function
if titleSplashId then if hideTitleSplashWaitFunctionId then
Wait.stop(titleSplashId) Wait.stop(hideTitleSplashWaitFunctionId)
titleSplashId = nil hideTitleSplashWaitFunctionId = nil
UI.setAttribute('title_splash', 'active', false) UI.setAttribute('title_splash', 'active', false)
end end
-- display scenario name and set a 4 seconds (2 seconds animation and 2 seconds on screen) -- display scenario name and set a 4 seconds (2 seconds animation and 2 seconds on screen)
-- wait timer to hide the scenario name -- wait timer to hide the scenario name
UI.setValue('title_splash', params.scenarioName) UI.setValue('title_splash', scenarioName)
UI.show('title_splash') UI.show('title_splash')
titleSplashId = Wait.time(function() hideTitleSplashWaitFunctionId = Wait.time(function()
UI.hide('title_splash') UI.hide('title_splash')
titleSplashId = nil hideTitleSplashWaitFunctionId = nil
end, 4) end, 4)
end end
end end

View File

@ -55,7 +55,7 @@ function resetTokensIfInDeckZone(container, object)
end end
function fireScenarioChangedEvent() function fireScenarioChangedEvent()
Global.call('titleSplash', {scenarioName = currentScenario}) Global.call('titleSplash', currentScenario)
playArea.onScenarioChanged(currentScenario) playArea.onScenarioChanged(currentScenario)
end end

View File

@ -106,7 +106,6 @@
<!-- Title Splash when starting a scenario --> <!-- Title Splash when starting a scenario -->
<Text id="title_splash" <Text id="title_splash"
position="0 0 0"
fontSize="150" fontSize="150"
font="font_teutonic-arkham" font="font_teutonic-arkham"
outline="black" outline="black"