forked from kratob/GuiBarHero3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Core.lua
59 lines (49 loc) · 1.08 KB
/
Core.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
local OPTIONS = {
type = 'group',
args = {
show = {
type = 'execute',
name = 'show',
desc = 'Show GuiBars.',
func = function()
GuiBarHero:Show()
end
},
hide = {
type = 'execute',
name = 'hide',
desc = 'Hide GuiBars.',
func = function()
GuiBarHero:Hide()
end
}
},
}
GuiBarHero = LibStub("AceAddon-3.0"):NewAddon("GuiBarHero3", "AceConsole-3.0", "AceEvent-3.0")
LibStub("AceConfig-3.0"):RegisterOptionsTable("GuiBarHero3", OPTIONS, {"guibarhero", "gbh"})
function GuiBarHero:OnInitialize()
self.settings = self.Settings:Create()
end
function GuiBarHero:OnEnable()
self.main_frame = self.MainFrame:Create()
self.main_frame:RefreshBars()
if self.settings:GetShown() then
self:Show()
else
self:Hide()
end
self:RegisterEvent("SPELLS_CHANGED", "OnSpellsChanged")
end
function GuiBarHero:OnDisable()
end
function GuiBarHero:OnSpellsChanged()
self.main_frame:RefreshBars()
end
function GuiBarHero:Show()
self.settings:SetShown(true)
self.main_frame:Show()
end
function GuiBarHero:Hide()
self.settings:SetShown(false)
self.main_frame:Hide()
end