From b252b3220213179c2019e31828de9b947ff09f82 Mon Sep 17 00:00:00 2001 From: d87 Date: Thu, 12 Nov 2020 22:32:14 +0700 Subject: [PATCH] Switched BarIcon to MaskStatusBar, BarIconArray --- config.lua | 6 ++-- frame.lua | 100 ++++++++++++++++++++++++++++------------------------- spark.tga | Bin 4140 -> 2092 bytes tmask.tga | Bin 0 -> 16428 bytes 4 files changed, 55 insertions(+), 51 deletions(-) create mode 100644 tmask.tga diff --git a/config.lua b/config.lua index d073294..e65ad39 100644 --- a/config.lua +++ b/config.lua @@ -83,12 +83,12 @@ config.DefaultWidgets = { raidbuff = { type = "IndicatorArray", width = 5, height = 5, point = "TOPLEFT", x = 0, y = 0, growth = "DOWN", max = 5 }, mitigation = { type = "Bar", width=22, height=4, point="BOTTOMLEFT", x=4, y=-5, vertical = false}, -- icon = { type = "Icon", width = 24, height = 24, point = "CENTER", x = 0, y = 0, alpha = 1, font = config.defaultFont, textsize = 12, outline = true, edge = true }, - icon = { type = "BarIcon", width = 24, height = 24, point = "CENTER", x = 0, y = 0, alpha = 1, font = config.defaultFont, textsize = 12, outline = true, edge = true }, + icon = { type = "BarIcon", width = 24, height = 24, point = "CENTER", x = 0, y = 0, alpha = 1, font = config.defaultFont, textsize = 12, outline = true, edge = true, vertical = true }, spell1 = { type = "Indicator", width = 9, height = 8, point = "BOTTOMRIGHT", x = 0, y = 0, }, -- spell2 = { type = "Indicator", width = 9, height = 8, point = "TOP", x = 0, y = 0, }, spell3 = { type = "Indicator", width = 9, height = 8, point = "TOPRIGHT", x = 0, y = 0, }, bar4 = { type = "Bar", width=21, height=5, point="TOPRIGHT", x=0, y=2, vertical = false}, - buffIcons = { type = "IconArray", width = 12, height = 18, point = "TOPRIGHT", x = 5, y = -6, alpha = 1, growth = "LEFT", max = 3, edge = true, outline = true, font = config.defaultFont, textsize = 12 }, + buffIcons = { type = "BarIconArray", width = 12, height = 18, point = "TOPRIGHT", x = 5, y = -6, alpha = 1, growth = "LEFT", max = 3, edge = true, outline = true, vertical = true, font = config.defaultFont, textsize = 12 }, bars = { type = "BarArray", width = 21, height = 5, point = "BOTTOMRIGHT", x = 0, y = 0, vertical = false, growth = "UP", max = 7 }, vbar1 = { type = "Bar", width=4, height=20, point="TOPRIGHT", x=-9, y=2, vertical = true}, text1 = { type = "StaticText", point="CENTER", x=0, y=0, font = config.defaultFont, textsize = 12, effect = "SHADOW" }, @@ -116,7 +116,7 @@ local RangeCheckBySpell = helpers.RangeCheckBySpell config.templates = { - TankCD = { assignto = set("icon"), infoType = "DURATION", priority = 94, color = { 1, 0.2, 1} }, + TankCD = { assignto = set("icon"), infoType = "DURATION", priority = 94, color = { 1, 0.2, 1}, refreshTime = 2 }, SurvivalCD = { assignto = set("buffIcons"), infoType = "DURATION", priority = 90, color = { 0.4, 1, 0.4} }, ActiveMitigation = { assignto = set("mitigation"), infoType = "DURATION", color = {0.7, 0.7, 0.7}, priority = 80 }, HealTrace = { assignto = set("healfeedback"), color = { 1, 0.7, 0.35}, fade = 0.7, priority = 96 }, diff --git a/frame.lua b/frame.lua index e9996da..f4596c1 100644 --- a/frame.lua +++ b/frame.lua @@ -539,6 +539,7 @@ local function AddPulseAnimation(f) pa1:SetToAlpha(0) pa1:SetDuration(0.15) pa1:SetOrder(1) + pag.a1 = pa1 local pa2 = pag:CreateAnimation("Alpha") pa2:SetFromAlpha(0) pa2:SetToAlpha(1) @@ -1667,31 +1668,35 @@ end -- Bar Icon ---------------------------------------------------------- +local min = math.min local function BarIcon_OnUpdate(self) - local startTime = self.startTime - local endTime = self.endTime - local duration = endTime - startTime - - local timeLeft = endTime - GetTime() + local timeLeft = self.endTime - GetTime() - -- if self.pandemic and timeLeft < self.pandemic then - -- local color = self._color - -- self:SetStatusBarColor(color[1]*0.75, color[2]*0.75, color[3]*0.75) - -- self.pandemic = nil - -- end + local pandemic = self.pandemic + if pandemic and timeLeft < pandemic then + if not self.pulse:IsPlaying() then + self.pulse.maxpulses = 999999 + self.pulse:Play() + end + self.pandemic = nil + end if self.isReversed then - timeLeft = startTime + timeLeft + timeLeft = self.startTime + timeLeft end -- self.spark:UpdatePos(timeLeft/duration) - self.spark:Hide() + local a = min(timeLeft, 2) + self.spark:SetAlpha(a/2) self:SetValue(timeLeft) end local function BarIcon_SetJob(self, job, state, contentType, ...) local timerType, cur, max, count, icon, text, r,g,b, texture, texCoords, isReversed = NormalizeContent(job, state, contentType, ...) - + if self.currentJob ~= self.previousJob then + self:SetScript("OnUpdate", nil) + self.pulse:Stop() + end if count and count > 1 then self.stacktext:SetText(count) @@ -1711,13 +1716,11 @@ local function BarIcon_SetJob(self, job, state, contentType, ...) local pandemic = job.refreshTime self.pandemic = pandemic self:SetMinMaxValues(0, duration) - -- self:SetValue(timeLeft) BarIcon_OnUpdate(self, 0) self:SetScript("OnUpdate", BarIcon_OnUpdate) elseif max and cur then self:SetMinMaxValues(0, max) self:SetValue(cur) - self.spark:UpdatePos(cur/max) self:SetScript("OnUpdate", nil) self.stacktext:SetText() else @@ -1727,41 +1730,21 @@ local function BarIcon_SetJob(self, job, state, contentType, ...) end end -local function BarIcon_SetCooldown(self, startTime, duration) - self:SetMinMaxValues(0, duration) - self.expirationTime = startTime+duration - self.startTime = startTime - self.duration = duration - self:SetValue(GetTime()) - self:Show() -end - - -local function BarIcon_Spark_UpdatePosHorizontal(spark, progress) - local bar = spark:GetParent() - local frameLength = bar:GetWidth() - local p = frameLength * progress - spark:SetPoint("CENTER", bar, "LEFT", p, 0) -end -local function BarIcon_Spark_UpdatePosVertical(spark, progress) - local bar = spark:GetParent() - local frameLength = bar:GetWidth() - local p = frameLength * progress - spark:SetPoint("CENTER", bar, "BOTTOM", 0, p) -end local function BarIcon_Spark_SetOrientation(spark, orientation) spark:ClearAllPoints(); if orientation == "VERTICAL" then - local width = spark:GetParent():GetWidth() - spark.UpdatePos = BarIcon_Spark_UpdatePosVertical + local bar = spark:GetParent() + local width = bar:GetWidth() + spark:SetPoint("CENTER", bar._mask, "BOTTOM", 0, 0) spark:SetWidth(width) - spark:SetHeight(width*2) + spark:SetHeight(width) spark:SetTexCoord(1,1,0,1,1,0,0,0) else - local height = spark:GetParent():GetHeight() - spark.UpdatePos = BarIcon_Spark_UpdatePosHorizontal + local bar = spark:GetParent() + local height = bar:GetHeight() + spark:SetPoint("CENTER", bar._mask, "LEFT", 0, 0) spark:SetTexCoord(0,1,0,1) - spark:SetWidth(height*2) + spark:SetWidth(height) spark:SetHeight(height) end end @@ -1779,8 +1762,9 @@ function Aptechka.Widget.BarIcon.Create(parent, popts, gopts) local w = pixelperfect(opts.width) local h = pixelperfect(opts.height) + local orientation = opts.vertical and "VERTICAL" or "HORIZONTAL" -- local bar = CreateFrame("StatusBar", nil, parent) - local bar = Aptechka.CreateCustomStatusBar(nil, parent, "HORIZONTAL") + local bar = Aptechka.CreateMaskStatusBar(nil, parent, orientation) bar:SetFrameLevel(FRAMELEVEL.ICON) -- local fg = bar:CreateTexture(nil,"ARTWORK", nil, 2) @@ -1795,7 +1779,7 @@ function Aptechka.Widget.BarIcon.Create(parent, popts, gopts) bg:SetAllPoints(bar) bar.bg = bg - bar:SetAlpha(opts.alpha) + bar:SetAlpha(opts.alpha or 1) SetIconTexCoord(bar.bg, w, h) @@ -1807,15 +1791,24 @@ function Aptechka.Widget.BarIcon.Create(parent, popts, gopts) -- bar:SetScript("OnUpdate", BarIcon_OnUpdate) - local spark = bar:CreateTexture(nil, "ARTWORK") + local spark = bar:CreateTexture(nil, "ARTWORK", nil, 5) -- spark:SetAtlas("honorsystem-bar-spark") -- spark:SetSize(height/4, height*1.6) spark:SetTexture("Interface/AddOns/Aptechka/spark") spark:SetBlendMode("ADD") + spark:SetVertexColor(1,0.7,0) spark.SetOrientation = BarIcon_Spark_SetOrientation - spark:SetOrientation("HORIZONTAL") + spark:SetOrientation(orientation) bar.spark = spark + AddPulseAnimation(bar) + bar.pulse.a1:SetDuration(0.3) + bar.pulse.a1:SetToAlpha(0.55) + bar.pulse.a2:SetDuration(0.3) + bar.pulse.a2:SetFromAlpha(0.55) + bar.pulse.maxpulses = 9999 + + return WrapFrameAsWidget(bar) end @@ -1825,7 +1818,7 @@ function Aptechka.Widget.BarIcon.Reconf(parent, f, popts, gopts) local h = pixelperfect(opts.height) UpdateFramePoints(f, parent, opts, w, h) - f:SetAlpha(opts.alpha) + f:SetAlpha(opts.alpha or 1) SetIconTexCoord(f.bg, w, h) SetIconTexCoord(f.fg, w, h) UpdateFontStringSettings(f.stacktext, opts.font, opts.textsize, opts.effect) @@ -1835,6 +1828,17 @@ function Aptechka.Widget.BarIcon.Reconf(parent, f, popts, gopts) f.bar.spark:SetOrientation( opts.vertical and "VERTICAL" or "HORIZONTAL") end +---------------------------------------------------------- + +Aptechka.Widget.BarIconArray = {} +Aptechka.Widget.BarIconArray.default = { type = "BarIconArray", width = 15, height = 15, point = "TOPRIGHT", x = 0, y = 0, alpha = 1, font = config.defaultFont, textsize = 10, outline = true, edge = true, vertical = true, growth = "LEFT", max = 3 } +function Aptechka.Widget.BarIconArray.Create(parent, popts, gopts) + local opts = InheritGlobalOptions(popts, gopts) + return CreateArrayHeader("BarIcon", parent, opts.point, opts.x, opts.y, opts, opts.growth, opts.max) +end + +Aptechka.Widget.BarIconArray.Reconf = Aptechka.Widget.BarArray.Reconf + ---------------------------------------------------------- -- Progress Icon ---------------------------------------------------------- diff --git a/spark.tga b/spark.tga index bd28cb6c747f6343e932ff10da32e89ca6b55c04..a6267cb6fd606b4f933c46175def3e6d9395f6cf 100644 GIT binary patch literal 2092 zcma)7%Su~O6ul-UxryeXMoi38llY`j5g$!_O;QMy2Gce~Bl-bO96Rs_1ph$%0Q~@Q zDvm7Fk>JRIV8MZdfFO#lp0(|@Ax$m~+(FLW>+HSOUVC3nvuMW8r^U6nuKrck13oP+ zEwETDu-onMdcD}#*g$V@FWhdooLQ|_iD4X{KiGfp4u=CB9Ua)(+CpDnA3PopcxJQN zenVA`Mc6K(@pq9UZCr|QCBoa70JjDF`Ji5BNqy}Br!TK8U=h+)~U9=k-8p84M zF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+ESAm|2VeR##W$ z+u66f{Ev^1E1&%TN&J2Gz5Lp&rf|QI+b?ypOgOne(f=E78e&~#pyTy9UL5JT~L42DZLW!g!vYK*v2>i@jK^Yjq-Wd zb90CK*SXhUbUk)hCdPx_@B1IV<)3p}{ri0O_3QsJJ~hzlWuR_TEdb!|y+qd%S1-aNgP5*xVoD+Z^Hy_^{K(k{A$M>Z{`B(Co~NeE9I; z?){It=X`jNm@#*F-gMu`hHsah3vc**azHHE6Cd!sYiMvtCMPC!?tcFKS-%5OA6ECQ zN4wAWJ!jfYzs*29180rJ;?f)sJU}mkZ}X_Ay{IA^8yoWe{d=9ork$B>GtWHFem>tc z`+R;jKKI}Z!F!;^Ab1~0Yn)527GJ)6DcjrIT90VQ_pI?_57#c+Kg@6NzW>@9`2HE# zlbXU?`u)?r=grN{>31+{@;=`g*Y51?v%~uR&v?f8adLqdYiA%2=!ILYR@D=Jzqh;_ im%Him86MwRAQJg^XK!tPeRq9(Yx?lb`af$kk^cYy$Mcr} diff --git a/tmask.tga b/tmask.tga new file mode 100644 index 0000000000000000000000000000000000000000..2f2d65447ed0b94d3b12bf89aec1979f70410d4c GIT binary patch literal 16428 zcmeIuu?c`c5Jb_%$TDm|Yq;cu1yRsb?7tGDtHI<=@|pBS4AEDj#5DG&1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ c009C72oNAZfWZF(?Y!%gS04NPuDR7EJ_-^AmH+?% literal 0 HcmV?d00001