From d8bdb9fdf87459f902c420d06fd38b093958116f Mon Sep 17 00:00:00 2001 From: Pokachi Date: Sun, 1 Jan 2023 01:38:06 -0800 Subject: [PATCH] added a scenario name splash on placing down scenarios as well as a setting in the settings panel to toggle splashing scenario --- objects/LuaScriptState.luascriptstate | 2 +- src/core/Global.ttslua | 30 ++++++++++++++++++++++++++- src/core/PlayArea.ttslua | 1 + xml/Global.xml | 13 ++++++++++++ xml/OptionPanel.xml | 14 +++++++++++++ 5 files changed, 58 insertions(+), 2 deletions(-) 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..e2db6ef9 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -818,6 +818,10 @@ function applyOptionPanelChange(id, state) -- update master clue counter getObjectFromGUID("4a3aa4").setVar("useClickableCounters", state) + -- option: Clickable clue counters + elseif id == "showTitleSplash" then + optionPanel[id] = state + -- option: Show token arranger elseif id == "showTokenArranger" then -- delete previously pulled out tokens @@ -931,7 +935,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 +946,7 @@ function onClick_defaultSettings() useSnapTags = true, showDrawButton = false, useClueClickers = false, + showTitleSplash = true, showTokenArranger = false, showCleanUpHelper = false, showHandHelper = {}, @@ -952,3 +957,26 @@ function onClick_defaultSettings() -- update UI updateOptionPanelState() end + +-- splash scenario title on setup +titleSplashId = nil +function titleSplash(params) + if self.UI.getAttribute('showTitleSplash', "isOn") == "True" then + + -- if there's any ongoing title being displayed, hide it and cancel the waiting function + if titleSplashId then + Wait.stop(titleSplashId) + titleSplashId = 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.show('title_splash') + titleSplashId = Wait.time(function() + UI.hide('title_splash') + titleSplashId = nil + end, 4) + end +end \ No newline at end of file diff --git a/src/core/PlayArea.ttslua b/src/core/PlayArea.ttslua index dde1cfe0..9ef407b9 100644 --- a/src/core/PlayArea.ttslua +++ b/src/core/PlayArea.ttslua @@ -130,4 +130,5 @@ end function onScenarioChanged(scenarioName) currentScenario = scenarioName + Global.call('titleSplash', {scenarioName = scenarioName}) end diff --git a/xml/Global.xml b/xml/Global.xml index 6ba20511..96c066f3 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. + + + + + + +