|
03-29-10, 05:55 PM | #1 |
Layers/Strata?
Starting a new thread for this because I can't seem to find anything on it. Here's my layout:
I'd like to find out how to make the name text go behind the castbar, but I can't figure out layers or strata at all. The other thing that bothers me is my mana text updates slow and not quickly like the default text does. My code: Code:
local bartexture = 'Interface\\AddOns\\oUF_bloo\\media\\bartexture' local bufftexture = 'Interface\\AddOns\\oUF_bloo\\media\\buff' local numberfont = 'Interface\\AddOns\\oUF_bloo\\media\\numberfont.ttf' local namefont = 'Interface\\AddOns\\oUF_bloo\\media\\namefont.ttf' local function SetFontString(parent, fontName, fontHeight, fontStyle) local fs = parent:CreateFontString(nil, 'OVERLAY') fs:SetFont(fontName, fontHeight, fontStyle) fs:SetJustifyH('LEFT') fs:SetShadowColor(0,0,0) fs:SetShadowOffset(1.25, -1.25) return fs end local function Hex(r, g, b) if type(r) == "table" then if r.r then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end end return string.format("|cff%02x%02x%02x", r*255, g*255, b*255) end -- [[ Menu ]] -- local menu = function(self) local unit = self.unit:sub(1, -2) local cunit = self.unit:gsub('(.)', string.upper, 1) if(unit == 'party' or unit == 'partypet') then ToggleDropDownMenu(1, nil, _G['PartyMemberFrame'..self.id..'DropDown'], 'cursor', 0, 0) elseif(_G[cunit..'FrameDropDown']) then ToggleDropDownMenu(1, nil, _G[cunit..'FrameDropDown'], "cursor", 0, 0) end end --[[ short hp value ]]-- local function shorthpval(value) if(value >= 1e6) then return string.format('%.1fm', value / 1e6) elseif(value >= 1e4) then return string.format('%.1fk', value / 1e3) elseif value >= 1e3 then return string.format('%.1fk', value / 1e3) else return value end end --[[ colors ]]-- oUF.colors.power["MANA"] = { 26/255, 139/255, 255/255 }; oUF.colors.power["RAGE"] = { 255/255, 26/255, 48/255 }; oUF.colors.power["FOCUS"] = { 255/255, 150/255, 26/255 }; oUF.colors.power["ENERGY"] = { 255/255, 225/255, 26/255 }; oUF.colors.power["HAPPINESS"] = { 0.00, 1.00, 1.00 }; oUF.colors.power["RUNES"] = { 0.50, 0.50, 0.50 }; oUF.colors.power["RUNIC_POWER"] = { 0.00, 0.82, 1.00 }; oUF.colors.power["AMMOSLOT"] = { 0.80, 0.60, 0.00 }; oUF.colors.power["FUEL"] = { 0.0, 0.55, 0.5 }; --[[ aura icon skin ]]-- local auraIcon = function(self, button, icons) icons.showDebuffType = true button.icon:SetTexCoord(.07, .93, .07, .93) button.icon:SetPoint('TOPLEFT', button, 'TOPLEFT', 1, -1) button.icon:SetPoint('BOTTOMRIGHT', button, 'BOTTOMRIGHT', -1, 1) button.overlay:SetTexture(bufftexture) button.overlay:SetTexCoord(0,1,0,1) button.overlay.Hide = function(self) self:SetVertexColor(0.3, 0.3, 0.3) end button.cd:SetReverse() button.cd:SetPoint('TOPLEFT', button, 'TOPLEFT', 2, -2) button.cd:SetPoint('BOTTOMRIGHT', button, 'BOTTOMRIGHT', -2, 2) end --[[ castbar format ]]-- local lolCastBarTime = function(self, duration) if self.channeling then self.Time:SetFormattedText("%.1f|cff357EC7s|r", duration) self.Time:SetFont(numberfont, 10) elseif self.casting then self.Time:SetFormattedText("%.1f|cff357EC7s|r", self.max - duration) self.Time:SetFont(numberfont, 10) end end -- Tags -- local colors = setmetatable({ power = setmetatable({ ['MANA'] = {0, 144/255, 1} }, {__index = oUF.colors.power}), }, {__index = oUF.colors}) local numberize = function(v) if v <= 9999 then return v end if v >= 1000000 then local value = string.format("%.1fm", v/1000000) return value elseif v >= 10000 then local value = string.format("%.1fk", v/1000) return value end end if (not oUF.Tags['[colorhp]']) then oUF.Tags['[colorhp]'] = function(unit) local cur = UnitHealth(unit) local max = UnitHealthMax(unit) local r, g, b r, g, b = oUF.ColorGradient(cur/max, 0.69, 0.31, 0.31, 0.65, 0.63, 0.35, 0.33, 0.59, 0.33) return string.format("|cff%02x%02x%02x",r*255,g*255,b*255) end end if (not oUF.Tags['[shortcurhp]']) then oUF.Tags['[shortcurhp]'] = function(unit) local cur = UnitHealth(unit) local max = UnitHealthMax(unit) local r, g, b r, g, b = oUF.ColorGradient(cur/max, 0.69, 0.31, 0.31, 0.65, 0.63, 0.35, 0.33, 0.59, 0.33) return string.format(numberize(cur)) end end local function Hex(r, g, b) if type(r) == 'table' then if r.r then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end end return string.format('|cff%02x%02x%02x', r*255, g*255, b*255) end oUF.Tags['[shortcurpp]'] = function(u) local _, powerTypeString = UnitPowerType(u) return powerTypeString and Hex(oUF.colors.power[powerTypeString])..shorthpval(UnitPower(u)) or shorthpval(UnitPower(u)) end ------------------------------------------------------------------------ -- Layout ------------------------------------------------------------------------ local function layout(self, unit) self.menu = menu self:RegisterForClicks('AnyDown') self:SetScript('OnEnter', UnitFrame_OnEnter) self:SetScript('OnLeave', UnitFrame_OnLeave) self:SetAttribute('*type2', 'menu') self:SetFormattedText(numberfont, 14) ----------------------------------------------------------------------- -- Health / Power ----------------------------------------------------------------------- -- Health -- local hp = CreateFrame('StatusBar', nil, self) hp:SetStatusBarTexture(bartexture) hp:SetParent(self) hp:SetPoint'TOP' hp:SetPoint'LEFT' hp:SetPoint'RIGHT' local healthbg = hp:CreateTexture(nil, 'BORDER') healthbg:SetPoint('CENTER', hp, 'CENTER', 0, 0) healthbg:SetTexture(bartexture) healthbg:SetVertexColor(0.16,0.16,0.16,1) hp.colorClass = true hp.colorTapping = true hp.colorReaction = true hp.frequentUpdates = true self.Health = hp -- Power -- pp = CreateFrame('StatusBar', nil, self) pp:SetStatusBarTexture(bartexture) pp:SetHeight(3) pp:SetPoint("TOP", hp, "BOTTOM", 0, 29) local powerbg = pp:CreateTexture(nil, 'BORDER') powerbg:SetPoint('CENTER', pp, 'CENTER', 0, 0) powerbg:SetTexture(bartexture) powerbg:SetWidth(220) powerbg:SetHeight(3) powerbg:SetVertexColor(0.16,0.16,0.16,1) pp:SetParent(self) pp:SetPoint'LEFT' pp:SetPoint'RIGHT' pp.colorPower = true self.Power = pp -- [[ Backgrounds ]] -- if unit=='player' then hp:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], level = '0', insets = {top = -2, left = -2, bottom = -2, right = -2}}) hp:SetBackdropColor(0, 0, 0, 1) pp:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], level = '0', insets = {top = -3, left = -2, bottom = -3, right = -2}}) pp:SetBackdropColor(0, 0, 0, 1) end if unit=='target' then hp:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], level = '0', insets = {top = -2, left = -2, bottom = -2, right = -3}}) hp:SetBackdropColor(0, 0, 0, 1) pp:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], level = '0', insets = {top = -3, left = -2, bottom = -3, right = -3}}) pp:SetBackdropColor(0, 0, 0, 1) end if unit=='targettarget' then hp:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], level = '0', insets = {top = -3, left = -2, bottom = -2, right = -2}}) hp:SetBackdropColor(0, 0, 0, 1) end if unit=='focus' then hp:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], level = '0', insets = {top = -2, left = -2, bottom = -2, right = -2}}) hp:SetBackdropColor(0, 0, 0, 1) end if unit=='pet' then hp:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], level = '0', insets = {top = -2, left = -2, bottom = -2, right = -3}}) hp:SetBackdropColor(0, 0, 0, 1) end ----------------------------------------------------------------------- -- Texts ----------------------------------------------------------------------- -- [[ Health Text ]] -- local curhealth = hp:CreateFontString(nil, 'OVERLAY') curhealth:SetFont(numberfont, 16) self:Tag(curhealth,'[shortcurhp] | [colorhp][perhp]%') curhealth:SetShadowOffset(1, -1) -- [[ Power Text ]] -- local curpower = pp:CreateFontString(nil, 'OVERLAY') curpower:SetFont(numberfont, 14) self:Tag(curpower,'[shortcurpp]') curpower:SetShadowOffset(1, -1) -- [[ Name Text ]] -- local unitnames = hp:CreateFontString(nil, 'OVERLAY') unitnames:SetFont(namefont, 14) self:Tag(unitnames,'[name]') unitnames:SetShadowOffset(1, -1) --[[ raid icon ]]-- self.RaidIcon = hp:CreateTexture(nil, "OVERLAY") self.RaidIcon:SetHeight(16) self.RaidIcon:SetWidth(16) self.RaidIcon:SetPoint('Center', self, 0, 0) self.RaidIcon:SetTexture'Interface\\TargetingFrame\\UI-RaidTargetingIcons' ----------------------------------------------------------------------- -- Buffs / Debuffs ----------------------------------------------------------------------- --[[ buffs ]]-- self.Buffs = CreateFrame("Frame", nil, self) self.Buffs.size = 22 self.Buffs:SetHeight(self.Buffs.size) self.Buffs:SetWidth(self.Buffs.size * 10) self.Buffs:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', -2, 13) self.Buffs.initialAnchor = 'BOTTOMLEFT' self.Buffs["growth-y"] = 'TOP' self.Buffs.num = 20 self.Buffs.spacing = 2 --[[ debuffs ]]-- self.Debuffs = CreateFrame("Frame", nil, self) self.Debuffs.size = 22 self.Debuffs:SetHeight(self.Debuffs.size) self.Debuffs:SetWidth(self.Debuffs.size * 10) self.Debuffs:SetPoint('BOTTOMLEFT', oUF.units.player, 'TOPLEFT', -2, 13) self.Debuffs.initialAnchor = 'BOTTOMLEFT' self.Debuffs["growth-y"] = 'TOP' self.Debuffs.num = 20 self.Debuffs.spacing = 3 ----------------------------------------------------------------------- -- Cast Bars ----------------------------------------------------------------------- --[[ player cast bar ]]-- if unit=='player' then self.Castbar = CreateFrame('StatusBar', nil, self) self.Castbar:SetWidth(220) self.Castbar:SetHeight(12) self.Castbar:SetPoint('CENTER', oUF.units.player, 'CENTER', 0, -22) self.Castbar:SetStatusBarTexture(bartexture) self.Castbar:SetStatusBarColor(0.4, 0.5, 0.7) self.Castbar:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], level = '0', insets = {top = -2, left = -2, bottom = -2, right = -2}}) self.Castbar:SetBackdropColor(0, 0, 0, 1) self.Castbar.bg = self.Castbar:CreateTexture(nil, 'BORDER') self.Castbar.bg:SetAllPoints(self.Castbar) self.Castbar.bg:SetTexture(bartexture) self.Castbar.bg:SetVertexColor(0.16,0.16,0.16,1) self.Castbar.Text = self.Castbar:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightLeft') self.Castbar.Text:SetPoint('Center', self.Castbar, 0, -13) self.Castbar.Text:SetFont(namefont, 13) self.Castbar.Text:SetTextColor(1, 1, 1) self.Castbar.Time = self.Castbar:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmallRight') self.Castbar.Time:SetPoint('Left', self.Castbar, 224, 1) self.Castbar.Time:SetTextColor(1, 1, 1) self.Castbar.CustomTimeText = lolCastBarTime self.Castbar.Icon = self.Castbar:CreateTexture(nil, "ARTWORK") self.Castbar.Icon:SetHeight(20) self.Castbar.Icon:SetWidth(20) self.Castbar.Icon:SetTexCoord(0,1,0,1) self.Castbar.Icon:SetPoint("LEFT", -28, 0) self.IconOverlay = self.Castbar:CreateTexture(nil, "OVERLAY") self.IconOverlay:SetPoint("TOPLEFT", self.Castbar.Icon, "TOPLEFT") self.IconOverlay:SetPoint("BOTTOMRIGHT", self.Castbar.Icon, "BOTTOMRIGHT") self.IconOverlay:SetTexture(bufftexture) self.IconOverlay:SetVertexColor(0.25, 0.25, 0.25) self.Castbar.SafeZone = self.Castbar:CreateTexture(nil,"ARTWORK") self.Castbar.SafeZone:SetTexture(CBtex) self.Castbar.SafeZone:SetVertexColor(0.85,0.10,0.10,0.50) self.Castbar.SafeZone:SetPoint("TOPRIGHT") self.Castbar.SafeZone:SetPoint("BOTTOMRIGHT") end --[[ target cast bar ]]-- if unit=='target' then self.Castbar = CreateFrame('StatusBar', nil, self) self.Castbar:SetWidth(220) self.Castbar:SetHeight(12) self.Castbar:SetPoint('CENTER', oUF.units.target, 'CENTER', 0, -22) self.Castbar:SetStatusBarTexture(bartexture) self.Castbar:SetStatusBarColor(0.4, 0.5, 0.7) self.Castbar:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], level = '0', insets = {top = -2, left = -2, bottom = -2, right = -3}}) self.Castbar:SetBackdropColor(0, 0, 0, 1) self.Castbar.bg = self.Castbar:CreateTexture(nil, 'BORDER') self.Castbar.bg:SetAllPoints(self.Castbar) self.Castbar.bg:SetTexture(bartexture) self.Castbar.bg:SetVertexColor(0.16,0.16,0.16,1) self.Castbar.Text = self.Castbar:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmallLeft') self.Castbar.Text:SetPoint('Center', self.Castbar, 0, -13) self.Castbar.Text:SetFont(namefont, 14) self.Castbar.Text:SetTextColor(1, 1, 1) self.Castbar.Time = self.Castbar:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmallRight') self.Castbar.Time:SetPoint('RIGHT', self.Castbar, -224, 2) self.Castbar.Time:SetTextColor(1, 1, 1) self.Castbar.CustomTimeText = lolCastBarTime self.Castbar.Icon = self.Castbar:CreateTexture(nil, "ARTWORK") self.Castbar.Icon:SetHeight(20) self.Castbar.Icon:SetWidth(20) self.Castbar.Icon:SetTexCoord(0,1,0,1) self.Castbar.Icon:SetPoint("RIGHT", 28, 0) self.IconOverlay = self.Castbar:CreateTexture(nil, "OVERLAY") self.IconOverlay:SetPoint("TOPLEFT", self.Castbar.Icon, "TOPLEFT") self.IconOverlay:SetPoint("BOTTOMRIGHT", self.Castbar.Icon, "BOTTOMRIGHT") self.IconOverlay:SetTexture(bufftexture) self.IconOverlay:SetVertexColor(0.25, 0.25, 0.25) end --[[ focus castbar ]]-- if unit=='focus' then self.Castbar = CreateFrame('StatusBar', nil, self) self.Castbar:SetWidth(300) self.Castbar:SetHeight(10) self.Castbar:SetPoint('CENTER', 0, 600) self.Castbar:SetStatusBarTexture(bartexture) self.Castbar:SetStatusBarColor(0.4, 0.5, 0.7) self.Castbar:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], level = '0', insets = {top = -2, left = -3, bottom = -3, right = -2}}) self.Castbar:SetBackdropColor(0, 0, 0, 1) self.Castbar.bg = self.Castbar:CreateTexture(nil, 'BORDER') self.Castbar.bg:SetAllPoints(self.Castbar) self.Castbar.bg:SetTexture(bartexture) self.Castbar.bg:SetVertexColor(0.16,0.16,0.16,1) self.Castbar.Text = self.Castbar:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightLeft') self.Castbar.Text:SetPoint('Left', self.Castbar, 0, 16) self.Castbar.Text:SetFont(namefont, 12) self.Castbar.Text:SetTextColor(1, 1, 1) self.Castbar.Time = self.Castbar:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmallRight') self.Castbar.Time:SetPoint('Right', self.Castbar, -2, 16) self.Castbar.Time:SetTextColor(1, 1, 1) self.Castbar.CustomTimeText = lolCastBarTime self.Castbar.Icon = self.Castbar:CreateTexture(nil, "ARTWORK") self.Castbar.Icon:SetHeight(50) self.Castbar.Icon:SetWidth(50) self.Castbar.Icon:SetTexCoord(0,1,0,1) self.Castbar.Icon:SetPoint("Center", 0, -36) self.IconOverlay = self.Castbar:CreateTexture(nil, "OVERLAY") self.IconOverlay:SetPoint("TOPLEFT", self.Castbar.Icon, "TOPLEFT") self.IconOverlay:SetPoint("BOTTOMRIGHT", self.Castbar.Icon, "BOTTOMRIGHT") self.IconOverlay:SetTexture(bufftexture) self.IconOverlay:SetVertexColor(0.25, 0.25, 0.25) end --[[ pet castbar ]]-- if unit=='pet' then self.Castbar = CreateFrame('StatusBar', nil, self) self.Castbar:SetWidth(220) self.Castbar:SetHeight(10) self.Castbar:SetPoint('CENTER', oUF.units.pet, 'CENTER', 0, 17) self.Castbar:SetStatusBarTexture(bartexture) self.Castbar:SetStatusBarColor(0.4, 0.5, 0.7) self.Castbar:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=], level = '0', insets = {top = -2, left = -2, bottom = -3, right = -3}}) self.Castbar:SetBackdropColor(0, 0, 0, 1) self.Castbar.bg = self.Castbar:CreateTexture(nil, 'BORDER') self.Castbar.bg:SetAllPoints(self.Castbar) self.Castbar.bg:SetTexture(bartexture) self.Castbar.bg:SetVertexColor(0.16,0.16,0.16,1) self.Castbar.Text = self.Castbar:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightLeft') self.Castbar.Text:SetPoint('LEFT', self.Castbar, 0, 15) self.Castbar.Text:SetFont(namefont, 12) self.Castbar.Text:SetTextColor(1, 1, 1) self.Castbar.Time = self.Castbar:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmallRight') self.Castbar.Time:SetPoint('RIGHT', self.Castbar, -2, 15) self.Castbar.Time:SetTextColor(1, 1, 1) self.Castbar.CustomTimeText = lolCastBarTime self.Castbar.Icon = self.Castbar:CreateTexture(nil, "ARTWORK") self.Castbar.Icon:SetHeight(20) self.Castbar.Icon:SetWidth(20) self.Castbar.Icon:SetTexCoord(0,1,0,1) self.Castbar.Icon:SetPoint("LEFT", -28, 0) self.IconOverlay = self.Castbar:CreateTexture(nil, "OVERLAY") self.IconOverlay:SetPoint("TOPLEFT", self.Castbar.Icon, "TOPLEFT") self.IconOverlay:SetPoint("BOTTOMRIGHT", self.Castbar.Icon, "BOTTOMRIGHT") self.IconOverlay:SetTexture(bufftexture) self.IconOverlay:SetVertexColor(0.25, 0.25, 0.25) end --[[ combo points ]]-- if unit=='target' then self.CPoints = {} self.CPoints.unit = 'player' for i = 1, 5 do self.CPoints[i] = self.Power:CreateTexture(nil, 'OVERLAY') self.CPoints[i]:SetHeight(12) self.CPoints[i]:SetWidth(12) self.CPoints[i]:SetTexture(combotexture) if (i == 1) then self.CPoints[i]:SetPoint('BOTTOMRIGHT', self, 3, -20) else self.CPoints[i]:SetPoint('RIGHT', self.CPoints[i-1], 'LEFT', 1) end end end ----------------------------------------------------------------------- -- Frame Settings ----------------------------------------------------------------------- if unit=='player' then self:SetAttribute('initial-height', 20) self:SetAttribute('initial-width', 220) self.Power:Show() unitnames:SetPoint('Center', self, 0, -21) curhealth:Show() curpower:Show() curhealth:SetPoint('Right', self, -230, 0) curpower:SetPoint('Right', self, -230, 18) healthbg:SetWidth(220) healthbg:SetHeight(20) end if unit == 'target' then self:SetAttribute('initial-height', 20) self:SetAttribute('initial-width', 220) self.Power:Show() unitnames:SetPoint('Center', self, 0, -21) curhealth:Show() curpower:Show() curhealth:SetPoint('Left', self, 230, 0) curpower:SetPoint('Left', self, 230, 18) healthbg:SetWidth(220) healthbg:SetHeight(20) end if unit ~= 'target' then self.Buffs:Hide() self.Debuffs:Hide() end if unit=='focus' then self:SetAttribute('initial-height', 16) self:SetAttribute('initial-width', 100) self.Power:Hide() unitnames:SetPoint('Center', self, 0, 21) curhealth:Hide() curpower:Hide() healthbg:SetWidth(100) healthbg:SetHeight(16) end if unit=='targettarget' then self:SetAttribute('initial-height', 16) self:SetAttribute('initial-width', 100) self.Power:Hide() unitnames:SetPoint('Center', self, 0, -21) curhealth:Hide() curpower:Hide() healthbg:SetWidth(100) healthbg:SetHeight(16) end if unit=='pet' then self:SetAttribute('initial-height', 12) self:SetAttribute('initial-width', 220) self.Power:Hide() unitnames:SetPoint('Right', self, -230, 1) curhealth:Hide() curpower:Hide() end self.PostCreateAuraIcon = auraIcon return self end oUF:RegisterStyle('oUF_bloo', layout) oUF:SetActiveStyle('oUF_bloo') oUF:Spawn('player'):SetPoint('CENTER', -200, -300) oUF:Spawn('focus'):SetPoint('CENTER', 0, -279) oUF:Spawn('target'):SetPoint('CENTER', 200, -300) oUF:Spawn('targettarget'):SetPoint('CENTER', 0, -301) oUF:Spawn('pet'):SetPoint('Center', -200, -269) |
|
03-29-10, 07:24 PM | #2 |
Easiest solution in this case would be to set your frames at the same strata but set your castbar's frame level higher.
self.Castbar:SetFrameLevel(#) Enable frequentUpdates on your power element to get smooth updating. self.Power.frequentUpdates = 1 Last edited by Waverian : 03-29-10 at 07:30 PM. |
|
WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Layers/Strata? |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Hybrid Mode |
Switch to Threaded Mode |
|
|