unitframes: rework hide mechanics

This commit is contained in:
shagu
2017-09-04 21:53:56 +02:00
parent e93b52c2ba
commit 48cebd03e2
+21 -11
View File
@@ -541,14 +541,6 @@ function pfUI.uf:RefreshUnit(unit, component)
-- break early on misconfigured UF's
if not unit.label then return end
-- hide self in group
if unit.fname == "Group0" or unit.fname == "PartyPet0" or unit.fname == "Party0Target" then
if GetNumPartyMembers() <= 0 then
unit:Hide()
return
end
end
if unit.label == "target" or unit.label == "targettarget" then
if pfScanActive == true then return end
end
@@ -565,17 +557,35 @@ function pfUI.uf:RefreshUnit(unit, component)
unit.lastUnit = UnitName(unit.label .. unit.id)
end
-- hide and return early on unused frames
if not ( pfUI.unlock and pfUI.unlock:IsShown() ) then
if UnitName(unit.label .. unit.id) or unit.unitname then
-- check existing units or focus frames
if unit.unitname then
unit:Show()
elseif UnitName(unit.label .. unit.id) then
-- hide group while in raid and option is set
if pfUI_config["unitframes"]["group"]["hide_in_raid"] == "1" and strsub(unit.label,0,5) == "party" and UnitInRaid("player") then
unit:Hide()
return
-- hide existing but too far away pet
elseif strsub(unit.label,0,8) == "partypet" and not UnitIsVisible(unit.label .. unit.id) then
unit:Hide()
else
unit:Show()
return
-- hide self in group if solo or hide in raid is set
elseif unit.fname == "Group0" or unit.fname == "PartyPet0" or unit.fname == "Party0Target" then
if ( GetNumPartyMembers() <= 0 ) or ( pfUI_config["unitframes"]["group"]["hide_in_raid"] == "1" and UnitInRaid("player") ) then
unit:Hide()
return
end
end
unit:Show()
else
-- hide unused frame
unit:Hide()
return
end
end