- added a nil check for DogTag in case someone doesn't have it installed

- added lower text alpha lock option
- made text alpha settings work again with dogtag strings set
This commit is contained in:
Parnic
2008-02-10 22:39:51 +00:00
parent 4e83db53d3
commit 9244ef6fe3

View File

@ -60,7 +60,8 @@ function IceBarElement.prototype:GetDefaultSettings()
settings["offset"] = 1 settings["offset"] = 1
settings["scale"] = 1 settings["scale"] = 1
settings["barFontSize"] = 12 settings["barFontSize"] = 12
settings["lockTextAlpha"] = true settings["lockUpperTextAlpha"] = true
settings["lockLowerTextAlpha"] = false
settings["textVisible"] = {upper = true, lower = true} settings["textVisible"] = {upper = true, lower = true}
settings["upperText"] = '' settings["upperText"] = ''
settings["lowerText"] = '' settings["lowerText"] = ''
@ -253,20 +254,34 @@ function IceBarElement.prototype:GetOptions()
order = 11 order = 11
}, },
lockFontAlpha = { lockUpperFontAlpha = {
type = "toggle", type = "toggle",
name = "Lock Bar Text Alpha", name = "Lock Upper Text Alpha",
desc = "Locks upper text alpha to 100%", desc = "Locks upper text alpha to 100%",
get = function() get = function()
return self.moduleSettings.lockTextAlpha return self.moduleSettings.lockUpperTextAlpha
end, end,
set = function(v) set = function(v)
self.moduleSettings.lockTextAlpha = v self.moduleSettings.lockUpperTextAlpha = v
self:Redraw() self:Redraw()
end, end,
order = 13 order = 13
}, },
lockLowerFontAlpha = {
type = "toggle",
name = "Lock Lower Text Alpha",
desc = "Locks lower text alpha to 100%",
get = function()
return self.moduleSettings.lockLowerTextAlpha
end,
set = function(v)
self.moduleSettings.lockLowerTextAlpha = v
self:Redraw()
end,
order = 13.1
},
upperTextVisible = { upperTextVisible = {
type = 'toggle', type = 'toggle',
name = 'Upper text visible', name = 'Upper text visible',
@ -646,7 +661,10 @@ function IceBarElement.prototype:UpdateBar(scale, color, alpha)
self.barFrame:Show() self.barFrame:Show()
end end
DogTag:UpdateAllForFrame(self.frame) if DogTag ~= nil then
DogTag:UpdateAllForFrame(self.frame)
self:SetTextAlpha()
end
end end
@ -676,11 +694,10 @@ function IceBarElement.prototype:SetBottomText1(text, color)
end end
end end
if (self.moduleSettings.lockTextAlpha and (self.alpha > 0)) then if (self.moduleSettings.lockUpperTextAlpha and (self.alpha > 0)) then
alpha = 1 alpha = 1
end end
self.frame.bottomUpperText:SetTextColor(self:GetColor(color, alpha))
self.frame.bottomUpperText:SetText(text) self.frame.bottomUpperText:SetText(text)
end end
@ -705,11 +722,25 @@ function IceBarElement.prototype:SetBottomText2(text, color, alpha)
end end
end end
if (self.moduleSettings.lockLowerTextAlpha and (self.alpha > 0)) then
alpha = 1
end
self.frame.bottomLowerText:SetTextColor(self:GetColor(color, alpha)) self.frame.bottomLowerText:SetTextColor(self:GetColor(color, alpha))
self.frame.bottomLowerText:SetText(text) self.frame.bottomLowerText:SetText(text)
end end
function IceBarElement.prototype:SetTextAlpha()
if self.frame.bottomUpperText then
self.frame.bottomUpperText:SetAlpha(self.moduleSettings.lockUpperTextAlpha and 1 or math.min(self.alpha + 0.1, 1))
end
if self.frame.bottomLowerText then
self.frame.bottomLowerText:SetAlpha(self.moduleSettings.lockLowerTextAlpha and 1 or math.min(self.alpha + 0.1, 1))
end
end
function IceBarElement.prototype:GetFormattedText(value1, value2) function IceBarElement.prototype:GetFormattedText(value1, value2)
local color = "ffcccccc" local color = "ffcccccc"