Version 0.4

- New bar type
- More configuration options
This commit is contained in:
iceroth
2006-08-06 05:45:56 +00:00
parent 0887e36186
commit 2f51443091
15 changed files with 568 additions and 177 deletions

View File

@ -3,17 +3,10 @@ local AceOO = AceLibrary("AceOO-2.0")
IceBarElement = AceOO.Class(IceElement) IceBarElement = AceOO.Class(IceElement)
IceBarElement.virtual = true IceBarElement.virtual = true
IceBarElement.BackgroundAlpha = 0.25
IceBarElement.TexturePath = IceHUD.Location .. "\\textures\\" IceBarElement.TexturePath = IceHUD.Location .. "\\textures\\"
IceBarElement.BackgroundTexture = IceHUD.Location .. "\\textures\\HiBarBG"
IceBarElement.BarProportion = 0.36
IceBarElement.BarTextureWidth = 128 IceBarElement.BarTextureWidth = 128
IceBarElement.prototype.barFrame = nil IceBarElement.prototype.barFrame = nil
IceBarElement.prototype.width = nil
IceBarElement.prototype.height = nil
IceBarElement.prototype.backgroundAlpha = nil
IceBarElement.prototype.combat = nil IceBarElement.prototype.combat = nil
@ -23,20 +16,17 @@ IceBarElement.prototype.combat = nil
function IceBarElement.prototype:init(name) function IceBarElement.prototype:init(name)
IceBarElement.super.prototype.init(self, name) IceBarElement.super.prototype.init(self, name)
self.width = 77 self:SetColor("background", 50, 50, 50)
self.height = 154
self.backgroundAlpha = IceBarElement.BackgroundAlpha
end end
-- 'Public' methods ----------------------------------------------------------- -- 'Public' methods -----------------------------------------------------------
-- OVERRIDE -- OVERRIDE
function IceBarElement.prototype:Enable() function IceBarElement.prototype:Enable()
IceBarElement.super.prototype.Enable(self) IceBarElement.super.prototype.Enable(self)
self:RegisterEvent("PLAYER_REGEN_DISABLED", "InCombat") self:RegisterEvent("PLAYER_REGEN_DISABLED", "InCombat")
self:RegisterEvent("PLAYER_REGEN_ENABLED", "OutCombat") self:RegisterEvent("PLAYER_REGEN_ENABLED", "OutCombat")
self:RegisterEvent("PLAYER_ENTERING_WORLD", "CheckCombat") self:RegisterEvent("PLAYER_ENTERING_WORLD", "CheckCombat")
@ -133,25 +123,25 @@ function IceBarElement.prototype:CreateBackground()
end end
self.frame:SetFrameStrata("BACKGROUND") self.frame:SetFrameStrata("BACKGROUND")
self.frame:SetWidth(self.width) self.frame:SetWidth(self.settings.barWidth)
self.frame:SetHeight(self.height) self.frame:SetHeight(self.settings.barHeight)
if not (self.frame.bg) then if not (self.frame.bg) then
self.frame.bg = self.frame:CreateTexture(nil, "BACKGROUND") self.frame.bg = self.frame:CreateTexture(nil, "BACKGROUND")
end end
self.frame.bg:SetTexture(IceBarElement.BackgroundTexture) self.frame.bg:SetTexture(IceBarElement.TexturePath .. self.settings.barTexture.."BG")
self.frame.bg:ClearAllPoints() self.frame.bg:ClearAllPoints()
self.frame.bg:SetAllPoints(self.frame) self.frame.bg:SetAllPoints(self.frame)
if (self.moduleSettings.side == IceCore.Side.Left) then if (self.moduleSettings.side == IceCore.Side.Left) then
self.frame.bg:SetTexCoord(1, 0, 0, 1) self.frame.bg:SetTexCoord(1, 0, 0, 1)
else else
self.frame.bg:SetTexCoord(1, 0, 1, 0) self.frame.bg:SetTexCoord(0, 1, 0, 1)
end end
self.frame:SetStatusBarTexture(self.frame.bg) self.frame:SetStatusBarTexture(self.frame.bg)
self.frame:SetStatusBarColor(self:GetColor("undef", self.backgroundAlpha)) self.frame:SetStatusBarColor(self:GetColor("undef", self.settings.alphabg))
local ownPoint = "LEFT" local ownPoint = "LEFT"
if (self.moduleSettings.side == ownPoint) then if (self.moduleSettings.side == ownPoint) then
@ -159,8 +149,8 @@ function IceBarElement.prototype:CreateBackground()
end end
-- ofxx = (bar width) + (extra space in between the bars) -- ofxx = (bar width) + (extra space in between the bars)
local offx = (IceBarElement.BarProportion * self.width * self.moduleSettings.offset) local offx = (self.settings.barProportion * self.settings.barWidth * self.moduleSettings.offset)
+ (self.moduleSettings.offset * 5) + (self.moduleSettings.offset * self.settings.barSpace)
if (self.moduleSettings.side == IceCore.Side.Left) then if (self.moduleSettings.side == IceCore.Side.Left) then
offx = offx * -1 offx = offx * -1
end end
@ -177,8 +167,8 @@ function IceBarElement.prototype:CreateBar()
end end
self.barFrame:SetFrameStrata("BACKGROUND") self.barFrame:SetFrameStrata("BACKGROUND")
self.barFrame:SetWidth(self.width) self.barFrame:SetWidth(self.settings.barWidth)
self.barFrame:SetHeight(self.height) self.barFrame:SetHeight(self.settings.barHeight)
if not (self.barFrame.bar) then if not (self.barFrame.bar) then
@ -203,8 +193,8 @@ end
function IceBarElement.prototype:CreateTexts() function IceBarElement.prototype:CreateTexts()
self.frame.bottomUpperText = self:FontFactory(nil, self.settings.barFontSize, nil, self.frame.bottomUpperText) self.frame.bottomUpperText = self:FontFactory(self.settings.barFontBold, self.settings.barFontSize, nil, self.frame.bottomUpperText)
self.frame.bottomLowerText = self:FontFactory(nil, self.settings.barFontSize, nil, self.frame.bottomLowerText) self.frame.bottomLowerText = self:FontFactory(self.settings.barFontBold, self.settings.barFontSize, nil, self.frame.bottomLowerText)
self.frame.bottomUpperText:SetWidth(80) self.frame.bottomUpperText:SetWidth(80)
self.frame.bottomLowerText:SetWidth(120) self.frame.bottomLowerText:SetWidth(120)
@ -232,10 +222,10 @@ function IceBarElement.prototype:CreateTexts()
local parentPoint = self:Flip(self.moduleSettings.side) local parentPoint = self:Flip(self.moduleSettings.side)
local offx = 2 local offx = 0
-- adjust offset for bars where text is aligned to the outer side -- adjust offset for bars where text is aligned to the outer side
if (self.moduleSettings.offset <= 1) then if (self.moduleSettings.offset <= 1) then
offx = IceBarElement.BarProportion * self.width - offx offx = self.settings.barProportion * self.settings.barWidth - offx
end end
@ -248,6 +238,18 @@ function IceBarElement.prototype:CreateTexts()
self.frame.bottomUpperText:SetPoint("TOP"..ownPoint , self.frame, "BOTTOM"..parentPoint, offx, -1) self.frame.bottomUpperText:SetPoint("TOP"..ownPoint , self.frame, "BOTTOM"..parentPoint, offx, -1)
self.frame.bottomLowerText:SetPoint("TOP"..ownPoint , self.frame, "BOTTOM"..parentPoint, offx, -15) self.frame.bottomLowerText:SetPoint("TOP"..ownPoint , self.frame, "BOTTOM"..parentPoint, offx, -15)
if (self.settings.textVisible["upper"]) then
self.frame.bottomUpperText:Show()
else
self.frame.bottomUpperText:Hide()
end
if (self.settings.textVisible["lower"]) then
self.frame.bottomLowerText:Show()
else
self.frame.bottomLowerText:Hide()
end
end end
@ -273,7 +275,8 @@ function IceBarElement.prototype:UpdateBar(scale, color, alpha)
alpha = alpha or 1 alpha = alpha or 1
self.frame:SetAlpha(alpha) self.frame:SetAlpha(alpha)
self.frame:SetStatusBarColor(self:GetColor(color, self.alpha)) local c = self.settings.backgroundColor
self.frame:SetStatusBarColor(c.r, c.g, c.b, self.settings.alphabg)
self.barFrame:SetStatusBarColor(self:GetColor(color)) self.barFrame:SetStatusBarColor(self:GetColor(color))
@ -284,6 +287,10 @@ end
-- Bottom line 1 -- Bottom line 1
function IceBarElement.prototype:SetBottomText1(text, color) function IceBarElement.prototype:SetBottomText1(text, color)
if not (self.settings.textVisible["upper"]) and not (self.moduleSettings.alwaysShowText) then
return
end
if not (color) then if not (color) then
color = "text" color = "text"
end end
@ -309,6 +316,10 @@ end
-- Bottom line 2 -- Bottom line 2
function IceBarElement.prototype:SetBottomText2(text, color, alpha) function IceBarElement.prototype:SetBottomText2(text, color, alpha)
if not (self.settings.textVisible["lower"]) and not (self.moduleSettings.alwaysShowText) then
return
end
if not (color) then if not (color) then
color = "text" color = "text"
end end
@ -341,10 +352,8 @@ end
function IceBarElement.prototype:Update() function IceBarElement.prototype:Update()
if (self.combat) then if (self.combat) then
self.alpha = self.settings.alphaic self.alpha = self.settings.alphaic
self.backgroundAlpha = IceBarElement.BackgroundAlpha
else else
self.alpha = self.settings.alphaooc self.alpha = self.settings.alphaooc
self.backgroundAlpha = IceBarElement.BackgroundAlpha
end end
end end

View File

@ -14,7 +14,7 @@ IceCore.prototype.settings = nil
IceCore.prototype.IceHUDFrame = nil IceCore.prototype.IceHUDFrame = nil
IceCore.prototype.elements = {} IceCore.prototype.elements = {}
IceCore.prototype.enabled = nil IceCore.prototype.enabled = nil
IceCore.prototype.presets = {}
-- Constructor -- -- Constructor --
function IceCore.prototype:init() function IceCore.prototype:init()
@ -30,19 +30,30 @@ function IceCore.prototype:init()
self:RegisterEvent(IceCore.RegisterModule, "Register") self:RegisterEvent(IceCore.RegisterModule, "Register")
self:TriggerEvent(IceCore.Loaded) self:TriggerEvent(IceCore.Loaded)
-- DEFAULT SETTINGS -- DEFAULT SETTINGS
local defaultPreset = "RoundBar"
local defaults = { local defaults = {
gap = 150, gap = 150,
verticalPos = -150, verticalPos = -150,
scale = 1, scale = 1,
alphaooc = 0.3, alphaooc = 0.3,
alphaic = 0.6, alphaic = 0.6,
alphabg = 0.2,
backgroundColor = {r = 0.2, g = 0.2, b = 0.2},
lockTextAlpha = true, lockTextAlpha = true,
barTexture = "Bar", barTexture = "Bar",
barFontSize = 13, barFontSize = 13,
textVisible = {upper = true, lower = true},
barPreset = defaultPreset,
debug = false
} }
self:LoadPresets()
for k, v in pairs(self.presets[defaultPreset]) do
defaults[k] = v
end
-- get default settings from the modules -- get default settings from the modules
defaults.modules = {} defaults.modules = {}
for i = 1, table.getn(self.elements) do for i = 1, table.getn(self.elements) do
@ -158,6 +169,7 @@ end
function IceCore.prototype:SetGap(value) function IceCore.prototype:SetGap(value)
self.settings.gap = value self.settings.gap = value
self.IceHUDFrame:SetWidth(self.settings.gap) self.IceHUDFrame:SetWidth(self.settings.gap)
self:Redraw()
end end
@ -189,6 +201,27 @@ function IceCore.prototype:SetAlphaIC(value)
end end
function IceCore.prototype:GetAlphaBG()
return self.settings.alphabg
end
function IceCore.prototype:SetAlphaBG(value)
self.settings.alphabg = value
self:Redraw()
end
function IceCore.prototype:GetBackgroundColor()
local c = self.settings.backgroundColor
return c.r, c.g, c.b
end
function IceCore.prototype:SetBackgroundColor(r, g, b)
self.settings.backgroundColor.r = r
self.settings.backgroundColor.g = g
self.settings.backgroundColor.b = b
self:Redraw()
end
function IceCore.prototype:GetLockTextAlpha() function IceCore.prototype:GetLockTextAlpha()
return self.settings.lockTextAlpha return self.settings.lockTextAlpha
end end
@ -207,6 +240,24 @@ function IceCore.prototype:SetBarFontSize(value)
end end
function IceCore.prototype:GetBarFontBold()
return self.settings.barFontBold
end
function IceCore.prototype:SetBarFontBold(value)
self.settings.barFontBold = value
self:Redraw()
end
function IceCore.prototype:GetTextVisibility(text)
return self.settings.textVisible[text]
end
function IceCore.prototype:SetTextVisibility(text, value)
self.settings.textVisible[text] = value
self:Redraw()
end
function IceCore.prototype:GetBarTexture() function IceCore.prototype:GetBarTexture()
return self.settings.barTexture return self.settings.barTexture
end end
@ -215,3 +266,98 @@ function IceCore.prototype:SetBarTexture(value)
self:Redraw() self:Redraw()
end end
function IceCore.prototype:GetBarWidth()
return self.settings.barWidth
end
function IceCore.prototype:SetBarWidth(value)
self.settings.barWidth = value
self:Redraw()
end
function IceCore.prototype:GetBarHeight()
return self.settings.barHeight
end
function IceCore.prototype:SetBarHeight(value)
self.settings.barHeight = value
self:Redraw()
end
function IceCore.prototype:GetBarProportion()
return self.settings.barProportion
end
function IceCore.prototype:SetBarProportion(value)
self.settings.barProportion = value
self:Redraw()
end
function IceCore.prototype:GetBarSpace()
return self.settings.barSpace
end
function IceCore.prototype:SetBarSpace(value)
self.settings.barSpace = value
self:Redraw()
end
function IceCore.prototype:GetBarPreset()
return self.settings.barPreset
end
function IceCore.prototype:SetBarPreset(value)
self.settings.barPreset = value
self:ChangePreset(value)
self:Redraw()
end
function IceCore.prototype:ChangePreset(value)
self:SetBarTexture(self.presets[value].barTexture)
self:SetBarHeight(self.presets[value].barHeight)
self:SetBarWidth(self.presets[value].barWidth)
self:SetBarSpace(self.presets[value].barSpace)
self:SetBarProportion(self.presets[value].barProportion)
end
function IceCore.prototype:GetDebug()
return self.settings.debug
end
function IceCore.prototype:SetDebug(value)
self.settings.debug = value
IceHUD:SetDebugging(value)
end
-------------------------------------------------------------------------------
-- Presets --
-------------------------------------------------------------------------------
function IceCore.prototype:LoadPresets()
self.presets["Bar"] = {
barTexture = "Bar",
barWidth = 63,
barHeight = 150,
barProportion = 0.34,
barSpace = 4,
}
self.presets["HiBar"] = {
barTexture = "HiBar",
barWidth = 63,
barHeight = 150,
barProportion = 0.34,
barSpace = 4,
}
self.presets["RoundBar"] = {
barTexture = "RoundBar",
barWidth = 155,
barHeight = 220,
barProportion = 0.14,
barSpace = 1,
}
end

View File

@ -174,8 +174,11 @@ end
function IceElement.prototype:FontFactory(weight, size, frame, font) function IceElement.prototype:FontFactory(weight, size, frame, font)
weight = weight or "" local weightString = ""
local fontFile = IceHUD.Location .. "\\fonts\\Calibri" .. weight ..".ttf" if (weight) then
weightString = "Bold"
end
local fontFile = IceHUD.Location .. "\\fonts\\Calibri" .. weightString ..".ttf"
if not (frame) then if not (frame) then
frame = self.frame frame = self.frame

View File

@ -14,143 +14,319 @@ IceHUD.options =
order = 10 order = 10
}, },
vpos = { positioningSettings = {
type = 'range', type = 'group',
name = 'Vertical position', name = 'Positioning Settings',
desc = 'Vertical position', desc = 'Settings related to positioning and alpha',
get = function() order = 11,
return IceHUD.IceCore:GetVerticalPos() args = {
end, vpos = {
set = function(v) type = 'range',
IceHUD.IceCore:SetVerticalPos(v) name = 'Vertical position',
end, desc = 'Vertical position',
min = -300, get = function()
max = 300, return IceHUD.IceCore:GetVerticalPos()
step = 10, end,
order = 11 set = function(v)
IceHUD.IceCore:SetVerticalPos(v)
end,
min = -300,
max = 300,
step = 10,
order = 11
},
gap = {
type = 'range',
name = 'Gap',
desc = 'Distance between the left and right bars',
get = function()
return IceHUD.IceCore:GetGap()
end,
set = function(v)
IceHUD.IceCore:SetGap(v)
end,
min = 50,
max = 300,
step = 5,
order = 12,
},
scale = {
type = 'range',
name = 'Scale',
desc = 'HUD scale',
get = function()
return IceHUD.IceCore:GetScale()
end,
set = function(v)
IceHUD.IceCore:SetScale(v)
end,
min = 0.5,
max = 1.5,
step = 0.05,
isPercent = true,
order = 13,
},
}
}, },
gap = {
type = 'range', alphaSettings = {
name = 'Gap', type = 'group',
desc = 'Distance between the left and right bars', name = 'Transparency Settings',
get = function() desc = 'Settings for bar transparencies',
return IceHUD.IceCore:GetGap()
end,
set = function(v)
IceHUD.IceCore:SetGap(v)
end,
min = 50,
max = 300,
step = 5,
order = 12, order = 12,
args = {
alphaic = {
type = 'range',
name = 'Alpha IC',
desc = 'Bar alpha In Combat',
get = function()
return IceHUD.IceCore:GetAlphaIC()
end,
set = function(v)
IceHUD.IceCore:SetAlphaIC(v)
end,
min = 0,
max = 1,
step = 0.05,
isPercent = true,
order = 14,
},
alphaooc = {
type = 'range',
name = 'Alpha OOC',
desc = 'Bar alpha Out Of Combat',
get = function()
return IceHUD.IceCore:GetAlphaOOC()
end,
set = function(v)
IceHUD.IceCore:SetAlphaOOC(v)
end,
min = 0,
max = 1,
step = 0.05,
isPercent = true,
order = 15,
},
alphabg = {
type = 'range',
name = 'Background Alpha',
desc = 'Background alpha for bars',
get = function()
return IceHUD.IceCore:GetAlphaBG()
end,
set = function(v)
IceHUD.IceCore:SetAlphaBG(v)
end,
min = 0,
max = 1,
step = 0.05,
isPercent = true,
order = 16,
},
backgroundColor = {
type = 'color',
name = 'Background Color',
desc = 'Background Color',
get = function()
return IceHUD.IceCore:GetBackgroundColor()
end,
set = function(r, g, b)
IceHUD.IceCore:SetBackgroundColor(r, g, b)
end,
},
}
}, },
scale = {
type = 'range',
name = 'Scale',
desc = 'HUD scale',
get = function()
return IceHUD.IceCore:GetScale()
end,
set = function(v)
IceHUD.IceCore:SetScale(v)
end,
min = 0.5,
max = 1.5,
step = 0.05,
order = 13,
},
alphaooc = { textSettings = {
type = 'range', type = 'group',
name = 'Alpha OOC', name = 'Text Settings',
desc = 'Bar alpha Out Of Combat', desc = 'Settings related to texts',
get = function() order = 15,
return IceHUD.IceCore:GetAlphaOOC() args = {
end, fontsize = {
set = function(v) type = 'range',
IceHUD.IceCore:SetAlphaOOC(v) name = 'Bar Font Size',
end, desc = 'Bar Font Size',
min = 0, get = function()
max = 1, return IceHUD.IceCore:GetBarFontSize()
step = 0.05, end,
order = 14, set = function(v)
IceHUD.IceCore:SetBarFontSize(v)
end,
min = 8,
max = 20,
step = 1,
order = 11
},
fontBold = {
type = 'toggle',
name = 'Bar Font Bold',
desc = 'Bar Font Bold',
get = function()
return IceHUD.IceCore:GetBarFontBold()
end,
set = function(v)
IceHUD.IceCore:SetBarFontBold(v)
end,
order = 12
},
lockFontAlpha = {
type = "toggle",
name = "Lock Bar Text Alpha",
desc = "Lock Bar Text Alpha",
get = function()
return IceHUD.IceCore:GetLockTextAlpha()
end,
set = function(value)
IceHUD.IceCore:SetLockTextAlpha(value)
end,
order = 13
},
upperTextVisible = {
type = 'toggle',
name = 'Upper text visible',
desc = 'Toggle upper text visibility',
get = function()
return IceHUD.IceCore:GetTextVisibility("upper")
end,
set = function(v)
IceHUD.IceCore:SetTextVisibility("upper", v)
end,
order = 14
},
lowerTextVisible = {
type = 'toggle',
name = 'Lower text visible',
desc = 'Toggle lower text visibility',
get = function()
return IceHUD.IceCore:GetTextVisibility("lower")
end,
set = function(v)
IceHUD.IceCore:SetTextVisibility("lower", v)
end,
order = 15
},
}
}, },
alphaic = { barSettings = {
type = 'range', type = 'group',
name = 'Alpha IC', name = 'Bar Settings',
desc = 'Bar alpha In Combat', desc = 'Settings related to bars',
get = function() order = 20,
return IceHUD.IceCore:GetAlphaIC() args = {
end, barPresets = {
set = function(v) type = 'text',
IceHUD.IceCore:SetAlphaIC(v) name = 'Presets',
end, desc = 'Predefined settings for different bars',
min = 0, get = function()
max = 1, return IceHUD.IceCore:GetBarPreset()
step = 0.05, end,
order = 15 set = function(value)
}, IceHUD.IceCore:SetBarPreset(value)
end,
alphaooc = { validate = { "Bar", "HiBar", "RoundBar" },
type = 'range', order = 9
name = 'Alpha OOC', },
desc = 'Bar alpha Out Of Combat',
get = function()
return IceHUD.IceCore:GetAlphaOOC() headerBarAdvancedBlank = { type = 'header', name = " ", order = 10 },
end, headerBarAdvanced = {
set = function(v) type = 'header',
IceHUD.IceCore:SetAlphaOOC(v) name = "Advanced Bar Settings",
end, order = 10
min = 0, },
max = 1,
step = 0.05, barTexture = {
order = 16, type = 'text',
}, name = 'Bar Texture',
desc = 'IceHUD Bar Texture',
lockFontAlpha = { get = function()
type = "toggle", return IceHUD.IceCore:GetBarTexture()
name = "Lock Bar Text Alpha", end,
desc = "Lock Bar Text Alpha", set = function(value)
get = function() IceHUD.IceCore:SetBarTexture(value)
return IceHUD.IceCore:GetLockTextAlpha() end,
end, validate = { "Bar", "HiBar", "RoundBar" },
set = function(value) order = 11
IceHUD.IceCore:SetLockTextAlpha(value) },
end,
order = 17 barWidth = {
}, type = 'range',
name = 'Bar Width',
fontsize = { desc = 'Bar texture width (not the actual bar!)',
type = 'range', get = function()
name = 'Bar Font Size', return IceHUD.IceCore:GetBarWidth()
desc = 'Bar Font Size', end,
get = function() set = function(v)
return IceHUD.IceCore:GetBarFontSize() IceHUD.IceCore:SetBarWidth(v)
end, end,
set = function(v) min = 20,
IceHUD.IceCore:SetBarFontSize(v) max = 200,
end, step = 1,
min = 8, order = 12
max = 20, },
step = 1,
order = 18 barHeight = {
}, type = 'range',
name = 'Bar Height',
barTexture = { desc = 'Bar texture height (not the actual bar!)',
type = 'text', get = function()
name = 'Bar Texture', return IceHUD.IceCore:GetBarHeight()
desc = 'IceHUD Bar Texture', end,
get = function() set = function(v)
return IceHUD.IceCore:GetBarTexture() IceHUD.IceCore:SetBarHeight(v)
end, end,
set = function(value) min = 100,
IceHUD.IceCore:SetBarTexture(value) max = 300,
end, step = 1,
validate = { "Bar", "HiBar" }, order = 13
order = 19 },
barProportion = {
type = 'range',
name = 'Bar Proportion',
desc = 'Determines the bar width compared to the whole texture width',
get = function()
return IceHUD.IceCore:GetBarProportion()
end,
set = function(v)
IceHUD.IceCore:SetBarProportion(v)
end,
min = 0.01,
max = 0.5,
step = 0.01,
isPercent = true,
order = 14
},
barSpace = {
type = 'range',
name = 'Bar Space',
desc = 'Space between bars on the same side',
get = function()
return IceHUD.IceCore:GetBarSpace()
end,
set = function(v)
IceHUD.IceCore:SetBarSpace(v)
end,
min = -10,
max = 30,
step = 1,
order = 15
},
}
}, },
@ -205,6 +381,19 @@ IceHUD.options =
order = 92 order = 92
}, },
debug = {
type = "toggle",
name = "Debugging",
desc = "Enable/disable debug messages",
get = function()
return IceHUD.IceCore:GetDebug()
end,
set = function(value)
IceHUD.IceCore:SetDebug(value)
end,
order = 93
},
about = { about = {
type = 'execute', type = 'execute',
name = 'About', name = 'About',
@ -212,7 +401,7 @@ IceHUD.options =
func = function() func = function()
IceHUD:PrintAddonInfo() IceHUD:PrintAddonInfo()
end, end,
order = 93 order = 94
}, },
endSpace = { endSpace = {
@ -258,5 +447,6 @@ function IceHUD:OnEnable()
self:Debug("IceHUD:OnEnable()") self:Debug("IceHUD:OnEnable()")
self.IceCore:Enable() self.IceCore:Enable()
self:SetDebugging(self.IceCore:GetDebug())
end end

View File

@ -3,7 +3,7 @@
## Name: IceHUD ## Name: IceHUD
## Title: IceHUD |cff7fff7f -Ace2-|r ## Title: IceHUD |cff7fff7f -Ace2-|r
## Notes: Another HUD mod ## Notes: Another HUD mod
## Version: 0.3.3 ($Revision$) ## Version: 0.4 ($Revision$)
## SavedVariables: IceCoreDB ## SavedVariables: IceCoreDB
## OptionalDeps: FuBar_ToFu, DruidBar, SoleManax, MobHealth ## OptionalDeps: FuBar_ToFu, DruidBar, SoleManax, MobHealth
## X-Category: UnitFrame ## X-Category: UnitFrame

View File

@ -35,15 +35,35 @@ function CastBar.prototype:GetDefaultSettings()
local settings = CastBar.super.prototype.GetDefaultSettings(self) local settings = CastBar.super.prototype.GetDefaultSettings(self)
settings["side"] = IceCore.Side.Left settings["side"] = IceCore.Side.Left
settings["offset"] = 0 settings["offset"] = 0
settings["alwaysShowText"] = true
return settings return settings
end end
-- OVERRIDE
function CastBar.prototype:GetOptions()
local opts = CastBar.super.prototype.GetOptions(self)
opts["alwaysShowText"] =
{
type = 'toggle',
name = 'Always Show Text',
desc = 'Overrides possible text hiding option',
get = function()
return self.moduleSettings.alwaysShowText
end,
set = function(value)
self.moduleSettings.alwaysShowText = value
self:Redraw()
end,
order = 50
}
return opts
end
function CastBar.prototype:Enable() function CastBar.prototype:Enable()
CastBar.super.prototype.Enable(self) CastBar.super.prototype.Enable(self)
self.frame.bottomUpperText:SetWidth(180)
self:RegisterEvent("SPELLCAST_START", "CastStart") self:RegisterEvent("SPELLCAST_START", "CastStart")
self:RegisterEvent("SPELLCAST_STOP", "CastStop") self:RegisterEvent("SPELLCAST_STOP", "CastStop")
self:RegisterEvent("SPELLCAST_FAILED", "CastFailed") self:RegisterEvent("SPELLCAST_FAILED", "CastFailed")
@ -80,13 +100,23 @@ end
function CastBar.prototype:Redraw() function CastBar.prototype:Redraw()
CastBar.super.prototype.Redraw(self) CastBar.super.prototype.Redraw(self)
self.frame.bottomUpperText:SetWidth(180) if (self.moduleSettings.alwaysShowText) then
self.frame.bottomUpperText:Show()
end
end end
-- 'Protected' methods -------------------------------------------------------- -- 'Protected' methods --------------------------------------------------------
-- OVERRIDE
function CastBar.prototype:CreateFrame()
CastBar.super.prototype.CreateFrame(self)
self.frame.bottomUpperText:SetWidth(self.settings.gap + 30)
end
function CastBar.prototype:OnUpdate() function CastBar.prototype:OnUpdate()
local taken = GetTime() - self.startTime local taken = GetTime() - self.startTime

View File

@ -30,6 +30,7 @@ function PetHealth.prototype:GetOptions()
min = 0.2, min = 0.2,
max = 1, max = 1,
step = 0.05, step = 0.05,
isPercent = true,
get = function() get = function()
return self.moduleSettings.scale return self.moduleSettings.scale
end, end,

View File

@ -24,6 +24,7 @@ function PetMana.prototype:GetOptions()
min = 0.2, min = 0.2,
max = 1, max = 1,
step = 0.05, step = 0.05,
isPercent = true,
get = function() get = function()
return self.moduleSettings.scale return self.moduleSettings.scale
end, end,

View File

@ -85,6 +85,14 @@ function PlayerMana.prototype:Enable()
end end
-- OVERRIDE
function PlayerMana.prototype:Redraw()
PlayerMana.super.prototype.Redraw(self)
self:CreateTickerFrame()
end
function PlayerMana.prototype:ManaType(unit) function PlayerMana.prototype:ManaType(unit)
if (unit ~= self.unit) then if (unit ~= self.unit) then
return return
@ -168,12 +176,13 @@ function PlayerMana.prototype:EnergyTick()
self.tickStart = now self.tickStart = now
end end
local thisTick = elapsed / 2 local pos = elapsed / 2
local x = (thisTick * (self.width - (self.width * IceBarElement.BarProportion))) + 4 local y = pos * (self.settings.barHeight)
local y = thisTick * (self.height - 5)
self.tickerFrame:ClearAllPoints()
self.tickerFrame:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT", x, y) self.tickerFrame.spark:SetTexCoord(0, 1, 1-pos-0.01, 1-pos)
self.tickerFrame:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT", 0, y)
end end
@ -183,14 +192,15 @@ function PlayerMana.prototype:CreateTickerFrame()
end end
self.tickerFrame:SetFrameStrata("BACKGROUND") self.tickerFrame:SetFrameStrata("BACKGROUND")
self.tickerFrame:SetWidth(19) self.tickerFrame:SetWidth(self.settings.barWidth)
self.tickerFrame:SetHeight(1) self.tickerFrame:SetHeight(self.settings.barHeight)
if not (self.tickerFrame.spark) then if not (self.tickerFrame.spark) then
self.tickerFrame.spark = self.tickerFrame:CreateTexture(nil, "BACKGROUND") self.tickerFrame.spark = self.tickerFrame:CreateTexture(nil, "BACKGROUND")
self.tickerFrame:Hide()
end end
self.tickerFrame.spark:SetTexture(self:GetColor("playerEnergy", 1)) self.tickerFrame.spark:SetTexture(IceBarElement.TexturePath .. self.settings.barTexture)
self.tickerFrame.spark:SetBlendMode("ADD") self.tickerFrame.spark:SetBlendMode("ADD")
self.tickerFrame.spark:ClearAllPoints() self.tickerFrame.spark:ClearAllPoints()
self.tickerFrame.spark:SetAllPoints(self.tickerFrame) self.tickerFrame.spark:SetAllPoints(self.tickerFrame)
@ -198,7 +208,8 @@ function PlayerMana.prototype:CreateTickerFrame()
self.tickerFrame:SetStatusBarTexture(self.tickerFrame.spark) self.tickerFrame:SetStatusBarTexture(self.tickerFrame.spark)
self.tickerFrame:SetStatusBarColor(self:GetColor("playerEnergy", self.moduleSettings.tickerAlpha)) self.tickerFrame:SetStatusBarColor(self:GetColor("playerEnergy", self.moduleSettings.tickerAlpha))
self.tickerFrame:Hide() self.tickerFrame:ClearAllPoints()
self.tickerFrame:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT", 0, 0)
end end

Binary file not shown.

BIN
textures/BarBG.blp Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
textures/RoundBar.blp Normal file

Binary file not shown.

BIN
textures/RoundBarBG.blp Normal file

Binary file not shown.