PHP код:
function SetupNamplate(self)
local frame = CreateFrame("frame",nil,self,"SecureHandlerShowHideTemplate")
local healthbar,manabar = self:GetChildren()
frame:SetFrameRef("self",self)
frame:SetAttribute("_onshow",[[
self:GetFrameRef("self"):Hide()
]])
end
local function IsNamePlate(obj)
if obj:GetName() then return end
if obj.GetRegions then
local reg = obj:GetRegions()
if reg and reg.GetTexture then
return reg:GetTexture()==[[Interface\TargetingFrame\UI-TargetingFrame-Flash]]
end
end
end
local WorldFrame = WorldFrame
local lastNumChildren,total = 1,0
CreateFrame("frame"):SetScript("OnUpdate",function(self,elapsed)
if lastNumChildren~=WorldFrame:GetNumChildren() then
for _,obj in next,{WorldFrame:GetChildren()},lastNumChildren do
if IsNamePlate(obj) then
SetupNamplate(obj)
end
end
lastNumChildren = WorldFrame:GetNumChildren()
end
end)