Add support for hiding unit frames in raid groups
This commit is contained in:
@@ -46,31 +46,28 @@ function CreateRaidFrames(left, top, width, height)
|
||||
frame:SetPosition(left + (j-2)*width, top - i*height)
|
||||
end
|
||||
end
|
||||
|
||||
local player = UnitFrame:new("player", width, height)
|
||||
player:SetPosition(left-3*width - 50, top)
|
||||
local target = UnitFrame:new("target", width, height)
|
||||
target:SetPosition(left+3*width + 50, top)
|
||||
end
|
||||
|
||||
function CreatePartyFrames(left, top, width, height)
|
||||
local player = UnitFrame:new("player", width, height)
|
||||
local player = UnitFrame:new("player", width, height, true)
|
||||
player:SetPosition(-2*width, top)
|
||||
for i=1,4 do
|
||||
local frame = UnitFrame:new("party" .. i, width, height)
|
||||
local frame = UnitFrame:new("party" .. i, width, height, true)
|
||||
frame:SetPosition((i-2)*width, top)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function CreateTargetFrames(left, top, width, height)
|
||||
local target = UnitFrame:new("target", width, height)
|
||||
target:SetPosition(3*width + 50, top)
|
||||
target:SetPosition(left, top)
|
||||
local focus = UnitFrame:new("focus", width, height)
|
||||
focus:SetPosition(3*width + 50, top - height)
|
||||
focus:SetPosition(left, top-height)
|
||||
end
|
||||
|
||||
function CreateFrames()
|
||||
CreatePartyFrames(0, -290, 110, 45)
|
||||
--CreateRaidFrames(-850, 400, 110, 45)
|
||||
--CreateRaidFrames(0, -290, 100, 45)
|
||||
CreateRaidFrames(0, -290, 110, 45)
|
||||
CreateTargetFrames(110*3+50, -290, 110, 45)
|
||||
HideBlizzardFrames()
|
||||
end
|
||||
omif.SetEventHandler("OMICRON_LOADING", CreateFrames)
|
||||
|
@@ -43,8 +43,9 @@ local colors = {
|
||||
white = {1.0, 1.0, 1.0}
|
||||
}
|
||||
|
||||
function UnitFrame:Init(unit, width, height)
|
||||
function UnitFrame:Init(unit, width, height, hideInRaid)
|
||||
self.unit = unit
|
||||
self.hideInRaid = hideInRaid or false
|
||||
local secure = self:CreateSecureFrame(width, height)
|
||||
secure:Hide()
|
||||
self.hp = StatusBar:new(self, width, height)
|
||||
@@ -187,8 +188,13 @@ function UnitFrame:CreateSecureFrame(width, height)
|
||||
end
|
||||
|
||||
function UnitFrame:Enable()
|
||||
if self.unit ~= "player" then
|
||||
RegisterUnitWatch(self.secureFrame)
|
||||
local secure = self.secureFrame
|
||||
if self.hideInRaid then
|
||||
local condition = "[@UNIT,exists,nogroup:raid] show; hide"
|
||||
condition = condition:gsub("@UNIT", "@" .. self.unit)
|
||||
RegisterAttributeDriver(secure, "state-visibility", condition)
|
||||
elseif self.unit ~= "player" then
|
||||
RegisterUnitWatch(self.secureFrame, false)
|
||||
else
|
||||
self.secureFrame:Show()
|
||||
end
|
||||
@@ -198,8 +204,10 @@ function UnitFrame:Enable()
|
||||
end
|
||||
|
||||
function UnitFrame:Disable()
|
||||
if self.unit ~= "player" then
|
||||
UnregisterUnitWatch(self.secure_frame)
|
||||
if self.hideInRaid then
|
||||
UnregisterAttributeDriver(self.secureFrame, "state-visibility")
|
||||
elseif self.unit ~= "player" then
|
||||
UnregisterUnitWatch(self.secure_frame, self.condition)
|
||||
else
|
||||
self.secureFrame:Hide()
|
||||
end
|
||||
|
Reference in New Issue
Block a user