-- NOTE: This handler object is auto-generated. Feel free to modify the contents of this file.
--
-- IMPORTANT: This script resource must be attached to a script component named WidgetHandler to work
--            with the Button widget's base script.
-- 

-- Audio functions
local function play_switch_credits()
    if stingray.Wwise then
        stingray.Wwise.load_bank("content/audio/default")
        local wwise_world = stingray.Wwise.wwise_world(SimpleProject.world)
        stingray.WwiseWorld.trigger_event(wwise_world, "sfx_UI_music_switch_credits")
    end
end

local thisActor = ...;

-- The handler object expected by the base widget script
-- If any of the handler methods are not defined, then the base widget will not attempt to invoke them.
local handler = {
    
	clicked = function()
	    -- We can pre-load the loading screen
        local credits = scaleform.Actor.load("credits.s2dscene")
	    -- Remove the main menu scene
        -- Add the loading scene
        scaleform.Stage.add_scene(credits)
        -- Audio to play during credits
        play_switch_credits()
	end
}

return handler;