mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- removed some local vars from the Update function to attempt to curb some hemorrhaging memory
This commit is contained in:
@ -13,7 +13,8 @@ IceUnitBar.prototype.healthPercentage = nil
|
|||||||
IceUnitBar.prototype.mana = nil
|
IceUnitBar.prototype.mana = nil
|
||||||
IceUnitBar.prototype.maxMana = nil
|
IceUnitBar.prototype.maxMana = nil
|
||||||
IceUnitBar.prototype.manaPercentage = nil
|
IceUnitBar.prototype.manaPercentage = nil
|
||||||
IceUnitBar.prototype.scaleColorInst = nil
|
IceUnitBar.prototype.scaleHPColorInst = nil
|
||||||
|
IceUnitBar.prototype.scaleMPColorInst = nil
|
||||||
|
|
||||||
IceUnitBar.prototype.unitClass = nil
|
IceUnitBar.prototype.unitClass = nil
|
||||||
IceUnitBar.prototype.hasPet = nil
|
IceUnitBar.prototype.hasPet = nil
|
||||||
@ -37,6 +38,9 @@ function IceUnitBar.prototype:init(name, unit)
|
|||||||
self:SetDefaultColor("MinHealthColor", 200, 37, 30)
|
self:SetDefaultColor("MinHealthColor", 200, 37, 30)
|
||||||
self:SetDefaultColor("MaxManaColor", 0, 0, 255)
|
self:SetDefaultColor("MaxManaColor", 0, 0, 255)
|
||||||
self:SetDefaultColor("MinManaColor", 255, 0, 255)
|
self:SetDefaultColor("MinManaColor", 255, 0, 255)
|
||||||
|
|
||||||
|
self.scaleHPColorInst = { r = 0, g = 255, b = 0 }
|
||||||
|
self.scaleMPColorInst = { r = 0, g = 0, b = 255 }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -150,10 +154,8 @@ end
|
|||||||
|
|
||||||
-- OVERRIDE
|
-- OVERRIDE
|
||||||
function IceUnitBar.prototype:Update()
|
function IceUnitBar.prototype:Update()
|
||||||
local maxColor = {r = 0, g = 0, b = 0}
|
|
||||||
local minColor = {r = 0, g = 0, b = 0}
|
|
||||||
|
|
||||||
IceUnitBar.super.prototype.Update(self)
|
IceUnitBar.super.prototype.Update(self)
|
||||||
|
|
||||||
self.tapped = UnitIsTapped(self.unit) and (not UnitIsTappedByPlayer(self.unit))
|
self.tapped = UnitIsTapped(self.unit) and (not UnitIsTappedByPlayer(self.unit))
|
||||||
|
|
||||||
self.health = UnitHealth(self.unit)
|
self.health = UnitHealth(self.unit)
|
||||||
@ -167,28 +169,20 @@ function IceUnitBar.prototype:Update()
|
|||||||
_, self.unitClass = UnitClass(self.unit)
|
_, self.unitClass = UnitClass(self.unit)
|
||||||
|
|
||||||
if( self.moduleSettings.scaleHealthColor ) then
|
if( self.moduleSettings.scaleHealthColor ) then
|
||||||
minColor.r,minColor.g,minColor.b = self:GetColor("MinHealthColor")
|
self:SetScaledColor(self.scaleHPColorInst, self.healthPercentage/100, self.settings.colors["MaxHealthColor"], self.settings.colors["MinHealthColor"])
|
||||||
maxColor.r,maxColor.g,maxColor.b = self:GetColor("MaxHealthColor")
|
self.settings.colors["ScaledHealthColor"] = self.scaleHPColorInst
|
||||||
self:SetScaledColor(self.healthPercentage/100, maxColor, minColor)
|
|
||||||
self:SetColor("ScaledHealthColor", self.scaleColorInst.r, self.scaleColorInst.g, self.scaleColorInst.b)
|
|
||||||
end
|
end
|
||||||
if( self.moduleSettings.scaleManaColor ) then
|
if( self.moduleSettings.scaleManaColor ) then
|
||||||
minColor.r,minColor.g,minColor.b = self:GetColor("MinManaColor")
|
self:SetScaledColor(self.scaleMPColorInst, self.manaPercentage/100, self.settings.colors["MaxManaColor"], self.settings.colors["MinManaColor"])
|
||||||
maxColor.r,maxColor.g,maxColor.b = self:GetColor("MaxManaColor")
|
self.settings.colors["ScaledManaColor"] = self.scaleMPColorInst
|
||||||
self:SetScaledColor(self.manaPercentage/100, maxColor, minColor)
|
|
||||||
self:SetColor("ScaledManaColor", self.scaleColorInst.r, self.scaleColorInst.g, self.scaleColorInst.b)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function IceUnitBar.prototype:SetScaledColor(percent, maxColor, minColor)
|
function IceUnitBar.prototype:SetScaledColor(colorVar, percent, maxColor, minColor)
|
||||||
if( not self.scaleColorInst ) then
|
colorVar.r = ((maxColor.r - minColor.r) * percent) + minColor.r
|
||||||
self.scaleColorInst = { r = 0, g = 0, b = 0 }
|
colorVar.g = ((maxColor.g - minColor.g) * percent) + minColor.g
|
||||||
end
|
colorVar.b = ((maxColor.b - minColor.b) * percent) + minColor.b
|
||||||
|
|
||||||
self.scaleColorInst.r = ((maxColor.r - minColor.r) * percent) + minColor.r
|
|
||||||
self.scaleColorInst.g = ((maxColor.g - minColor.g) * percent) + minColor.g
|
|
||||||
self.scaleColorInst.b = ((maxColor.b - minColor.b) * percent) + minColor.b
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user