-
Notifications
You must be signed in to change notification settings - Fork 0
/
shared.lua
68 lines (55 loc) · 1.94 KB
/
shared.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
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
layout_name, layout = ...
-- event dispatcher
do
local event_frame = CreateFrame'Frame'
local registry = {}
local RegisterEvent = event_frame.RegisterEvent
function event_frame:RegisterEvent(event, func)
if registry[event] then
registry[event][func] = true
else
registry[event] = { [func] = true }
RegisterEvent(event_frame, event)
end
end
local UnregisterEvent = event_frame.UnregisterEvent
function event_frame:UnregisterEvent(event, func)
if registry[event] and func then
registry[event][func] = nil
if not next(registry[event]) then
registry[event] = nil
UnregisterEvent(event_frame, event)
end
end
end
function event_frame:IsEventRegistered(event, func)
return registry[event] and registry[event][func]
end
event_frame:SetScript('OnEvent', function(self, event, ...)
if registry[event] then
for func in next, registry[event] do
func(self, event, ...)
end
end
end)
layout.event_frame = event_frame
end
-- saved variables
local function get_saved_variables()
layout.event_frame:UnregisterEvent('ADDON_LOADED', get_saved_variables)
layout.saved_variables = _G[layout_name .. '_saved_variables'] or {}
_G[layout_name .. '_saved_variables'] = layout.saved_variables
end
layout.event_frame:RegisterEvent('ADDON_LOADED', get_saved_variables)
-- media and settings
layout.solid = "Interface\\Buttons\\WHITE8X8"
layout.texture = "Interface\\AddOns\\" .. layout_name .. "\\media\\lyn"
layout.backdrop = { bgFile = layout.solid, edgeFile = layout.solid, edgeSize = 1 }
layout.font1 = "Interface\\AddOns\\" .. layout_name .. "\\media\\charriot_deluxe.ttf"
layout.font1_size = 10
layout.font1_flags = "OUTLINEMONOCHROME"
layout.font2 = "Interface\\AddOns\\" .. layout_name .. "\\media\\tama_mini01.ttf"
layout.font2_size = 20
layout.font2_flags = "OUTLINEMONOCHROME"
oUF.colors.disconnected = { 0.59, 0.04, 0.04 }
layout.heal_threshold = 10000