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

View File

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

View File

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