adding option to disable sounds

This commit is contained in:
Chr1Z93 2023-04-04 13:00:40 +02:00
parent 108bdfc281
commit cdbec62924
3 changed files with 26 additions and 1 deletions

View File

@ -843,6 +843,10 @@ function applyOptionPanelChange(id, state)
elseif id == "showTitleSplash" then elseif id == "showTitleSplash" then
optionPanel[id] = state optionPanel[id] = state
-- option: Disable sound effects
elseif id == "disableSoundEffects" then
optionPanel[id] = state
-- option: Show token arranger -- option: Show token arranger
elseif id == "showTokenArranger" then elseif id == "showTokenArranger" then
optionPanel[id] = spawnOrRemoveHelper(state, "Token Arranger", {-42.3, 1.6, -46.5}) optionPanel[id] = spawnOrRemoveHelper(state, "Token Arranger", {-42.3, 1.6, -46.5})
@ -981,6 +985,7 @@ function onClick_defaultSettings()
-- clean reset of variable -- clean reset of variable
optionPanel = { optionPanel = {
disableSoundEffects = false,
playAreaSnapTags = true, playAreaSnapTags = true,
showAttachmentHelper = false, showAttachmentHelper = false,
showCleanUpHelper = false, showCleanUpHelper = false,

View File

@ -7,10 +7,16 @@ do
["Deep Bell"] = 1 ["Deep Bell"] = 1
} }
function playTriggerEffect(index)
if Global.getTable("optionPanel").disableSoundEffects ~= true then
getObjectsWithTag("SoundCube")[1].AssetBundle.playTriggerEffect(index)
end
end
-- plays the by name requested sound -- plays the by name requested sound
---@param soundName String Name of the sound to play ---@param soundName String Name of the sound to play
SoundCubeApi.playSoundByName = function(soundName) SoundCubeApi.playSoundByName = function(soundName)
getObjectsWithTag("SoundCube")[1].AssetBundle.playTriggerEffect(soundIndices[soundName]) playTriggerEffect(soundIndices[soundName])
end end
return SoundCubeApi return SoundCubeApi

View File

@ -129,6 +129,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">Disable sound effects</Text>
<Text class="description">This disables additional soundeffects, e.g. on scenario placement.</Text>
</VerticalLayout>
</Cell>
<Cell class="option-button">
<Toggle id="disableSoundEffects"
onValueChanged="onClick_toggleOption(disableSoundEffects)"/>
</Cell>
</Row>
<!-- Group: playermat settings --> <!-- Group: playermat settings -->
<Row class="group-header"> <Row class="group-header">
<Cell class="group-header"> <Cell class="group-header">