-
Notifications
You must be signed in to change notification settings - Fork 2
/
04_01 menu.lua
30 lines (23 loc) · 886 Bytes
/
04_01 menu.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Menu = { }
function Menu:OnActivate()
Debug.Log("Hello from Main Menu Lua Loader!")
self.canvasEntityId = UiCanvasManagerBus.Broadcast.LoadCanvas("UI/Canvases/UiMainMenuLuaSample/MainMenu.uicanvas")
LyShineLua.ShowMouseCursor(true)
local canvasId = UiCanvasAssetRefBus.Event.LoadCanvas(self.entityId)
self.canvasNotificationHandler = UiCanvasNotificationBus.Connect(self, self.canvasEntityId)
end
function Menu:OnAction(entityID, actionName)
Debug.Log("OnAction Called")
if (actionName == "PlayGame") then
UiCanvasManagerBus.Broadcast.UnloadCanvas(self.canvasEntityId)
LyShineLua.ShowMouseCursor(false)
elseif (actionName == "ShowOptions") then
-- we will add this later
elseif (actionName == "Quit") then
ConsoleRequestBus.Broadcast.ExecuteConsoleCommand("Quit")
end
end
function Menu:OnDeactivate()
self.canvasNotificationHandler:Disconnect()
end
return Menu