forked from BlueMountainsIO/OnsetLuaScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgui.lua
More file actions
46 lines (38 loc) · 1.41 KB
/
gui.lua
File metadata and controls
46 lines (38 loc) · 1.41 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--[[
Copyright (C) 2019 Blue Mountains GmbH
This program is free software: you can redistribute it and/or modify it under the terms of the Onset
Open Source License as published by Blue Mountains GmbH.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the Onset Open Source License for more details.
You should have received a copy of the Onset Open Source License along with this program. If not,
see https://bluemountains.io/Onset_OpenSourceSoftware_License.txt
]]--
WebGuiId = 0
function OnPackageStart()
WebGuiId = CreateWebUI(0.0, 0.0, 0.0, 0.0, 4, 32)
LoadWebFile(WebGuiId, "http://asset/"..GetPackageName().."/gui/gui.html")
SetWebAlignment(WebGuiId, 0.0, 0.0)
SetWebAnchors(WebGuiId, 0.0, 0.0, 1.0, 1.0)
SetWebVisibility(WebGuiId, WEB_HITINVISIBLE)
end
AddEvent("OnPackageStart", OnPackageStart)
function OnPackageStop()
DestroyWebUI(WebGuiId)
end
AddEvent("OnPackageStop", OnPackageStop)
function OnWebLoadComplete(webid)
if WebGuiId == webid then
CallEvent("OnClientWebGuiLoaded")
CallRemoteEvent("OnClientWebGuiLoaded")
end
end
AddEvent("OnWebLoadComplete", OnWebLoadComplete)
function SetVisibility(visible)
if visible then
SetWebVisibility(WebGuiId, WEB_HITINVISIBLE)
else
SetWebVisibility(WebGuiId, WEB_HIDDEN)
end
end
AddFunctionExport("SetVisibility", SetVisibility)