/trunk/AuraUnitFramesCore
end |
function AuraUnitFramesCore_UpdatePower(self, unit) |
--update the value |
local value = UnitPower(unit); |
self.Mana.Bar:SetValue(value); |
self.Mana.Bar.Text:SetText(value); |
end |
function AuraUnitFramesCore_UpdateMaxPower(self, unit) |
local max = UnitPowerMax(unit); |
self.Mana.Bar:SetMinMaxValues(0, max); |
AuraUnitFramesCore_UpdatePower(self, unit); |
end |
function AuraUnitFramesCore_UpdatePowerType(self, unit) |
local max = UnitPowerMax(unit); |
local type, token, r, g, b = UnitPowerType(unit); |
local colour = PowerBarColor[token]; |
if (colour) then |
self.Mana.Bar:SetStatusBarColor(colour.r, colour.g, colour.b); |
else |
self.Mana.Bar:SetStatusBarColor(r, g, b); |
end |
self.Mana.Bar:SetMinMaxValues(0, max); |
--finally update the current value |
AuraUnitFramesCore_UpdatePower(self,unit); |
end |
--[[================================================= |
UTILITY METHODS |
===================================================]]-- |
end |
end |
function AuraUnitFramesCore_UnRegPowerEvents(self) |
self:UnregisterEvent("UNIT_MANA"); |
self:UnregisterEvent("UNIT_RAGE"); |
self:UnregisterEvent("UNIT_FOCUS"); |
self:UnregisterEvent("UNIT_ENERGY"); |
self:UnregisterEvent("UNIT_HAPPINESS"); |
self:UnregisterEvent("UNIT_RUNIC_POWER"); |
end |
function AuraUnitFramesCore_RegPowerEvents(self) |
self:RegisterEvent("UNIT_MANA"); |
self:RegisterEvent("UNIT_RAGE"); |
self:RegisterEvent("UNIT_FOCUS"); |
self:RegisterEvent("UNIT_ENERGY"); |
self:RegisterEvent("UNIT_HAPPINESS"); |
self:RegisterEvent("UNIT_RUNIC_POWER"); |
end |
--[[================================================= |
SETUP METHODS |
===================================================]]-- |
frame:SetPoint(values.point, values.relativeto, values.relativepoint, values.xoff, values.yoff); |
AUF_loadtexturelayer(frame.Texture,values.texture); |
AUF_loadfontstring(frame.Text, values.fontstring); |
print(frame:GetParent():GetName()); |
frame:Show(); |
end |
AUF_loadtexturelayer(statusbar.Texture, values.texture); |
-- load the fontstring for the bar |
AUF_loadfontstring(statusbar.Text, values.fontstring); |
print(statusbar:GetParent():GetName()); |
statusbar.currValue = 0; |
statusbar:Show(); |
end |
-- you only control where the background is anchored for each independantly the rest is automatic |
-- we don't have to load the settings for healthbars based on the frame |
local healthbarvalues = values.healthbar; |
local manabarvalues = values.manabar; |
--[[ |
--setup the statusbar |
AUF_loadstatusbar(frame.Health.Bar, healthbarvalues.bar); |
-- setup the manabar |
AUF_loadframe(frame.Mana, manabarvalues); |
AUF_loadstatusbar(frame.Mana.Bar, manabarvalues.bar); |
end |
height = 64, --height |
width = 128, --width |
point = "CENTER", -- point |
relativeto = "UIParent", -- relative to |
relativeto = "$parent", -- relative to |
relativepoint = "CENTER", --relative point - At a later date this will become TOPLEFT |
xoff = 0, -- x offset |
yoff = 0, -- y offset |
]]-- |
healthbar = { --defaults for any and all healthbars that will be shown |
height = 64, -- height |
height = 32, -- height |
width = 128, -- width |
point = "CENTER", -- point |
relativeto = nil, -- relative to - nil so we make it behave like its parent |
relativepoint = nil, --relative point - nil again |
point = "TOPLEFT", -- point |
relativeto = "$parent", -- relative to - nil so we make it anchor to its parent |
relativepoint = "TOPLEFT", --relative point |
xoff = 0, -- x offset |
yoff = 0, -- y offset |
--buttons need backgrounds too! |
fontstring = { |
layer = "OVERLAY", |
font = "GameFontNormal", |
height = 64, |
height = 32, |
width = 128, |
point = "CENTER", -- point |
relativeto = nil, -- relative to - nil so we make it behave like its parent |
relativeto = "$parent", -- relative to - nil so we make it anchor to its parent |
relativepoint = nil, --relative point - nil again |
xoff = 0, -- x offset |
yoff = 0, -- y offset |
bar = { -- defaults for the actual healthbar itself |
bartexture = "Interface\\TargetingFrame\\UI-TargetingFrame-BarFill", |
-- rgb info + alpha |
colourred = 0.0, |
colourgreen = 1.0, |
colourblue = 0.0, |
colouralpha = 1.0, |
r = 0.0, |
g = 1.0, |
b = 0.0, |
a = 1.0, |
-- no need for points as the bar fits the button its embeded in |
texture = { |
layer = "BACKGROUND", |
fontstring = { |
layer = "OVERLAY", |
font = "GameFontNormal", |
height = 64, |
height = 32, |
width = 128, |
point = "CENTER", -- point |
relativeto = nil, -- relative to - nil so we make it behave like its parent |
relativeto = "$parent", -- relative to - nil so we make it anchor to its parent |
relativepoint = nil, --relative point - nil again |
xoff = 0, -- x offset |
yoff = 0, -- y offset |
}, |
}, |
}, |
manabar = { --defaults for any and all healthbars that will be shown |
height = 32, -- height |
width = 128, -- width |
point = "TOPLEFT", -- point |
relativeto = "$parentHealth", -- relative to - nil so we make it anchor to its parent |
relativepoint = "BOTTOMLEFT", --relative point |
xoff = 0, -- x offset |
yoff = 0, -- y offset |
--buttons need backgrounds too! |
texture = { |
layer = "BACKGROUND", |
texture = "Interface\\Tooltips\\ChatBubble-Background", |
}, |
fontstring = { |
layer = "OVERLAY", |
font = "GameFontNormal", |
height = 32, |
width = 128, |
point = "CENTER", -- point |
relativeto = "$parent", -- relative to - nil so we make it anchor to its parent |
relativepoint = nil, --relative point - nil again |
xoff = 0, -- x offset |
yoff = 0, -- y offset |
}, |
bar = { -- defaults for the actual bar itself |
bartexture = "Interface\\TargetingFrame\\UI-TargetingFrame-BarFill", |
-- rgb info + alpha |
r = 0.0, |
g = 1.0, |
b = 0.0, |
a = 1.0, |
-- no need for points as the bar fits the button its embeded in |
texture = { |
layer = "BACKGROUND", |
texture = "Interface\\Tooltips\\ChatBubble-Background", |
}, |
fontstring = { |
layer = "OVERLAY", |
font = "GameFontNormal", |
height = 32, |
width = 128, |
point = "CENTER", -- point |
relativeto = "$parent", -- relative to - nil so we make it anchor to its parent |
relativepoint = nil, --relative point - nil again |
xoff = 0, -- x offset |
yoff = 0, -- y offset |
}, |
}, |
}, |
## Interface: 30200 |
## Notes: Core for all modules, contains shared methods and the defaults for the addon. Needed by all parts of Aura Unit Frames. |
## Title: AuraUnitFramesCore |
## Version: 3.0.5 $Revision$ |
## Version: 3.0.6 $Revision$ |
AuraUnitFramesOptions.lua |
AuraUnitFramesCore.xml |