From f8e7cf06d66a240259ca8998cc6668e547a3c03e Mon Sep 17 00:00:00 2001 From: Parnic Date: Sun, 15 Jan 2023 12:43:56 -0600 Subject: [PATCH] Combine rune texture/color set into one method This enables a simpler method of making sure the appropriate texture is set and using the appropriate color (for after a rune was modified to darkened/hidden). --- modules/ClassPowerCounter.lua | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/modules/ClassPowerCounter.lua b/modules/ClassPowerCounter.lua index a78cf7c..c9d5e29 100644 --- a/modules/ClassPowerCounter.lua +++ b/modules/ClassPowerCounter.lua @@ -542,7 +542,7 @@ function IceClassPowerCounter.prototype:UpdateRunePower(event, arg1, arg2) for i=1, self.numRunes do if i <= self.round(percentReady) then if self:GetRuneMode() == "Graphical" then - self.frame.graphical[i].rune:SetVertexColor(1, 1, 1) + self:SetRuneGraphicalTexture(i) else self:SetCustomColor(i) end @@ -826,12 +826,7 @@ function IceClassPowerCounter.prototype:SetupRuneTexture(rune) end if self:GetRuneMode() == "Graphical" then - local tex = self:GetRuneTexture(rune) - if tex then - self.frame.graphical[rune].rune:SetTexture(tex) - else - self.frame.graphical[rune].rune:SetAtlas(self:GetRuneAtlas(rune), self:UseAtlasSize(rune)) - end + self:SetRuneGraphicalTexture(rune) elseif self:GetRuneMode() == "Graphical Bar" then self.frame.graphical[rune].rune:SetTexture(IceElement.TexturePath .. "Combo") elseif self:GetRuneMode() == "Graphical Circle" then @@ -843,6 +838,17 @@ function IceClassPowerCounter.prototype:SetupRuneTexture(rune) end end +function IceClassPowerCounter.prototype:SetRuneGraphicalTexture(rune) + self.frame.graphical[rune].rune:SetVertexColor(1, 1, 1) + + local tex = self:GetRuneTexture(rune) + if tex then + self.frame.graphical[rune].rune:SetTexture(tex) + else + self.frame.graphical[rune].rune:SetAtlas(self:GetRuneAtlas(rune), self:UseAtlasSize(rune)) + end +end + function IceClassPowerCounter.prototype:GetAlphaAdd() return 0.15 end