diff --git a/objects/LuaScriptState.luascriptstate b/objects/LuaScriptState.luascriptstate index 277d64b4..080f8272 100644 --- a/objects/LuaScriptState.luascriptstate +++ b/objects/LuaScriptState.luascriptstate @@ -1 +1 @@ -{"optionPanel":{"showChaosBagManager":false,"showCleanUpHelper":false,"showDrawButton":false,"showHandHelper":[],"showNavigationOverlay":false,"showTokenArranger":false,"useClueClickers":false,"useSnapTags":true}} +{"optionPanel":{"showChaosBagManager":false,"showCleanUpHelper":false,"showDrawButton":false,"showHandHelper":[],"showNavigationOverlay":false,"showTokenArranger":false,"useClueClickers":false,"useSnapTags":true,"showTitleSplash":true}} diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index 01c0729a..c6e3321c 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -34,6 +34,7 @@ local chaosTokens = {} local chaosTokensLastMat = nil local IS_RESHUFFLING = false local bagSearchers = {} +local hideTitleSplashWaitFunctionId = nil local playmatAPI = require("playermat/PlaymatApi") --------------------------------------------------------- @@ -818,6 +819,10 @@ function applyOptionPanelChange(id, state) -- update master clue counter getObjectFromGUID("4a3aa4").setVar("useClickableCounters", state) + -- option: Show Title on placing scenarios + elseif id == "showTitleSplash" then + optionPanel[id] = state + -- option: Show token arranger elseif id == "showTokenArranger" then -- delete previously pulled out tokens @@ -931,7 +936,7 @@ function onClick_defaultSettings() for id, _ in pairs(optionPanel) do local state = false -- override for settings that are enabled by default - if id == "useSnapTags" then + if id == "useSnapTags" or id == "showTitleSplash" then state = true end applyOptionPanelChange(id, state) @@ -942,6 +947,7 @@ function onClick_defaultSettings() useSnapTags = true, showDrawButton = false, useClueClickers = false, + showTitleSplash = true, showTokenArranger = false, showCleanUpHelper = false, showHandHelper = {}, @@ -952,3 +958,25 @@ function onClick_defaultSettings() -- update UI updateOptionPanelState() end + +-- splash scenario title on setup +function titleSplash(scenarioName) + if optionPanel['showTitleSplash'] then + + -- if there's any ongoing title being displayed, hide it and cancel the waiting function + 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', scenarioName) + UI.show('title_splash') + hideTitleSplashWaitFunctionId = Wait.time(function() + UI.hide('title_splash') + hideTitleSplashWaitFunctionId = nil + end, 4) + end +end diff --git a/src/core/MythosArea.ttslua b/src/core/MythosArea.ttslua index 84f962ab..94933d64 100644 --- a/src/core/MythosArea.ttslua +++ b/src/core/MythosArea.ttslua @@ -55,6 +55,7 @@ function resetTokensIfInDeckZone(container, object) end function fireScenarioChangedEvent() + Global.call('titleSplash', currentScenario) playArea.onScenarioChanged(currentScenario) end diff --git a/xml/Global.xml b/xml/Global.xml index 6ba20511..dc15bced 100644 --- a/xml/Global.xml +++ b/xml/Global.xml @@ -104,4 +104,17 @@ + + + + diff --git a/xml/OptionPanel.xml b/xml/OptionPanel.xml index afb322b1..c63c85d9 100644 --- a/xml/OptionPanel.xml +++ b/xml/OptionPanel.xml @@ -142,6 +142,20 @@ + + + + + Show Scenario Title on Setup + Fade in the name of the scenario for 2 seconds when placing down a scenario. + + + + + + +