From d8bdb9fdf87459f902c420d06fd38b093958116f Mon Sep 17 00:00:00 2001 From: Pokachi Date: Sun, 1 Jan 2023 01:38:06 -0800 Subject: [PATCH 1/5] 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. + + + + + + + From 7a071d30f49b2bd5a61fe88610b82cd351c5c5ef Mon Sep 17 00:00:00 2001 From: Pokachi Date: Sun, 1 Jan 2023 01:57:41 -0800 Subject: [PATCH 2/5] Moved title splash call from PlayArea to MythosArea. updated comment for options --- src/core/Global.ttslua | 2 +- src/core/MythosArea.ttslua | 1 + src/core/PlayArea.ttslua | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index e2db6ef9..585ac13a 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -818,7 +818,7 @@ function applyOptionPanelChange(id, state) -- update master clue counter getObjectFromGUID("4a3aa4").setVar("useClickableCounters", state) - -- option: Clickable clue counters + -- option: Show Title on placing scenarios elseif id == "showTitleSplash" then optionPanel[id] = state diff --git a/src/core/MythosArea.ttslua b/src/core/MythosArea.ttslua index 84f962ab..8320bee3 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', {scenarioName = currentScenario}) playArea.onScenarioChanged(currentScenario) end diff --git a/src/core/PlayArea.ttslua b/src/core/PlayArea.ttslua index 9ef407b9..dde1cfe0 100644 --- a/src/core/PlayArea.ttslua +++ b/src/core/PlayArea.ttslua @@ -130,5 +130,4 @@ end function onScenarioChanged(scenarioName) currentScenario = scenarioName - Global.call('titleSplash', {scenarioName = scenarioName}) end From de75ed4fc7d68c3e37683efd1458ed3971956bab Mon Sep 17 00:00:00 2001 From: Pokachi Date: Sun, 1 Jan 2023 02:03:14 -0800 Subject: [PATCH 3/5] Wrap title splash text just in case title is too long --- xml/Global.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xml/Global.xml b/xml/Global.xml index 96c066f3..0c86332e 100644 --- a/xml/Global.xml +++ b/xml/Global.xml @@ -114,7 +114,8 @@ showAnimation='FadeIn' hideAnimation='FadeOut' active='false' - animationDuration='2'> + animationDuration='2' + horizontalOverflow="Wrap"> From 9b139a4c824ddc01e8960b7e7192a4d8d158df4e Mon Sep 17 00:00:00 2001 From: Pokachi Date: Sun, 1 Jan 2023 02:04:33 -0800 Subject: [PATCH 4/5] Fixing some styling consistency --- xml/Global.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xml/Global.xml b/xml/Global.xml index 0c86332e..e11d79a5 100644 --- a/xml/Global.xml +++ b/xml/Global.xml @@ -105,16 +105,16 @@ - From f3ab872688f1ece157efbc5f7ba97b275e5bee99 Mon Sep 17 00:00:00 2001 From: Pokachi Date: Sun, 1 Jan 2023 14:10:50 -0800 Subject: [PATCH 5/5] Minor optimization and clean up for scenario name splash --- src/core/Global.ttslua | 20 ++++++++++---------- src/core/MythosArea.ttslua | 2 +- xml/Global.xml | 1 - 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index 585ac13a..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") --------------------------------------------------------- @@ -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 \ No newline at end of file +end diff --git a/src/core/MythosArea.ttslua b/src/core/MythosArea.ttslua index 8320bee3..94933d64 100644 --- a/src/core/MythosArea.ttslua +++ b/src/core/MythosArea.ttslua @@ -55,7 +55,7 @@ function resetTokensIfInDeckZone(container, object) end function fireScenarioChangedEvent() - Global.call('titleSplash', {scenarioName = currentScenario}) + Global.call('titleSplash', currentScenario) playArea.onScenarioChanged(currentScenario) end diff --git a/xml/Global.xml b/xml/Global.xml index e11d79a5..dc15bced 100644 --- a/xml/Global.xml +++ b/xml/Global.xml @@ -106,7 +106,6 @@