forked from neurotech/PetPet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PetPet_Config.lua
74 lines (59 loc) · 2.26 KB
/
PetPet_Config.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
69
70
71
72
73
74
local function CreateSpriteScene(parent)
local rumiAikawa, _ = Elements.Textures.SpawnAnimatedTexture(
"PETPET_RUMI_AIKAWA",
parent,
[[Interface\Addons\PetPet\Textures\configframe_rumi-aikawa]],
1024,
64,
64,
64,
16
)
local pig, _ = Elements.Textures.SpawnAnimatedTexture(
"PETPET_PIG",
parent,
[[Interface\Addons\PetPet\Textures\configframe_pig]],
512,
32,
32,
32,
12
)
rumiAikawa:SetPoint("BOTTOMRIGHT", 0, 0)
pig:SetPoint("BOTTOMRIGHT", -65, 14)
end
local function CreateAndAddFormElements(parent)
local petpetHeading, petpetHeadingText = Elements.Text.CreateText(PetPet.FontPath, "PETPET_CONFIG_HEADING", parent
, parent, "TOPLEFT",
PetPet.FrostyText("PetPet"))
local versionText = Elements.Text.CreateText(PetPet.FontPath, "PETPET_CONFIG_GENERAL_OPTIONS_HEADING", parent
, parent, "TOPLEFT", PetPet.GetVersionText(), 9, -Elements.Units.Padding, -4, "TOPRIGHT")
local separator = Elements.Text.CreateSeparator("PETPET_CONFIG_HEADING_SEPARATOR", parent, petpetHeading, "BOTTOMLEFT")
local generalOptionsHeading = Elements.Text.CreateText(PetPet.FontPath, "PETPET_CONFIG_GENERAL_OPTIONS_HEADING", parent
, separator, "BOTTOMLEFT", Elements.Palette.Hex.RICH_YELLOW .. "General Options" .. Elements.Palette.RESET, 12)
local togglePetPetCheckbox = Elements.Checkboxes.Create("Enable PetPet", parent, generalOptionsHeading, "BOTTOMLEFT")
return togglePetPetCheckbox
end
PetPet.Config.CreateConfigFrame = function()
local configFrame =
CreateFrame(
"Frame",
PetPet.Config.FrameName,
InterfaceOptionsFramePanelContainer,
BackdropTemplateMixin and "BackdropTemplate"
)
configFrame:SetSize(InterfaceOptionsFramePanelContainer:GetWidth(), InterfaceOptionsFramePanelContainer:GetHeight())
configFrame.name = "PetPet"
CreateSpriteScene(configFrame)
local togglePetPetCheckbox = CreateAndAddFormElements(configFrame)
PetPet.CompanionList.Create(configFrame, togglePetPetCheckbox)
InterfaceOptions_AddCategory(configFrame)
configFrame:Hide()
function configFrame.refresh()
togglePetPetCheckbox:SetChecked(PetPetDB["PETPET_ACIVE"])
end
function configFrame.okay()
PetPetDB["PETPET_ACIVE"] = togglePetPetCheckbox:GetChecked()
end
return configFrame
end