forked from ZProject-Official/zUI-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.lua
More file actions
91 lines (81 loc) · 2.28 KB
/
common.lua
File metadata and controls
91 lines (81 loc) · 2.28 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
zUI = {}
exports("getObject", function()
return zUI
end)
Citizen.CreateThread(function()
repeat
Wait(100)
until NetworkIsPlayerActive(PlayerId())
local positions = json.decode(GetResourceKvpString("zUI:positions:MyPersonalPositions"))
if not positions then
positions = {
["menu"] = { x = 25, y = 25 },
["info"] = { x = 750, y = 25 }
}
end
TriggerNuiEvent("app:setPositions", positions)
end)
RegisterNuiCallback("app:savePositions", function(data, cb)
if data and data.positions and type(data.positions) == "table" then
-- Thanks to @Kamionn pr
local success, positions = pcall(json.encode, data.positions)
if success and positions then
SetResourceKvp("zUI:positions:MyPersonalPositions", positions)
end
end
cb("ok :)")
end)
RegisterNuiCallback("app:manageEditMod", function(body, cb)
if body.state then
SetNuiFocus(true, true)
SetNuiFocusKeepInput(false)
else
SetNuiFocus(true, false)
SetNuiFocusKeepInput(true)
end
cb("ok :)")
end)
---@class ThemeAnimations
---@field entry string
---@field exit string
---@field onSwitch? boolean
---@field onScroll? boolean
---@class ThemeColors
---@field primary string
---@field background string
---@field description? string
---@field informations? string
---@field controlsIndicator? string
---@field itemSelected? string
---@field banner? string
---@class ThemeMenu
---@field width string
---@field displayBanner boolean
---@field displayInformations boolean
---@field displayControlsIndicator boolean
---@field cornersRadius number
---@field perspective boolean
---@field margin boolean
---@field shadow boolean
---@field hoverStyle string
---@field animations ThemeAnimations
---@field colors ThemeColors
---@field keyPressDelay number
---@field sound boolean
---@field font string
---@field maxVisibleItems number
---@class ThemeInfo
---@field width string
---@field cornerRadius number
---@field perspective boolean
---@field shadow boolean
---@field animations ThemeAnimations
---@field colors ThemeColors
---@field font string
---@class ThemeEditMod
---@field menu boolean
---@field info boolean
---@class Theme
---@field menu ThemeMenu
---@field info ThemeInfo
---@field editMod ThemeEditMod