Now I can realize these functions through the following lua code
1.hide and replace player name to "newplayername"
2.hide and replace pet name to "newpetname"
3.hide and replace target of target name
4.hide and replace target of focus name
5.replace friend and enemy player name to their classic name
the following lua code:
----------------------------------------------------------------
local CUSTOM_PLAYER_TEXT = "newplayername"
local CUSTOM_PET_TEXT = "newpetname"
local function SetCustomName(unit, fontString)
if UnitIsUnit(unit, "player") then
fontString:SetText(CUSTOM_PLAYER_TEXT)
elseif UnitIsPlayer(unit) then
fontString:SetText(strupper(UnitClass(unit)))
else
fontString:SetText(CUSTOM_PET_TEXT)
end
end
hooksecurefunc("UnitFrame_Update", function(frame, isParty)
if frame.name then
SetCustomName(frame.overrideName or frame.unit, frame.name)
end
end)