added a scenario name splash on placing down scenarios as well as a setting in the settings panel to toggle splashing scenario

This commit is contained in:
Pokachi 2023-01-01 01:38:06 -08:00
parent 195580c9f0
commit d8bdb9fdf8
5 changed files with 58 additions and 2 deletions

View File

@ -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}}

View File

@ -818,6 +818,10 @@ function applyOptionPanelChange(id, state)
-- update master clue counter -- update master clue counter
getObjectFromGUID("4a3aa4").setVar("useClickableCounters", state) getObjectFromGUID("4a3aa4").setVar("useClickableCounters", state)
-- option: Clickable clue counters
elseif id == "showTitleSplash" then
optionPanel[id] = state
-- option: Show token arranger -- option: Show token arranger
elseif id == "showTokenArranger" then elseif id == "showTokenArranger" then
-- delete previously pulled out tokens -- delete previously pulled out tokens
@ -931,7 +935,7 @@ function onClick_defaultSettings()
for id, _ in pairs(optionPanel) do for id, _ in pairs(optionPanel) do
local state = false local state = false
-- override for settings that are enabled by default -- override for settings that are enabled by default
if id == "useSnapTags" then if id == "useSnapTags" or id == "showTitleSplash" then
state = true state = true
end end
applyOptionPanelChange(id, state) applyOptionPanelChange(id, state)
@ -942,6 +946,7 @@ function onClick_defaultSettings()
useSnapTags = true, useSnapTags = true,
showDrawButton = false, showDrawButton = false,
useClueClickers = false, useClueClickers = false,
showTitleSplash = true,
showTokenArranger = false, showTokenArranger = false,
showCleanUpHelper = false, showCleanUpHelper = false,
showHandHelper = {}, showHandHelper = {},
@ -952,3 +957,26 @@ function onClick_defaultSettings()
-- update UI -- update UI
updateOptionPanelState() updateOptionPanelState()
end 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

View File

@ -130,4 +130,5 @@ end
function onScenarioChanged(scenarioName) function onScenarioChanged(scenarioName)
currentScenario = scenarioName currentScenario = scenarioName
Global.call('titleSplash', {scenarioName = scenarioName})
end end

View File

@ -104,4 +104,17 @@
</Panel> </Panel>
</VerticalLayout> </VerticalLayout>
<!-- Title Splash when starting a scenario -->
<Text id='title_splash'
position='0 0 0'
fontSize="150"
font="font_teutonic-arkham"
outline="black"
outlineSize="3 -3"
showAnimation='FadeIn'
hideAnimation='FadeOut'
active='false'
animationDuration='2'>
</Text>
<Include src="OptionPanel.xml"/> <Include src="OptionPanel.xml"/>

View File

@ -142,6 +142,20 @@
</Cell> </Cell>
</Row> </Row>
<!-- Option: splash scenario name on setup -->
<Row class="option-text">
<Cell class="option-text">
<VerticalLayout class="text-column">
<Text class="option-header">Show Scenario Title on Setup</Text>
<Text class="description">Fade in the name of the scenario for 2 seconds when placing down a scenario.</Text>
</VerticalLayout>
</Cell>
<Cell class="option-button">
<Toggle id="showTitleSplash"
onValueChanged="onClick_toggleOption(showTitleSplash)"/>
</Cell>
</Row>
<!-- Group: fan-made accessories --> <!-- Group: fan-made accessories -->
<Row class="group-header"> <Row class="group-header">
<Cell class="group-header"> <Cell class="group-header">