From f6c628a6d96519e58ac1a5b832db8a0f511e036c Mon Sep 17 00:00:00 2001 From: d87 Date: Wed, 9 Sep 2020 17:14:05 +0700 Subject: [PATCH] Added additional debuff styles --- .luacheckrc | 1 + Options/WidgetForms.lua | 1 + border_3px.tga | Bin 0 -> 2092 bytes corner3.tga | Bin 0 -> 4140 bytes frame.lua | 39 ++++++++++++++++++++++++++++++--------- 5 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 border_3px.tga create mode 100644 corner3.tga diff --git a/.luacheckrc b/.luacheckrc index 95925bd..8393f61 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -124,6 +124,7 @@ globals = { "Clique", "InitiateRolePoll", + "Mixin", "C_IncomingSummon", "C_VoiceChat", "C_Map", diff --git a/Options/WidgetForms.lua b/Options/WidgetForms.lua index f994ea0..9c01fab 100644 --- a/Options/WidgetForms.lua +++ b/Options/WidgetForms.lua @@ -239,6 +239,7 @@ ns.WidgetForms.DebuffIcon = {} local borderStyles = { STRIP_RIGHT = "Right Strip", STRIP_BOTTOM = "Bottom Strip", + CORNER = "Corner", BORDER = "Border", } function ns.WidgetForms.DebuffIcon.Create(form) diff --git a/border_3px.tga b/border_3px.tga new file mode 100644 index 0000000000000000000000000000000000000000..bab9e27748d773a5da4fc59cb48f7d061620ffab GIT binary patch literal 2092 zcmZQzU}As)2L=uX1r8wZKL~(mm<$m#vL0kM5n91Yko6$5$G6y+sO!(n9~}s>g^iA;uX0VUv&?(`#=XtM)>Q$Cj)anbJ)Z zLZq2D?|n)Lm@$`$bC_ju-om3x75p3VVW9X z*zfmxQ$k0Rr7Hu5FboMvYN;-0p$-_LC{i0Es|z_xEx-`RF*0o~TM9As07H@_b8|$+ zkYQ>AhBQqPiBMt+K=c7amSr%&a6U7A@$nEm?Je-3`lRR3@{W$alNQ! zhczbX07F@p%4G2@LGYzWB||^NtEy5m49_nVQ=%3y91aI11JRQzmkh)I;&?pH7^sF8 zdcbfxodAP{pUnthIG@jw!N$yTM#*65WjiJrdILWE7Pdw!<|Kpby8n?spi71o_gFhB h7}ol%nI9N#>-G(>kGIdwm-p_yzC3(CdC!|i_6x0+<>~+c literal 0 HcmV?d00001 diff --git a/frame.lua b/frame.lua index 28a8283..e76a048 100644 --- a/frame.lua +++ b/frame.lua @@ -1137,8 +1137,9 @@ local helpful_color = { r = 0, g = 1, b = 0} local function DebuffIcon_SetDebuffColor(self, r,g,b) self.debuffTypeTexture:SetVertexColor(r, g, b) - if self.outline then - self.outline:SetVertexColor(r,g,b) + + if self.border then + self:SetBackdropBorderColor(r,g,b) end end @@ -1170,6 +1171,10 @@ local function DebuffIcon_SetJob(self, debuffType, expirationTime, duration, ico end end +local debuff_border_backdrop = { + edgeFile = "Interface\\AddOns\\Aptechka\\border_3px", edgeSize = 8, tileEdge = false, +} + local function DebuffIcon_SetDebuffStyle(self, opts) local it = self.texture local dtt = self.debuffTypeTexture @@ -1182,6 +1187,7 @@ local function DebuffIcon_SetDebuffStyle(self, opts) it:ClearAllPoints() dtt:ClearAllPoints() + self.border = nil if style == "STRIP_RIGHT" then local dttLen = w*0.22 @@ -1194,21 +1200,34 @@ local function DebuffIcon_SetDebuffStyle(self, opts) dtt:SetTexCoord(0,1,0,1) dtt:SetDrawLayer("ARTWORK", -2) text:SetPoint("BOTTOMRIGHT", it,"BOTTOMRIGHT", 2,-1) + if self.SetBackdrop then self:SetBackdrop(nil) end + dtt:Show() elseif style == "CORNER" then - self:SetSize(w+p*2,h+p*2) - if not self.outline then - self.outline = self:AddOutline() - end - self.outline:Show() + self:SetSize(w,h) it:SetSize(w,h) - it:SetPoint("TOPLEFT", self, "TOPLEFT", p, -p) + it:SetPoint("TOPLEFT", self, "TOPLEFT", 0,0) local minLen = math.min(w,h) - dtt:SetTexture[[Interface\AddOns\Aptechka\corner]] + dtt:SetTexture[[Interface\AddOns\Aptechka\corner3]] dtt:SetTexCoord(0,1,0,1) dtt:SetSize(minLen*0.7, minLen*0.7) dtt:SetDrawLayer("ARTWORK", 3) dtt:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0,0) + if self.SetBackdrop then self:SetBackdrop(nil) end -- this resets backdrop color, so can't call it always + dtt:Show() + elseif style == "BORDER" then + self:SetSize(w,h) + if not self.SetBackdrop then + -- if BackdropTemplateMixin then + Mixin( self, BackdropTemplateMixin) + -- end + end + self.border = true + self:SetBackdrop(debuff_border_backdrop) + self:SetBackdropBorderColor(1,0,0) + it:SetSize(w-6*p,h-6*p) + it:SetPoint("TOPLEFT", self, "TOPLEFT", p*3, -p*3) + dtt:Hide() elseif style == "STRIP_BOTTOM" then local dttLen = h*0.25 self:SetSize(w,h + dttLen) @@ -1220,6 +1239,8 @@ local function DebuffIcon_SetDebuffStyle(self, opts) it:SetSize(w,h) it:SetPoint("BOTTOMLEFT", dtt, "TOPLEFT", 0, 0) text:SetPoint("BOTTOMRIGHT", it,"BOTTOMRIGHT", 3,1) + if self.SetBackdrop then self:SetBackdrop(nil) end + dtt:Show() end end