-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOptionsPane.lua
More file actions
64 lines (54 loc) · 2.59 KB
/
Copy pathOptionsPane.lua
File metadata and controls
64 lines (54 loc) · 2.59 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
-- Assuming YippYappGuildTools saved variables and default settings are already defined
local defaults = {
showMinimapButton = true,
}
-- SavedVariables default setup
YippYappGuildTools_OptionsDB = YippYappGuildTools_OptionsDB or defaults
local panel = CreateFrame("Frame", "YippYappGuildToolsOptionsPanel", InterfaceOptionsFramePanelContainer)
panel.name = "YippYappGuildTools"
-- Add the panel to the Interface Options
InterfaceOptions_AddCategory(panel)
-- Title for the Options Panel
panel.title = panel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
panel.title:SetPoint("TOPLEFT", 16, -16)
local playerName = UnitName("player") -- Retrieves the player's name
panel.title:SetText(string.format("You Have No Power Here, %s", playerName))
-- Checkbox Setup
panel.showMinimapButtonCheckbox = CreateFrame("CheckButton", "$parentShowMinimapButton", panel, "InterfaceOptionsCheckButtonTemplate")
panel.showMinimapButtonCheckbox:SetPoint("TOPLEFT", panel.title, "BOTTOMLEFT", 0, -20)
_G[panel.showMinimapButtonCheckbox:GetName() .. "Text"]:SetText("Ok, daddy")
panel.showMinimapButtonCheckbox:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
GameTooltip:SetText("Accept your inferiority", nil, nil, nil, nil, true)
end)
panel.showMinimapButtonCheckbox:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
panel.showMinimapButtonCheckbox:SetScript("OnClick", function(self)
local tick = self:GetChecked()
--PlaySound(tick and "igMainMenuOptionCheckBoxOn" or "igMainMenuOptionCheckBoxOff")
YippYappGuildTools_OptionsDB.showMinimapButton = tick
-- Implement the logic to show/hide the minimap button based on the 'tick' value
end)
-- Okay, Cancel, Default logic
panel.okay = function(self) end -- Logic to run on okay
panel.cancel = function(self) end -- Logic to run on cancel
panel.default = function(self) -- Logic to reset defaults
YippYappGuildTools_OptionsDB = CopyTable(defaults)
-- Update the checkbox state to reflect the default setting
panel.showMinimapButtonCheckbox:SetChecked(defaults.showMinimapButton)
end
-- Initialize panel settings from saved variables
local function InitOptions()
panel.showMinimapButtonCheckbox:SetChecked(YippYappGuildTools_OptionsDB.showMinimapButton)
end
-- Register the initialization function to run when the player is logging in
panel:RegisterEvent("PLAYER_LOGIN")
panel:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_LOGIN" then
if not YippYappGuildTools_OptionsDB then
YippYappGuildTools_OptionsDB = CopyTable(defaults)
end
InitOptions()
end
end)