example/mainmenu: add confirm and cancel sfx
This commit is contained in:
parent
fe740edc13
commit
5c8452b226
1 changed files with 6 additions and 1 deletions
|
@ -35,7 +35,9 @@ function MainMenu:new()
|
|||
MainMenu.super.new(self)
|
||||
self.assets:addImageFont("medium", "examples/mainmenu/assets/medium")
|
||||
|
||||
self.assets:addSFX("navigate", "examples/mainmenu/assets/menu_move.mp3")
|
||||
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:addMenu("main", true)
|
||||
self:addSubMenu("basic", "basic")
|
||||
|
@ -93,14 +95,17 @@ function SubMenuWidget:new(scene, menu, newmenu, fullname, order)
|
|||
local label = ""
|
||||
if fullname == "back" then
|
||||
label = core.lang:translate("commons", fullname)
|
||||
self.sfx = "cancel"
|
||||
else
|
||||
label = core.lang:translate("mainmenu", fullname)
|
||||
self.sfx = "confirm"
|
||||
end
|
||||
SubMenuWidget.super.new(self, widgetmenu, font, label)
|
||||
self.order = order or 0
|
||||
end
|
||||
|
||||
function SubMenuWidget:action()
|
||||
self.scene.assets:playSFX(self.sfx)
|
||||
self.scene.menusystem:switchMenu(self.newmenu)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue