examples/options: add sfx
This commit is contained in:
parent
5c8452b226
commit
e0e7eaae10
2 changed files with 16 additions and 0 deletions
|
@ -31,6 +31,11 @@ function OptionsMenu:new()
|
|||
OptionsMenu.super.new(self)
|
||||
self.assets:addImageFont("medium", "examples/mainmenu/assets/medium")
|
||||
self.assets:setMusic("examples/menus/options/assets/music.ogg")
|
||||
|
||||
self.assets:addSFX("navigate", "examples/mainmenu/assets/menu_move.mp3")
|
||||
self.assets:addSFX("confirm", "examples/mainmenu/assets/menu_confirm.mp3")
|
||||
self.assets:addSFX("cancel", "examples/mainmenu/assets/menu_error.mp3")
|
||||
|
||||
self.assets:playMusic()
|
||||
|
||||
self:addMenu("main", true)
|
||||
|
@ -54,6 +59,8 @@ function OptionsMenu:new()
|
|||
Widgets.Exit(self, "main")
|
||||
self.menusystem:switchMenu("main")
|
||||
|
||||
self.menusystem:setSoundFromSceneAssets("navigate")
|
||||
|
||||
self.keyDetector = {}
|
||||
self.keyDetector.widget = nil
|
||||
end
|
||||
|
|
|
@ -68,6 +68,7 @@ function widgets.SubMenu:new(scene, menu, newmenu, fullname, order, label2)
|
|||
end
|
||||
|
||||
function widgets.SubMenu:action()
|
||||
self.scene.assets:playSFX("confirm")
|
||||
self.scene.menusystem:switchMenu(self.newmenu)
|
||||
end
|
||||
|
||||
|
@ -95,6 +96,7 @@ function widgets.Exit:new(scene, menu)
|
|||
end
|
||||
|
||||
function widgets.Exit:action()
|
||||
self.scene.assets:playSFX("confirm")
|
||||
core.scenemanager:setStoredScene("mainmenu")
|
||||
end
|
||||
|
||||
|
@ -150,6 +152,7 @@ end
|
|||
|
||||
function widgets.Switch:action()
|
||||
self:modifyKey()
|
||||
self.scene.assets:playSFX("confirm")
|
||||
self.label2 = self:getLabel()
|
||||
core.options:write()
|
||||
self:invalidateCanvas()
|
||||
|
@ -178,6 +181,7 @@ function widgets.Resolution:action()
|
|||
end
|
||||
self.label2 = self:getLabel()
|
||||
core.screen:applySettings()
|
||||
self.scene.assets:playSFX("confirm")
|
||||
self:invalidateCanvas()
|
||||
core.options:write()
|
||||
end
|
||||
|
@ -195,6 +199,7 @@ function widgets.Lang:new(scene, menu, lang)
|
|||
end
|
||||
|
||||
function widgets.Lang:action()
|
||||
self.scene.assets:playSFX("confirm")
|
||||
core.options:setLanguage(self.lang)
|
||||
--self.scene.menusystem:invalidateAllWidgets()
|
||||
end
|
||||
|
@ -214,6 +219,7 @@ function widgets.PlayerSubMenu:new(scene, menu, sourceid)
|
|||
end
|
||||
|
||||
function widgets.PlayerSubMenu:action()
|
||||
self.scene.assets:playSFX("confirm")
|
||||
self.scene.menusystem:switchMenu(self.newmenu)
|
||||
end
|
||||
|
||||
|
@ -240,11 +246,13 @@ function widgets.Key:getLabel()
|
|||
end
|
||||
|
||||
function widgets.Key:action()
|
||||
self.scene.assets:playSFX("navigate")
|
||||
self.scene:changeKey(self)
|
||||
self.scene.menusystem:deactivate()
|
||||
end
|
||||
|
||||
function widgets.Key:receiveKey( key )
|
||||
self.scene.assets:playSFX("confirm")
|
||||
core.options:setInputKey(self.source, self.key, key)
|
||||
self.label2 = self:getLabel()
|
||||
self:invalidateCanvas()
|
||||
|
@ -305,6 +313,7 @@ end
|
|||
function widgets.Audio:action()
|
||||
local value = self:getVolume()
|
||||
self:setVolume(value - 20)
|
||||
self.scene.assets:playSFX("confirm")
|
||||
self.scene.assets.music:setVolume(core.options.data.audio.music / 100)
|
||||
core.options:write()
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue