diff --git a/rSkin/init.lua b/rSkin/init.lua index 2364b59..c5c9eff 100644 --- a/rSkin/init.lua +++ b/rSkin/init.lua @@ -48,8 +48,8 @@ end L.StripTextures = StripTextures --CreateBackdrop -local function CreateBackdrop(self, relativeTo) - local backdrop = oUF_SimpleConfig.backdrop +local function CreateBackdrop(self, relativeTo, anotherBackdrop) + local backdrop = anotherBackdrop or oUF_SimpleConfig.backdrop local parent = self.IsObjectType and self:IsObjectType('Texture') and self:GetParent() or self local bd = CreateFrame("Frame", nil, parent, BackdropTemplateMixin and "BackdropTemplate") if (parent:GetFrameLevel() - 1) >= 0 then diff --git a/rSkin/modules/DBM.lua b/rSkin/modules/DBM.lua index 223af12..8b4dc86 100644 --- a/rSkin/modules/DBM.lua +++ b/rSkin/modules/DBM.lua @@ -1,45 +1,11 @@ local A, L = ... -local function HideIcon(icon) - if not icon then return end - if not icon.__hided then - if icon.Backdrop then - icon.Backdrop:Hide() - end - icon:Hide() - icon.__hided = true - end -end - -local function ShowIcon(icon, frame, size, left) - if not icon then return end - if not icon.__styled then - icon:ClearAllPoints() - if left then - icon:SetPoint('BOTTOMRIGHT', frame, 'BOTTOMLEFT', -5, 0) - else - icon:SetPoint('BOTTOMLEFT', frame, 'BOTTOMRIGHT', 5, 0) - end - icon:SetSize(size, size) - if not icon.Backdrop then - icon.Backdrop = L.CreateBackdrop(icon) - end - icon:Show() - icon.Backdrop:Show() - - icon.__styled = true - end -end - -local function ReskinDBMBar(bar, check, border) - if not bar then return end - if not bar[check] then - local inset = border or 1 - bar.Backdrop:SetPoint("TOPLEFT", bar, "TOPLEFT", -inset, inset) - bar.Backdrop:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT", inset, -inset) - bar[check] = true - end -end +local thinBackdrop = rLib.CopyTable(oUF_SimpleConfig.backdrop) +thinBackdrop.edgeSize = 2 +thinBackdrop.inset = 2 +thinBackdrop.insets = {left=2,right=2,top=2,bottom=2} +thinBackdrop.bgColor = {0.23,0.23,0.23,1} +thinBackdrop.edgeColor = {0,0,0,1} local function HideDBMSpark(self) local spark = _G[self.frame:GetName().."BarSpark"] @@ -47,6 +13,12 @@ local function HideDBMSpark(self) spark:SetTexture(nil) end +local function ResetBackdrop(self) + if self.backdrop then + self.backdrop:SetBackdrop(nil) + end +end + local function ApplyDBMStyle(self) local frame = self.frame local frame_name = frame:GetName() @@ -57,48 +29,64 @@ local function ApplyDBMStyle(self) local name = _G[frame_name.."BarName"] local timer = _G[frame_name.."BarTimer"] - local barHeight = self.enlarged and self.owner.Options.HugeHeight/2 or self.owner.Options.Height - local iconSize = frame:GetHeight() + -- tex + if texture then texture:SetTexture(oUF_SimpleConfig.textures.statusbar) end - if not tbar.Backdrop then - tbar.Backdrop = L.CreateBackdrop(tbar) - end - ReskinDBMBar(tbar, self.enlarged and "__style_huge" or "__style_normal", self.enlarged and oUF_SimpleConfig.backdrop.inset or 1) + -- reset backdrop + ResetBackdrop(tbar) + ResetBackdrop(icon1) + ResetBackdrop(icon2) + name:ClearAllPoints() + timer:ClearAllPoints() + icon1:ClearAllPoints() + icon2:ClearAllPoints() + icon1:Hide() + icon2:Hide() + + -- scale first + frame:SetScale(oUF_SimpleConfig.globalscale) + -- bar + local barHeight = self.owner.Options.Height + local barWidth = self.owner.Options.Width if self.enlarged then - frame:SetWidth(self.owner.Options.HugeWidth) - tbar:SetWidth(self.owner.Options.HugeWidth) - ShowIcon(icon1, frame, iconSize, true) - ShowIcon(icon2, frame, iconSize, false) - else - frame:SetWidth(self.owner.Options.Width) - tbar:SetWidth(self.owner.Options.Width) - HideIcon(icon1) - HideIcon(icon2) + barHeight = barHeight/2 + barWidth = self.owner.Options.HugeWidth end + tbar:SetSize(barWidth, barHeight) + tbar:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 0, 0) - frame:SetHeight(barHeight) - frame:SetScale(oUF_SimpleConfig.globalscale) - tbar:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 0, 0) + -- backdrop + local iconOffsetX = 0 + if self.enlarged then + iconOffsetX = 5 + tbar.backdrop = L.CreateBackdrop(tbar) + if DBT.Options.IconLeft then + icon1:Show() + icon1.backdrop = L.CreateBackdrop(icon1) + elseif DBT.Options.IconRight then + icon2:Show() + icon2.backdrop = L.CreateBackdrop(icon2) + end + else + tbar.backdrop = L.CreateBackdrop(tbar, nil, thinBackdrop) + end - if texture then texture:SetTexture(oUF_SimpleConfig.textures.statusbar) end + -- icon + icon1:SetPoint('BOTTOMRIGHT', frame, 'BOTTOMLEFT', -iconOffsetX, 0) + icon2:SetPoint('BOTTOMLEFT', frame, 'BOTTOMRIGHT', iconOffsetX, 0) - name:ClearAllPoints() - timer:ClearAllPoints() + -- text if self.enlarged then - name:SetPoint("BOTTOMLEFT", tbar, "TOPLEFT", 2, 2) - timer:SetPoint("BOTTOMRIGHT", tbar, "TOPRIGHT", -2, 2) + name:SetPoint("BOTTOMLEFT", tbar, "TOPLEFT", 3, 3) + timer:SetPoint("BOTTOMRIGHT", tbar, "TOPRIGHT", -3, 3) else - name:SetPoint("LEFT", frame, "LEFT", 2, 0) - timer:SetPoint("RIGHT", frame, "RIGHT", -2, 0) + name:SetPoint("LEFT", tbar, "LEFT", 3, 0) + timer:SetPoint("RIGHT", tbar, "RIGHT", -3, 0) end - timer:SetFont(oUF_SimpleConfig.fonts.expressway, 10, "OUTLINE") - - -- if DBT.Options.IconLeft then icon1.Backdrop:Show() else icon1.Backdrop:Hide() end - -- if DBT.Options.IconRight then icon2.Backdrop:Show() else icon2.Backdrop:Hide() end end -function SkinDBM() +local function SkinDBM() -- Default notice message local RaidNotice_AddMessage_ = RaidNotice_AddMessage RaidNotice_AddMessage = function(noticeFrame, textString, colorInfo) @@ -138,18 +126,38 @@ function SkinDBM() DBM_AllSavedOptions["Default"]["CountdownVoice"] = "VP:Yike" DBM_AllSavedOptions["Default"]["ChosenVoicePack"] = "Yike" end + + local hugeBarWidth, hugeBarHeight = unpack(oUF_SimpleConfig.target.castbar.size) + local barWidth, barheight = 150, 20 if not DBT_AllPersistentOptions["Default"] then DBT_AllPersistentOptions["Default"] = {} end + + -- place on top of details + local Details = _G.Details + local timerX, timerY = (-(barWidth/2)-10+1)*oUF_SimpleConfig.globalscale, Details and 185 or 69 + + -- normal bar DBT_AllPersistentOptions["Default"]["DBM"].BarYOffset = 3 + DBT_AllPersistentOptions["Default"]["DBM"].Height = barheight + DBT_AllPersistentOptions["Default"]["DBM"].Width = barWidth + DBT_AllPersistentOptions["Default"]["DBM"].ExpandUpwards = true + DBT_AllPersistentOptions["Default"]["DBM"].TimerPoint = "BOTTOMRIGHT" + DBT_AllPersistentOptions["Default"]["DBM"].TimerX = timerX + DBT_AllPersistentOptions["Default"]["DBM"].TimerY = timerY + + -- huge bar DBT_AllPersistentOptions["Default"]["DBM"].HugeBarYOffset = 8 - DBT_AllPersistentOptions["Default"]["DBM"].ExpandUpwards = false DBT_AllPersistentOptions["Default"]["DBM"].ExpandUpwardsLarge = true - - local hugeBarWidth, hugeBarHeight = unpack(oUF_SimpleConfig.target.size) - local barWidth, barheight = 150, 20 - DBT_AllPersistentOptions["Default"]["DBM"].Height = barheight DBT_AllPersistentOptions["Default"]["DBM"].HugeHeight = hugeBarHeight - DBT_AllPersistentOptions["Default"]["DBM"].Width = barWidth DBT_AllPersistentOptions["Default"]["DBM"].HugeWidth = hugeBarWidth + if _G.oUF_SimpleTarget then + local point, _, _, xOfs, yOfs = _G.oUF_SimpleTarget:GetPoint(1) + DBT_AllPersistentOptions["Default"]["DBM"].HugeTimerPoint = point + DBT_AllPersistentOptions["Default"]["DBM"].HugeTimerX = xOfs*oUF_SimpleConfig.globalscale + DBT_AllPersistentOptions["Default"]["DBM"].HugeTimerY = yOfs+hugeBarHeight*3+18 + end + + -- rearrange + DBT:Rearrange() end rSkin:RegisterSkin('DBM', SkinDBM) diff --git a/rSkin/modules/Details.lua b/rSkin/modules/Details.lua index a0b6720..0ecbcec 100644 --- a/rSkin/modules/Details.lua +++ b/rSkin/modules/Details.lua @@ -28,7 +28,7 @@ local function SetupInstance(instance) 0, -- alpha "", -- icon file true, -- start after icon - 3, -- bar space + 4, -- bar space "" -- custom texture file, u can use oUF_SimpleConfig.textures.statusbar or "" as default )