Skip to content

Instantly share code, notes, and snippets.

@Wetxius
Created May 17, 2020 14:58
Show Gist options
  • Save Wetxius/30361a1fb46c8299f492d8ed6e3eed69 to your computer and use it in GitHub Desktop.
Save Wetxius/30361a1fb46c8299f492d8ed6e3eed69 to your computer and use it in GitHub Desktop.
ShestakUI\Modules\Skins\Numeration.lua
local T, C, L, _ = unpack(select(2, ...))
if C.skins.numeration ~= true or not IsAddOnLoaded("Numeration") then return end
----------------------------------------------------------------------------------------
-- Numeration skin
----------------------------------------------------------------------------------------
Numeration["windows"].width = 217
Numeration["windows"].maxlines = 7
Numeration["windows"].linegap = 7
NumerationFrame.maxlines = Numeration["windows"].maxlines
NumerationFrame:SetWidth(Numeration["windows"].width)
NumerationFrame:SetHeight(3 + Numeration["windows"].titleheight + Numeration["windows"].maxlines * (Numeration["windows"].lineheight + Numeration["windows"].linegap) - Numeration["windows"].linegap)
NumerationFrame:CreateBackdrop("Defalt")
NumerationFrame.backdrop:SetPoint("TOPLEFT", -1, 1)
NumerationFrame.backdrop:SetPoint("BOTTOMRIGHT", NumerationFrame.reset, 2, -2)
NumerationFrame:SetBackdropColor(0, 0, 0, 0)
local title = NumerationFrame.titletext
title:SetFont(C.font.stylization_font, C.font.stylization_font_size, C.font.stylization_font_style)
title:SetShadowOffset(C.font.stylization_font_shadow and 1 or 0, C.font.stylization_font_shadow and -1 or 0)
local reset = NumerationFrame.reset
reset.text:SetFont(C.font.stylization_font, C.font.stylization_font_size, C.font.stylization_font_style)
reset.text:SetShadowOffset(C.font.stylization_font_shadow and 1 or 0, C.font.stylization_font_shadow and -1 or 0)
reset.text:SetPoint("CENTER", 2, 0)
reset:SetBackdropColor(0, 0, 0, 0)
reset:SetScript("OnLeave", function() reset:SetBackdropColor(0, 0, 0, 0) end)
local segment = NumerationFrame.segment
segment.text:SetFont(C.font.stylization_font, C.font.stylization_font_size, C.font.stylization_font_style)
segment.text:SetShadowOffset(C.font.stylization_font_shadow and 1 or 0, C.font.stylization_font_shadow and -1 or 0)
segment.text:SetPoint("CENTER", 1, 0)
segment:SetBackdropColor(0, 0, 0, 0)
segment:SetScript("OnLeave", function() segment:SetBackdropColor(0, 0, 0, 0) GameTooltip:Hide() end)
hooksecurefunc(NumerationFrame, "GetLine", function(self, id)
local lines = Numeration.lines
local f = lines[id]
if not f.backdrop then
f:CreateBackdrop("Default")
hooksecurefunc(f, "SetIcon", function(f, icon)
if icon then
f.backdrop:SetPoint("TOPLEFT", -f:GetHeight() - 2, 2)
f.backdrop:SetPoint("BOTTOMRIGHT", 2, -2)
else
f.backdrop:SetPoint("TOPLEFT", -2, 2)
f.backdrop:SetPoint("BOTTOMRIGHT", 2, -2)
end
end)
end
if id == 0 then
f:SetPoint("TOPRIGHT", self.reset, "BOTTOMRIGHT", 0, -7)
else
f:SetPoint("TOPRIGHT", lines[id-1], "BOTTOMRIGHT", 0, -7)
end
if not f.bg then
f.bg = f:CreateTexture(nil, "BORDER")
f.bg:SetAllPoints(f)
f.bg:SetTexture(C.media.texture)
f.bg:SetVertexColor(.6, .6, .6, 0.25)
end
f.value:SetFont(C.font.stylization_font, C.font.stylization_font_size, C.font.stylization_font_style)
f.value:SetShadowOffset(C.font.stylization_font_shadow and 1 or 0, C.font.stylization_font_shadow and -1 or 0)
f.value:SetPoint("RIGHT", 0, 0)
f.name:SetFont(C.font.stylization_font, C.font.stylization_font_size, C.font.stylization_font_style)
f.name:SetShadowOffset(C.font.stylization_font_shadow and 1 or 0, C.font.stylization_font_shadow and -1 or 0)
f.name:SetPoint("LEFT", f.icon, "RIGHT", 3, 0)
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment