From 5c8452b2268b9efb358d3c949a21ad06b4bca19a Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sat, 20 Apr 2019 18:03:34 +0200 Subject: [PATCH] example/mainmenu: add confirm and cancel sfx --- examples/mainmenu/init.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/mainmenu/init.lua b/examples/mainmenu/init.lua index 0080f0b..19df920 100644 --- a/examples/mainmenu/init.lua +++ b/examples/mainmenu/init.lua @@ -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