241 lines
6.9 KiB
Lua
241 lines
6.9 KiB
Lua
local ElvSkins
|
|
if ElvUI then
|
|
local E = unpack(ElvUI)
|
|
ElvSkins = E:GetModule("Skins")
|
|
end
|
|
|
|
local panel = CreateFrame("Frame")
|
|
panel.name = "HideCoAUI"
|
|
|
|
local title = panel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
|
title:SetPoint("TOPLEFT", 16, -16)
|
|
title:SetText("HideCoAUI")
|
|
|
|
local subtitle = panel:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
|
|
subtitle:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 0, -8)
|
|
subtitle:SetText("Select a class, then toggle the checkboxes to hide its class resource:")
|
|
|
|
local sidebar = CreateFrame("Frame", nil, panel)
|
|
sidebar:SetPoint("TOPLEFT", subtitle, "BOTTOMLEFT", 0, -12)
|
|
sidebar:SetPoint("BOTTOMLEFT", panel, "BOTTOMLEFT", 16, 16)
|
|
sidebar:SetWidth(150)
|
|
|
|
local content = CreateFrame("Frame", nil, panel)
|
|
content:SetPoint("TOPLEFT", sidebar, "TOPRIGHT", 16, 0)
|
|
content:SetPoint("BOTTOMRIGHT", panel, "BOTTOMRIGHT", -16, 16)
|
|
|
|
local classContent = CreateFrame("Frame", nil, content)
|
|
classContent:SetAllPoints(content)
|
|
|
|
local profileContent
|
|
|
|
local classTitle = classContent:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
|
classTitle:SetPoint("TOPLEFT", classContent, "TOPLEFT", 0, 0)
|
|
|
|
local titleFont, titleSize = classTitle:GetFont()
|
|
classTitle:SetFont(titleFont, titleSize + 4, "OUTLINE")
|
|
|
|
local checks = {}
|
|
local selectedClass = nil
|
|
|
|
local previousAnchor = classTitle
|
|
local previousSpacing = -12
|
|
|
|
for _, frameName in ipairs(HideCoA.FRAMES) do
|
|
|
|
local check = CreateFrame("CheckButton", "HideCoAClassCheck" .. frameName, classContent, "InterfaceOptionsCheckButtonTemplate")
|
|
check:SetPoint("TOPLEFT", previousAnchor, "BOTTOMLEFT", 0, previousSpacing)
|
|
_G[check:GetName() .. "Text"]:SetText("Hide " .. frameName)
|
|
|
|
check.frameName = frameName
|
|
|
|
if ElvSkins then
|
|
ElvSkins:HandleCheckBox(check)
|
|
end
|
|
|
|
check:SetScript("OnClick", function(self)
|
|
|
|
if not selectedClass then
|
|
return
|
|
end
|
|
|
|
HideCoADB.classSettings[selectedClass][self.frameName] = self:GetChecked() and true or false
|
|
HideCoA.ApplySetting()
|
|
|
|
end)
|
|
|
|
checks[frameName] = check
|
|
previousAnchor = check
|
|
previousSpacing = -8
|
|
|
|
end
|
|
|
|
local TAB_HEIGHT = 18
|
|
|
|
local tabButtons = {}
|
|
local profileTabButton
|
|
|
|
local function SelectClass(class)
|
|
|
|
selectedClass = class
|
|
|
|
classContent:Show()
|
|
profileContent:Hide()
|
|
profileTabButton.selectedTexture:Hide()
|
|
|
|
local displayName = (LOCALIZED_CLASS_NAMES_MALE and LOCALIZED_CLASS_NAMES_MALE[class]) or class
|
|
classTitle:SetText(displayName)
|
|
|
|
local color = RAID_CLASS_COLORS and RAID_CLASS_COLORS[class]
|
|
if color then
|
|
classTitle:SetTextColor(color.r, color.g, color.b)
|
|
else
|
|
classTitle:SetTextColor(1, 1, 1)
|
|
end
|
|
|
|
for _, frameName in ipairs(HideCoA.FRAMES) do
|
|
checks[frameName]:SetChecked(HideCoADB.classSettings[class][frameName])
|
|
end
|
|
|
|
for tabClass, button in pairs(tabButtons) do
|
|
if tabClass == class then
|
|
button.selectedTexture:Show()
|
|
else
|
|
button.selectedTexture:Hide()
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
for index, class in ipairs(HideCoA.CUSTOM_CLASSES) do
|
|
|
|
local button = CreateFrame("Button", "HideCoAClassTab" .. class, sidebar)
|
|
button:SetHeight(TAB_HEIGHT)
|
|
button:SetPoint("TOPLEFT", sidebar, "TOPLEFT", 0, -(index - 1) * TAB_HEIGHT)
|
|
button:SetPoint("RIGHT", sidebar, "RIGHT", 0, 0)
|
|
|
|
local selectedTexture = button:CreateTexture(nil, "BACKGROUND")
|
|
selectedTexture:SetAllPoints()
|
|
selectedTexture:SetTexture(1, 1, 1, 0.2)
|
|
selectedTexture:Hide()
|
|
button.selectedTexture = selectedTexture
|
|
|
|
button:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight", "ADD")
|
|
|
|
local displayName = (LOCALIZED_CLASS_NAMES_MALE and LOCALIZED_CLASS_NAMES_MALE[class]) or class
|
|
local text = button:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
text:SetPoint("LEFT", 4, 0)
|
|
text:SetText(displayName)
|
|
|
|
local color = RAID_CLASS_COLORS and RAID_CLASS_COLORS[class]
|
|
if color then
|
|
text:SetTextColor(color.r, color.g, color.b)
|
|
end
|
|
|
|
button:SetScript("OnClick", function()
|
|
SelectClass(class)
|
|
end)
|
|
|
|
tabButtons[class] = button
|
|
|
|
end
|
|
|
|
profileContent = CreateFrame("Frame", nil, content)
|
|
profileContent:SetAllPoints(content)
|
|
profileContent:Hide()
|
|
|
|
local profileTitle = profileContent:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
|
profileTitle:SetPoint("TOPLEFT", profileContent, "TOPLEFT", 0, 0)
|
|
profileTitle:SetFont(titleFont, titleSize + 4, "OUTLINE")
|
|
profileTitle:SetText("Profile")
|
|
|
|
local function GetProfileNames()
|
|
|
|
local names = {}
|
|
|
|
for name in pairs(HideCoADB.profiles) do
|
|
if name ~= "Default" then
|
|
table.insert(names, name)
|
|
end
|
|
end
|
|
|
|
table.sort(names)
|
|
table.insert(names, 1, "Default")
|
|
|
|
return names
|
|
|
|
end
|
|
|
|
local profileDropDown = CreateFrame("Frame", "HideCoAProfileDropDown", profileContent, "UIDropDownMenuTemplate")
|
|
profileDropDown:SetPoint("TOPLEFT", profileTitle, "BOTTOMLEFT", -16, -12)
|
|
|
|
local function ProfileDropDown_OnClick(self)
|
|
HideCoADB.selectedProfile = self.value
|
|
UIDropDownMenu_SetText(profileDropDown, self.value)
|
|
end
|
|
|
|
UIDropDownMenu_Initialize(profileDropDown, function(self, level)
|
|
|
|
for _, name in ipairs(GetProfileNames()) do
|
|
|
|
local info = UIDropDownMenu_CreateInfo()
|
|
info.text = name
|
|
info.value = name
|
|
info.func = ProfileDropDown_OnClick
|
|
info.checked = (HideCoADB.selectedProfile == name)
|
|
|
|
UIDropDownMenu_AddButton(info, level)
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
UIDropDownMenu_SetWidth(profileDropDown, 140)
|
|
|
|
local divider = sidebar:CreateTexture(nil, "ARTWORK")
|
|
divider:SetHeight(1)
|
|
divider:SetTexture(1, 1, 1, 0.3)
|
|
|
|
profileTabButton = CreateFrame("Button", "HideCoAProfileTab", sidebar)
|
|
profileTabButton:SetHeight(TAB_HEIGHT)
|
|
profileTabButton:SetPoint("BOTTOMLEFT", sidebar, "BOTTOMLEFT", 0, 0)
|
|
profileTabButton:SetPoint("RIGHT", sidebar, "RIGHT", 0, 0)
|
|
|
|
divider:SetPoint("BOTTOMLEFT", profileTabButton, "TOPLEFT", 0, 4)
|
|
divider:SetPoint("BOTTOMRIGHT", profileTabButton, "TOPRIGHT", 0, 4)
|
|
|
|
local profileSelectedTexture = profileTabButton:CreateTexture(nil, "BACKGROUND")
|
|
profileSelectedTexture:SetAllPoints()
|
|
profileSelectedTexture:SetTexture(1, 1, 1, 0.2)
|
|
profileSelectedTexture:Hide()
|
|
profileTabButton.selectedTexture = profileSelectedTexture
|
|
|
|
profileTabButton:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight", "ADD")
|
|
|
|
local profileTabText = profileTabButton:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
profileTabText:SetPoint("LEFT", 4, 0)
|
|
profileTabText:SetText("Profile")
|
|
|
|
local function SelectProfileTab()
|
|
|
|
classContent:Hide()
|
|
profileContent:Show()
|
|
|
|
for _, button in pairs(tabButtons) do
|
|
button.selectedTexture:Hide()
|
|
end
|
|
|
|
profileTabButton.selectedTexture:Show()
|
|
|
|
UIDropDownMenu_SetText(profileDropDown, HideCoADB.selectedProfile or "Default")
|
|
|
|
end
|
|
|
|
profileTabButton:SetScript("OnClick", SelectProfileTab)
|
|
|
|
panel:SetScript("OnShow", function()
|
|
SelectClass(selectedClass or HideCoA.CUSTOM_CLASSES[1])
|
|
end)
|
|
|
|
InterfaceOptions_AddCategory(panel)
|