A Fallenroot Satyr
Join Date: Apr 2008
Posts: 28
|
Originally Posted by Luzzifus
Not if you create the SafeZone after the Background. Also you can always set a frame-level to have it on top of the BG.
This is my whole castbar-code and it works perfectly:
Code:
self.Castbar = CreateFrame("StatusBar")
self.Castbar:SetBackdrop({bgFile="Interface\\Tooltips\\UI-Tooltip-Background", insets ={left = -1, right = -1, top = -1, bottom = -1}})
self.Castbar:SetBackdropColor(nivDB.colorBD.r, nivDB.colorBD.g, nivDB.colorBD.b, nivDB.colorBD.a)
self.Castbar:SetWidth(nivcfgDB.castbarWidth)
if (unit=="player") then
self.Castbar:SetHeight(20)
self.Castbar:SetPoint("CENTER", UIParent, "CENTER", nivcfgDB.castbarX, nivcfgDB.castbarY)
else
self.Castbar:SetHeight(10)
self.Castbar:SetPoint("CENTER", UIParent, "CENTER", nivcfgDB.castbarX, nivcfgDB.castbarY - 17)
end
self.Castbar:SetStatusBarTexture(nivDB.texStrHealth)
self.Castbar:SetStatusBarColor(nivcfgDB.colorHealth.r, nivcfgDB.colorHealth.g, nivcfgDB.colorHealth.b, nivvcfgDB.colorHealth.a)
self.Castbar:SetParent(self)
self.Castbar:SetMinMaxValues(1, 100)
self.Castbar:SetValue(1)
self.Castbar:Hide()
self.Castbar.bg = self.Castbar:CreateTexture(nil, "BORDER")
self.Castbar.bg:SetAllPoints(self.Castbar)
self.Castbar.bg:SetTexture("Interface\\AddOns\\oUF_Nivaya\\textures\\Minimalist")
self.Castbar.bg:SetAlpha(0.05)
self.Castbar.Time = self.Castbar:CreateFontString(nil, "OVERLAY")
self.Castbar.Time:SetPoint("RIGHT", self.Castbar, -2, 0)
self.Castbar.Time:SetFont(nivDB.fontStrValues, nivcfgDB.fontHeightV)
self.Castbar.Time:SetTextColor(1, 1, 1)
self.Castbar.Time:SetJustifyH("RIGHT")
self.Castbar.Text = self.Castbar:CreateFontString(nil, "OVERLAY")
self.Castbar.Text:SetPoint("LEFT", self.Castbar, 2, 0)
self.Castbar.Text:SetWidth(240)
self.Castbar.Text:SetFont(nivDB.fontStrNames, nivcfgDB.fontHeightN)
self.Castbar.Text:SetTextColor(1, 1, 1)
self.Castbar.Text:SetJustifyH("LEFT")
if (unit=="player") then
self.Castbar.Time:SetTextHeight(nivcfgDB.fontHeightV+2)
self.Castbar.Text:SetTextHeight(nivcfgDB.fontHeightN+2)
else
self.Castbar.Time:SetTextHeight(nivcfgDB.fontHeightV)
self.Castbar.Text:SetTextHeight(nivcfgDB.fontHeightN)
end
self.Castbar.SafeZone = self.Castbar:CreateTexture(nil,"BORDER")
self.Castbar.SafeZone:SetTexture(nivDB.texStrHealth)
self.Castbar.SafeZone:SetVertexColor(1,1,1,0.7)
self.Castbar.SafeZone:SetPoint("TOPRIGHT")
self.Castbar.SafeZone:SetPoint("BOTTOMRIGHT")
|
i am creating the safezone after the bg and it doesnt work.
Code:
local cb = CreateFrame("StatusBar", nil, self)
cb:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 0, -21)
cb:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 0, -21)
cb:SetStatusBarTexture(texture2)
cb:SetStatusBarColor(0.2705882352941176, 0.407843137254902, 0.5450980392156862)
cb:SetBackdrop(backdrop)
cb:SetBackdropColor(0, 0, 0)
cb:SetHeight(15)
cb:SetWidth(300)
cb:SetMinMaxValues(1, 100)
cb:SetValue(1)
cb:Hide()
self.Castbar = cb
local cbbg = cb:CreateTexture(nil, "BORDER")
cbbg:SetAllPoints(cb)
cbbg:SetTexture(0.3, 0.3, 0.3)
cb.bg = cbbg
local cbtime = SetFontString(cb, fontn, 14, "THINOUTLINE")
cbtime:SetPoint("RIGHT", cb, -3, 1)
cbtime:SetJustifyH("RIGHT")
cb.CustomTimeText = OverrideCastbarTime
cb.Time = cbtime
local cbtext = SetFontString(cb, fontn, 14, "THINOUTLINE")
cbtext:SetPoint("LEFT", cb, 3, 1)
cbtext:SetPoint("RIGHT", cbtime, "LEFT")
cb.Text = cbtext
if(cbarsafe == true and unit == "player") then
local cbsafe = cb:CreateTexture(nil,"ARTWORK")
cbsafe:SetTexture(texture2)
cbsafe:SetVertexColor(.69,.31,.31)
cbsafe:SetPoint("TOPRIGHT")
cbsafe:SetPoint("BOTTOMRIGHT")
cb.SafeZone = cbsafe
end
|