mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 14:50:13 -05:00
- fixed the mirror bar: changed function declaration "class.new" to "class:new" in IceCore_CreateClass so that "self" doesn't get included in ... when init is called. this was causing an off-by-one error in the order of parameters passed to mirrorbar's "init" method and surprisingly didn't break anything else (looks like judicious use of 'ifs' in some defensive coding saved the rest of the modules); thanks to mitch0 for the report
- added an argument to IceElement's init function that allows modules to skip the registration with the core. mirrorbars need this since they are created on demand and not saved with the rest of the bars
This commit is contained in:
@ -19,8 +19,8 @@ local lastMarkerHeightConfig = 6
|
|||||||
local lastEditMarkerConfig = 1
|
local lastEditMarkerConfig = 1
|
||||||
|
|
||||||
-- Constructor --
|
-- Constructor --
|
||||||
function IceBarElement.prototype:init(name)
|
function IceBarElement.prototype:init(name, ...)
|
||||||
IceBarElement.super.prototype.init(self, name)
|
IceBarElement.super.prototype.init(self, name, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ function IceCore_CreateClass(parent)
|
|||||||
setmetatable(class.prototype, { __index = parent.prototype })
|
setmetatable(class.prototype, { __index = parent.prototype })
|
||||||
end
|
end
|
||||||
local mt = { __index = class.prototype }
|
local mt = { __index = class.prototype }
|
||||||
function class.new(...)
|
function class:new(...)
|
||||||
local self = setmetatable({}, mt)
|
local self = setmetatable({}, mt)
|
||||||
if self.init then
|
if self.init then
|
||||||
self:init(...)
|
self:init(...)
|
||||||
|
@ -28,7 +28,7 @@ IceElement.prototype.bIsVisible = true
|
|||||||
-- IceElements are to be instantiated before IceCore is loaded.
|
-- IceElements are to be instantiated before IceCore is loaded.
|
||||||
-- Therefore we can wait for IceCore to load and then register our
|
-- Therefore we can wait for IceCore to load and then register our
|
||||||
-- module to the core with another event.
|
-- module to the core with another event.
|
||||||
function IceElement.prototype:init(name)
|
function IceElement.prototype:init(name, skipRegister)
|
||||||
assert(name, "IceElement must have a name")
|
assert(name, "IceElement must have a name")
|
||||||
|
|
||||||
self.elementName = name
|
self.elementName = name
|
||||||
@ -42,8 +42,10 @@ function IceElement.prototype:init(name)
|
|||||||
LibStub("AceEvent-3.0"):Embed(self)
|
LibStub("AceEvent-3.0"):Embed(self)
|
||||||
LibStub("AceTimer-3.0"):Embed(self)
|
LibStub("AceTimer-3.0"):Embed(self)
|
||||||
|
|
||||||
|
if not skipRegister then
|
||||||
IceHUD:Register(self)
|
IceHUD:Register(self)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- 'Public' methods -----------------------------------------------------------
|
-- 'Public' methods -----------------------------------------------------------
|
||||||
|
@ -18,7 +18,7 @@ MirrorBar.prototype.label = nil
|
|||||||
|
|
||||||
-- Constructor --
|
-- Constructor --
|
||||||
function MirrorBar.prototype:init(side, offset, name, db)
|
function MirrorBar.prototype:init(side, offset, name, db)
|
||||||
MirrorBar.super.prototype.init(self, name)
|
MirrorBar.super.prototype.init(self, name, true)
|
||||||
self.settings = db
|
self.settings = db
|
||||||
self.moduleSettings = {}
|
self.moduleSettings = {}
|
||||||
self.moduleSettings.side = side
|
self.moduleSettings.side = side
|
||||||
@ -29,10 +29,6 @@ function MirrorBar.prototype:init(side, offset, name, db)
|
|||||||
self.moduleSettings.barVerticalOffset = 0
|
self.moduleSettings.barVerticalOffset = 0
|
||||||
-- avoid nil warnings here
|
-- avoid nil warnings here
|
||||||
self.moduleSettings.myTagVersion = IceHUD.CurrTagVersion
|
self.moduleSettings.myTagVersion = IceHUD.CurrTagVersion
|
||||||
|
|
||||||
-- unregister the event superclass registered, we don't want to register
|
|
||||||
-- this to the core
|
|
||||||
self:UnregisterEvent(IceCore.Loaded)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user