LUACN论坛

 找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
热搜: YJWOW MagicStone BoL
查看: 1115|回复: 14

OUF入门技术指南

[复制链接]
发表于 2015-8-13 21:02:51 | 显示全部楼层 |阅读模式
oUF UI

____________________________________________________________________________________________________________________________________________________________



|| 摘要:


oUF是一款由国外玩家haste编写的自定义很强的头像插件....它不像Pitbull、Xperl等头像插件那样有复杂的设置界面,它的布局完全是通过自定义layout文件


来实现的. 没有命令设置, 比较适合对代码有所了解,E文马马虎虎的中高级玩家。当然。不会修改的玩家也可以通过直接下载别人设置好的layout文件来享受


|| 常用的一些代码设置

CENTER 中心点
TOPLEFT 屏幕左上
TOPRIGHT 屏幕右上
BOTTOMLEFT 屏幕左下
BOTTOMRIGHT 屏幕右下 先确定你要修改的窗体位置,再确定你要改动到目标位置的参数
偏移量 0(X坐标、横向), 0(Y坐标、纵向)
如:player:SetPoint("CENTER", -100, 100)
玩家窗体:窗体为屏幕中心点横向-100 纵向100处。

坐标可以依靠目测或者工具插件显示网格Align(http://wowui.duowan.com/html/AddOns/d/20070903/533.html)辅助获得



实例:oUF_Asym头像框体代码
-- ------------------------------------------------------------------------
-- spawning the frames
-- ------------------------------------------------------------------------
--
-- normal frames
--
oUF:RegisterStyle("Asym", func)
oUF:SetActiveStyle("Asym")
local player = oUF:Spawn("player", "oUF_Player")
player:SetPoint("CENTER", 0, -260) --自己头像的位置,为屏幕中心点横向不变纵向-260处
local target = oUF:Spawn("target", "oUF_Target")
target:SetPoint("CENTER", 270, -152) --目标头像的位置,为屏幕中心点横向270纵向-152处
local pet = oUF:Spawn("pet", "oUF_Pet")
pet:SetPoint("RIGHT", player, 270, -11) --宠物头像的位置,以玩家框体为参照横向270纵向-11处
local tot = oUF:Spawn("targettarget", "oUF_TargetTarget")
tot:SetPoint("BOTTOMRIGHT", target, 0, -40) --目标头像的位置,以target窗体为参照横向不变纵向-40处
local focus = oUF:Spawn("focus", "oUF_Focus")
focus:SetPoint("RIGHT", player, 270, 40) --焦点头像的位置,以玩家框体为参照横向270纵向40处

Tip:窗体跟随
如:pettarget:SetPoint("TOPRIGHT", player, "BOTTOMRIGHT", 0, -20 )
表示 宠物窗体 跟随玩家窗体 位置在玩家窗体右下方 ,0 -20 是以玩家窗体的为基准的一个偏移量!如我修改的焦点,原版是不跟随的,但我修改为
focus:SetPoint("TOPLEFT", player, "TOPLEFT", 0, 50) 就变成了焦点跟随玩家窗体左上方


----------------------------
队友设置
----------------------------
local party = oUF:Spawn("party")
party:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 15, -200) 偏移量及位置

party:SetManyAttributes("showParty", true, "yOffset", -50) "showParty", true是否显示小队、"yOffset"延伸方向及间距 (这里的意思就是指以Y轴方向往下间距50依次排列)
party:SetAttribute("showRaid", false) 将团队显示与小队显示在一起,即true为团队时在小队后面递增添加团队模块....false只显示小队不显示团队

----------------------------
队友目标设置
----------------------------
local party1target = oUF:Spawn("party1target")
party1target:SetPoint("LEFT", oUF_PartyUnitButton1, "RIGHT", 10, 1)
party1target:SetHeight(10)
party1target:SetWidth(80)

local party2target = oUF:Spawn("party2target")
party2target:SetPoint("LEFT", oUF_PartyUnitButton1, "RIGHT", 10, -76)
party2target:SetHeight(10)
party2target:SetWidth(80)

local party3target = oUF:Spawn("party3target")
party3target:SetPoint("LEFT", oUF_PartyUnitButton1, "RIGHT", 10, -151)
party3target:SetHeight(10)
party3target:SetWidth(80)

local party4target = oUF:Spawn("party4target")
party4target:SetPoint("LEFT", oUF_PartyUnitButton1, "RIGHT", 10, -226)
party4target:SetHeight(10)
party4target:SetWidth(80) (由此我们看出队友目标在队友右方,间隔依次为往下75 ,稍微比队友间隔大些,效果基本上是目标在队友框体偏下方)


实例:oUF_Asym小队框体代码

--
-- party
--
local party = oUF:Spawn("header", "oUF_Party")
party:SetManyAttributes("showParty", true, "yOffset", -58) --显示小队框体,以Y轴往下依次间隔58
party:SetPoint("LEFT", 70, -50) -- default ("LEFT", 70, -50) --坐标以屏幕左方为基准,横向70,纵向-50处
party:Show()



--2D头像 (添加在layout代码中,即可实现添加2D头像)
local portrait = self:CreateTexture(nil, "OVERLAY")
portrait.type = "2D"
portrait:SetTexCoord(0.14644660941, 0.85355339059, 0.14644660941, 0.85355339059)
portrait:SetWidth(35) -- 头像宽度
portrait:SetHeight(35) -- 头像高度
if (unit == "target") then --- 如果鼠标指向为目标,即在右边显示2D头像
portrait:SetPoint("RIGHT", 36, 0) --头像的位置
elseif (unit == "player" or self:GetParent():GetName() == "oUF_Party") then -- 如果选中为玩家自己,即在左边显示2D头像
portrait:SetPoint("LEFT", -36, 0) -- 头像的位置
end
self.Portrait = portrait

--3D头像 (代码同2D头像)
local portrait = CreateFrame("layerModel", nil, self)
portrait:SetFrameStrata"MEDIUM"
portrait.type = "3D"
portrait:SetLight(1, 0, 0, -0.707, -0.707, 0.7, 1.0, 1.0, 1.0, 0.8, 1.0, 1.0, 0.8)
portrait:SetWidth(35)
portrait:SetHeight(35)
if (unit == "targe
t") then portrait:SetPoint("RIGHT", 36, 0) elseif (unit == "player" or self:GetParent():GetName() == "oUF_Party") then
portrait:SetPoint("LEFT", -36, 0)
end
self.Portrait = portrait


实例: oUF_Asym添加3D头像框体代码

-----------------------------------------------------------------------------
-- Portrait --添加玩家3D头像(效果如图)
-----------------------------------------------------------------------------


local portrait = CreateFrame("layerModel", nil, self)
portrait:SetScript("OnShow", function(self) self:SetCamera(0) end)
portrait:SetWidth(250) --头像宽度
portrait:SetHeight(20) --头像高度
portrait:SetPoint("TOPLEFT", self.Health, "BOTTOMLEFT", 0, -1) --头像位置,TOPLEFT为3D头像左上角,self.Health是指自己的血条,BOTTOMLEFT指自己血条底部左下角,意思就是3D头像左上角位于自己血条底部左下角,纵向-1处
portrait.type = "3D" --头像类型
self.Portrait = portrait
portrait:SetFrameLevel(0)

2D和3D代码基本相同,修改portrait.type = "x" --x为头像类型

头像判断显示代码如下:

-- 加入头像判断 ---

local viewtype = "2D" --若为2D - 则头像显示为2D模式,若为3D - 则头像为3D模式.
if viewtype == "3D" then
local portrait = CreateFrame("layerModel", nil, self)
portrait:SetFrameStrata"MEDIUM"
portrait.type = "3D"
portrait:SetLight(1, 0, 0, -0.707, -0.707, 0.7, 1.0, 1.0, 1.0, 0.8, 1.0, 1.0, 0.8)
portrait:SetWidth(40)
portrait:SetHeight(40)
if (unit == "target") then
portrait:SetPoint("RIGHT", 40, 0)
elseif (unit == "player" or unit == "pet" or unit == "focus" or self:GetParent():GetName() == "oUF_Party") then -- 宠物头像
portrait:SetPoint("LEFT", -40, 0)
end
self.Portrait = portrait



--头像位置移动(同时按住SHIFT+ALT 拖动,键值可自己替换成别的):

DefindedFrames = {
["oUF_Player"] = {isLock = nil},
["oUF_Target"] = {isLock = nil},
["oUF_TargetTarget"] = {isLock = nil},
["oUF_TargetTargetTarget"] = {isLock = nil},
["oUF_Focus"] = {isLock = nil},
["oUF_Focustarget"] = {isLock = nil},
["oUF_Party"] = {isLock = nil},
}

function SetFrameMovable(frameName)
local f = getglobal(frameName);
if f then
if not f:IsMovable() then
f:SetMovable(true);
end
f:RegisterForDrag("LeftButton");
f:SetScript("OnDragStart",function()
if not DefindedFrames[frameName].isLock then
if arg1 == "LeftButton" and IsAltKeyDown() and IsShiftKeyDown() then
this:StartMoving();
end
end
end);
f:SetScript("OnDragStop",function()
this:StopMovingOrSizing();
end);
end
end;

for k,v in pairs(DefindedFrames) do
SetFrameMovable(k);
end

实例:oUF_dd 添加窗体移动代码

---------------------------frames settings--------------------------------------
local SetStyle = function(self, unit)
self.menu = Menu
self.colors = colors
self:SetMovable(true)
self:EnableMouse(true)

self:RegisterForClicks('AnyUp')
self:SetAttribute('type2', 'menu')

local mainparty = self:GetParent():GetName():match'oUF_Party' and not( self:GetAttribute('unitsuffix') == 'pet' or self:GetAttribute('unitsuffix') == 'target')

self:SetScript('OnEnter', UnitFrame_OnEnter)
self:SetScript('OnLeave', UnitFrame_OnLeave)
self:SetScript('OnMouseDown', function(self) if(IsAltKeyDown()) then self:StartMoving() end end)
self:SetScript('OnMouseUp', function(self) self:StopMovingOrSizing() end)


--设置头像大小
local plSize = 1 -- 玩家、宠物、目标、焦点目标、目标的目标、焦点目标的目标的比例
local ptSize = 1 -- 队友、队友宠物、队友目标的比例

oUF_Player:SetScale(plSize);
oUF_Pet:SetScale(plSize);
oUF_Target:SetScale(plSize);
oUF_TargetTarget:SetScale(plSize);
oUF_Focus:SetScale(plSize);
oUF_Focustarget:SetScale(plSize);

oUF_Party:SetScale(plSize);
for i=1, 4 do
getglobal("oUF_Party"..i.."Target"):SetScale(ptSize);
getglobal("oUF_PartyPet"..i):SetScale(ptSize);
end



<strong><font color="dimgray">-- 显示玩家的小队
local updatePartyNum = function(self, event, unit)
if self.unit ~= unit then return end

local RaidPartyNum = self.RaidPartyNum
local numText, name, rank, subgroup;
if ( GetNumRaidMembers() == 0 ) then
numText = " ";
else
local numRaidMembers = GetNumRaidMembers();
for i=1, MAX_RAID_MEMBERS do
if ( i
回复

使用道具 举报

发表于 2015-8-13 21:04:22 | 显示全部楼层

〓下面以Dawn 的oUF_Asym 和kyron的oUF_Caellian为实例介绍部分详细代码〓


※实例1、Dawn的oUF_Asym

作者:Dawn
下载地址:http://www.wowinterface.com/downloads/info12614-oUFAsymUI-Widescreen.html





--[[
oUF_Asym
Author:  Dawn based on oUF_Lyn by Lyn/Eiszeit
Credits: p3lim for party toggle function and druid mana
  Lyn for oUF_Lyn
  Neal for a way to get those borders around all frames!
--]]
-- ------------------------------------------------------------------------
-- local horror
-- ------------------------------------------------------------------------
local select = select
local UnitClass = UnitClass
local UnitIsDead = UnitIsDead
local UnitIsPVP = UnitIsPVP
local UnitIsGhost = UnitIsGhost
local UnitIsPlayer = UnitIsPlayer
local UnitReaction = UnitReaction
local UnitIsConnected = UnitIsConnected
local UnitCreatureType = UnitCreatureType
local UnitClassification = UnitClassification
local UnitReactionColor = UnitReactionColor
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
-- ------------------------------------------------------------------------
-- Configuration - font, fontsize and textures --材质和字体大小等设置
-- ------------------------------------------------------------------------
local font = &quot;InterfaceAddOnsoUF_AsymfontsROADWAY.ttf&quot; -- 字体设置,修改成自己喜欢的字体所在路径。或把喜欢的字体重命名替换
local fontsize = 12 -- default 12 --字体大小(除了施法条以外的字号)默认为12
local fontsizeCB = 12 -- castbar fontsize --施法条的字体大小,默认为12
local bartex = &quot;InterfaceAddOnsoUF_Asymtexturesdm&quot; -- change bar texture here --头像的背景框,默认是dm,可以自己去该文件夹查看图片并替换成自己喜欢的

这里附上tga预览插件tga.rar(186.99 KB, 下载次数: 314),方便电脑没有安装PS的玩家预览图片
缩略图预览即可(如图缩略图显示tga预览图)



local castbartex = &quot;InterfaceAddOnsoUF_Asymtexturesdm&quot; -- change castbar texture here --施法条的背景框材质,默认是dm
local bufftex = &quot;InterfaceAddOnsoUF_Asymtexturesborder1&quot; -- change buff/debuff border texture here --buff和debuff的背景框材质
local playerClass = select(2, UnitClass(&quot;player&quot;))
local PorBG = &quot;InterfaceAddOnsoUF_AsymtexturesBorder4.tga&quot; -- change target portait background texture here --头像材质
local frameborder = &quot;InterfaceAddOnsoUF_Asymtexturesframeborder4.tga&quot; --边框材质
local borderDebuffHigh = &quot;InterfaceAddOnsoUF_Asymtexturesframeborder4large.tga&quot; --debuff边框高亮材质

-- color and alpha for frameborders --背景框色调和透明度设置,一般不用改
local color_rb = 0.40 -- default 0.00
local color_gb = 0.40 -- default 0.00
local color_bb = 0.40 -- default 0.00
local alpha_fb = 0.80 -- default 0.35

-- Castbar position for player and target --施法条的位置
local playerCB_x = 0 --自己施法条的横坐标
local playerCB_y = -265 --自己施法条的纵坐标
local targetCB_x = 270 --目标施法条的横坐标
local targetCB_y = -152 --目标施法条的纵坐标

-- Portraits --小队和团队头像开关
-- enable/disable party portrait -- 0 = disable, 1 = enable
local partyport = 1 --是否显示小队头像,1开0闭
-- enable/disable raid portrait -- 0 = disable, 1 = enable
local raidport = 0 -- disabled by default --是否显示团队头像,1开0闭

-- ------------------------------------------------------------------------
-- End of Configuration
-- ------------------------------------------------------------------------
-- local background --头像背景透明度设置
-- ------------------------------------------------------------------------
local backdrop = {
bgFile = &quot;InterfaceChatFrameChatFrameBackground&quot;,
insets = {top = -1, left = -1, bottom = -1, right = -1},
}

-- ------------------------------------------------------------------------
-- change some colors
-- ------------------------------------------------------------------------
oUF.colors.happiness = {
[1] = {182/225, 34/255, 32/255}, -- unhappy --不开心的颜色
[2] = {220/225, 180/225, 52/225}, -- content --普通状态的颜色
[3] = {143/255, 194/255, 32/255}, -- happy --开心的颜色
}
local corb = 1
local cogb = 0
local cobb = 0

-- ------------------------------------------------------------------------
-- right click
-- ------------------------------------------------------------------------
local menu = function(self)
local unit = self.unit:sub(1, -2)
local cunit = self.unit:gsub(&quot;(.)&quot;, string.upper, 1)
if(unit == &quot;party&quot; or unit == &quot;partypet&quot;) then
  ToggleDropDownMenu(1, nil, _G[&quotartyMemberFrame&quot;..self.id..&quot;DropDown&quot;], &quot;cursor&quot;, 0, 0)
elseif(_G[cunit..&quot;FrameDropDown&quot;]) then
  ToggleDropDownMenu(1, nil, _G[cunit..&quot;FrameDropDown&quot;], &quot;cursor&quot;, 0, 0)
end
end

-- ------------------------------------------------------------------------
-- reformat everything above 9999, i.e. 10000 -> 10k --血条数值设置
-- ------------------------------------------------------------------------
local numberize = function(v)
if v <= 99999 then return v end --生命在10万以内,不会科学计数
if v >= 1000000 then
  local value = string.format(&quot;%.1fm&quot;, v/1000000)
  return value
elseif v >= 100000 then --生命大于10万时,才会科学计数
  local value = string.format(&quot;%.1fk&quot;, v/1000)
  return value
end
end

-- ------------------------------------------------------------------------
-- level update --等级设置
-- ------------------------------------------------------------------------
local updateLevel = function(self, unit, name)
local lvl = UnitLevel(unit)
local typ = UnitClassification(unit)
local color = GetDifficultyColor(lvl)
if lvl <= 0 then lvl = &quot;??&quot; end
if typ==&quot;worldboss&quot; then
     self.Level:SetText(&quot;|cffff0000&quot;..lvl..&quot;b|r&quot;)
elseif typ==&quot;rareelite&quot; then
     self.Level:SetText(lvl..&quot;r+&quot;)
  self.Level:SetTextColor(color.r, color.g, color.b)
elseif typ==&quot;elite&quot; then
     self.Level:SetText(lvl..&quot;+&quot;)
  self.Level:SetTextColor(color.r, color.g, color.b)
elseif typ==&quot;rare&quot; then
  self.Level:SetText(lvl..&quot;r&quot;)
  self.Level:SetTextColor(color.r, color.g, color.b)
else
  if UnitIsConnected(unit) == nil then
   self.Level:SetText(&quot;??&quot;)
  else
   self.Level:SetText(lvl)
  end
  if(not UnitIsPlayer(unit)) then
   self.Level:SetTextColor(color.r, color.g, color.b)
  else
   local _, class = UnitClass(unit)
   color = self.colors.class[class]
   self.Level:SetTextColor(color[1], color[2], color[3])
  end
end
end

-- ------------------------------------------------------------------------
-- name update --角色名设置
-- ------------------------------------------------------------------------
local updateName = function(self, event, unit)
if(self.unit ~= unit) then return end
local name = UnitName(unit)
self.Name:SetText(string.lower(name):sub(1, 30, nil)) -- only use lower case for names, truncate to 17 for Oksana, 20 for Santana, 30 for Roadway
if unit==&quot;targettarget&quot; then
  local totName = UnitName(unit)
  local pName = UnitName(&quot;player&quot;)
  if totName==pName then
   self.Name:SetTextColor(0.9, 0.5, 0.2) 这里说下颜色,由于BLZ的颜色范围是0-1 ,所以RGB 红绿蓝三通道的数值都除以255就可以了
  else
   self.Name:SetTextColor(1,1,1)
  end
else
  self.Name:SetTextColor(1,1,1)
end
    if unit==&quot;target&quot; then  -- Show level value on targets only 如果鼠标指向为目标时,只在目标上显示等级,玩家头像不显示
  updateLevel(self, unit, name)
    end
end
-- ------------------------------------------------------------------------
-- health update --生命条的设置
-- ------------------------------------------------------------------------
local updateHealth = function(self, event, unit, bar, min, max)
    local cur, maxhp = min, max
    local d = floor(cur/maxhp*100)
if(UnitIsDead(unit) or UnitIsGhost(unit)) then
  bar:SetValue(0)
  bar.value:SetText&quot;dead&quot;
elseif(not UnitIsConnected(unit)) then
  bar.value:SetText&quot;D/C&quot;
elseif(unit == &quot;player&quot;) then
  if(min ~= max) then
   bar.value:SetText(&quot;|cff33EE44&quot;..numberize(cur) ..&quot;|r-&quot;.. d..&quot;%&quot;)
  else
   bar.value:SetText(&quot;|cff33EE44&quot;..numberize(cur) ..&quot;|r&quot;) --满血也显示自己生命值
  end
elseif(unit == &quot;targettarget&quot;) then
  bar.value:SetText(d..&quot;%&quot;)
elseif(unit == &quot;target&quot;) then
  if(d < 100) then
   bar.value:SetText(&quot;|cff33EE44&quot;..numberize(cur)..&quot;|r-&quot;..d..&quot;%&quot;)
  else
   bar.value:SetText(&quot;|cff33EE44&quot;..numberize(cur) ..&quot;|r&quot;) --同上,可以满血也显示目标生命值
  end
elseif(min == max) then
        if unit == &quot;pet&quot; then
   bar.value:SetText(&quot;|cff33EE44&quot;..numberize(cur) ..&quot;|r&quot;) -- just here if otherwise wanted --同上,显示BB血量,也可以改为显示BB名字
else
   bar.value:SetText(&quot;|cff33EE44&quot;..numberize(cur) ..&quot;|r&quot;)
  end
else
        if((max-min) < max) then
   if unit == &quot;pet&quot; then
    bar.value:SetText(&quot;|cff33EE44&quot;..numberize(cur) ..&quot;|r-&quot;.. d..&quot;%&quot;) -- just here if otherwise wanted
   else
    bar.value:SetText(&quot;-&quot;..maxhp-cur) -- just here if otherwise wanted
   end
     end
    end
    self:UNIT_NAME_UPDATE(event, unit)
end

-- ------------------------------------------------------------------------
-- druid mana (fixed alpha settings) --XD蓝条设置参数
-- ------------------------------------------------------------------------
local function UpdateDruidPower(self)
local ptype = UnitPowerType(&quot;player&quot;)
if(ptype ~= 0) then
  local min = UnitPower(&quot;player&quot;,0)
  local max = UnitPowerMax(&quot;player&quot;,0)
  self.DruidPower:SetMinMaxValues(0, max)
  self.DruidPower:SetValue(min)
  self.DruidPower:SetStatusBarColor(unpack(self.colors.power[&quot;MANA&quot;]))
  self.DruidPower.value:SetText(min..&quot; . &quot;..max)
  self.DruidPower.percent:SetText(floor(min / max * 100)..&quot;%&quot;) 文本格式
  if(min ~= max) then
   self.DruidPower:SetMinMaxValues(0, max)
   self.DruidPower:SetValue(min)
   self.DruidPower:SetAlpha(0.8)
  else
   self.DruidPower:SetAlpha(0)
  end
else
  local min = UnitPower(&quot;player&quot;,3)
  local max = UnitPowerMax(&quot;player&quot;,3)
  self.DruidPower:SetStatusBarColor(unpack(self.colors.power[&quot;ENERGY&quot;]))
  self.DruidPower.value:SetText()
  self.DruidPower.percent:SetText()
  self.DruidPower:SetAlpha(0)
end
end
-- ------------------------------------------------------------------------
-- power update --法力,能量、怒气的设置
-- ------------------------------------------------------------------------
local updatePower = function(self, event, unit, bar, min, max)
if UnitIsPlayer(unit)==nil then
  bar.value:SetText()
else
  local _, ptype = UnitPowerType(unit)
  local color = oUF.colors.power[ptype]
  if(min==0) then
   bar.value:SetText()
  elseif(UnitIsDead(unit) or UnitIsGhost(unit)) then
   bar:SetValue(0)
  elseif(not UnitIsConnected(unit)) then
   bar.value:SetText()
  elseif unit==&quot;player&quot; then
   if((max-min) > 0) then
                 bar.value:SetText(min)
    if color then
     bar.value:SetTextColor(color[1], color[2], color[3])
    else
     bar.value:SetTextColor(0.2, 0.66, 0.93)  RGB代码,可自行替换其他颜色
    end
   elseif(min==max) then
    bar.value:SetText(min) --始终显示法力、能量、怒气值
         else
    bar.value:SetText(min)
    if color then
     bar.value:SetTextColor(color[1], color[2], color[3])
    else
     bar.value:SetTextColor(0.2, 0.66, 0.93)
    end
   end
         else
   if((max-min) > 0) then
    bar.value:SetText(min)
    if color then
     bar.value:SetTextColor(color[1], color[2], color[3])
    else
     bar.value:SetTextColor(0.2, 0.66, 0.93)
    end
   else
    bar.value:SetText(min)
    if color then
     bar.value:SetTextColor(color[1], color[2], color[3])
    else
     bar.value:SetTextColor(0.2, 0.66, 0.93)
    end
   end
         end
end
end

-- ------------------------------------------------------------------------
-- aura reskin
-- ------------------------------------------------------------------------
local auraIcon = function(self, button, icons)
icons.showDebuffType = true -- show debuff border type color

button.icon:SetTexCoord(.07, .93, .07, .93)
button.icon:SetPoint(&quot;TOPLEFT&quot;, button, &quot;TOPLEFT&quot;, 1, -1)
button.icon:SetPoint(&quot;BOTTOMRIGHT&quot;, button, &quot;BOTTOMRIGHT&quot;, -1, 1)

button.overlay:SetTexture(bufftex)
button.overlay:SetTexCoord(0,1,0,1)
button.overlay.Hide = function(self) self:SetVertexColor(0.3, 0.3, 0.3) end

button.cd:SetReverse()
button.cd:SetPoint(&quot;TOPLEFT&quot;, button, &quot;TOPLEFT&quot;, 2, -2)
button.cd:SetPoint(&quot;BOTTOMRIGHT&quot;, button, &quot;BOTTOMRIGHT&quot;, -2, 2)
end
-
- ------------------------------------------------------------------------
-- the layout starts here --layout基本参数
-- ------------------------------------------------------------------------
local func = function(self, unit)
self.menu = menu
self:RegisterForClicks('AnyUp')
self:SetAttribute('type2', 'menu')
self:SetScript('OnEnter', UnitFrame_OnEnter)
self:SetScript('OnLeave', UnitFrame_OnLeave)
self.disallowVehicleSwap = true

--
-- background
--
self:SetBackdrop(backdrop)
self:SetBackdropColor(0,0,0,0.6)

--
-- border
--
local TopLeft = self:CreateTexture(nil, &quot;OVERLAY&quot;)
TopLeft:SetTexture(frameborder)
TopLeft:SetTexCoord(0, 1/3, 0, 1/3)
TopLeft:SetPoint(&quot;TOPLEFT&quot;, self, -6, 6)
TopLeft:SetWidth(14) TopLeft:SetHeight(14)
TopLeft:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

local TopRight = self:CreateTexture(nil, &quot;OVERLAY&quot;)
TopRight:SetTexture(frameborder)
TopRight:SetTexCoord(2/3, 1, 0, 1/3)
TopRight:SetPoint(&quot;TOPRIGHT&quot;, self, 6, 6)
TopRight:SetWidth(14) TopRight:SetHeight(14)
TopRight:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

local BottomLeft = self:CreateTexture(nil, &quot;OVERLAY&quot;)
BottomLeft:SetTexture(frameborder)
BottomLeft:SetTexCoord(0, 1/3, 2/3, 1)
BottomLeft:SetPoint(&quot;BOTTOMLEFT&quot;, self, -6, -6)
BottomLeft:SetWidth(14) BottomLeft:SetHeight(14)
BottomLeft:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

local BottomRight = self:CreateTexture(nil, &quot;OVERLAY&quot;)
BottomRight:SetTexture(frameborder)
BottomRight:SetTexCoord(2/3, 1, 2/3, 1)
BottomRight:SetPoint(&quot;BOTTOMRIGHT&quot;, self, 6, -6)
BottomRight:SetWidth(14) BottomRight:SetHeight(14)
BottomRight:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

local TopEdge = self:CreateTexture(nil, &quot;OVERLAY&quot;)
TopEdge:SetTexture(frameborder)
TopEdge:SetTexCoord(1/3, 2/3, 0, 1/3)
TopEdge:SetPoint(&quot;TOPLEFT&quot;, TopLeft, &quot;TOPRIGHT&quot;)
TopEdge:SetPoint(&quot;TOPRIGHT&quot;, TopRight, &quot;TOPLEFT&quot;)
TopEdge:SetHeight(14)
TopEdge:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

local BottomEdge = self:CreateTexture(nil, &quot;OVERLAY&quot;)
BottomEdge:SetTexture(frameborder)
BottomEdge:SetTexCoord(1/3, 2/3, 2/3, 1)
BottomEdge:SetPoint(&quot;BOTTOMLEFT&quot;, BottomLeft, &quot;BOTTOMRIGHT&quot;)
BottomEdge:SetPoint(&quot;BOTTOMRIGHT&quot;, BottomRight, &quot;BOTTOMLEFT&quot;)
BottomEdge:SetHeight(14)
BottomEdge:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

local LeftEdge = self:CreateTexture(nil, &quot;OVERLAY&quot;)
LeftEdge:SetTexture(frameborder)
LeftEdge:SetTexCoord(0, 1/3, 1/3, 2/3)
LeftEdge:SetPoint(&quot;TOPLEFT&quot;, TopLeft, &quot;BOTTOMLEFT&quot;)
LeftEdge:SetPoint(&quot;BOTTOMLEFT&quot;, BottomLeft, &quot;TOPLEFT&quot;)
LeftEdge:SetWidth(14)
LeftEdge:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

local RightEdge = self:CreateTexture(nil, &quot;OVERLAY&quot;)
RightEdge:SetTexture(frameborder)
RightEdge:SetTexCoord(2/3, 1, 1/3, 2/3)
RightEdge:SetPoint(&quot;TOPRIGHT&quot;, TopRight, &quot;BOTTOMRIGHT&quot;)
RightEdge:SetPoint(&quot;BOTTOMRIGHT&quot;, BottomRight, &quot;TOPRIGHT&quot;)
RightEdge:SetWidth(14)
RightEdge:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

--
-- healthbar
--
self.Health = CreateFrame&quot;StatusBar&quot;
self.Health:SetHeight(12) -- custom height used for partytargets/pets
self.Health:SetStatusBarTexture(bartex)
self.Health:SetParent(self)
self.Health:SetPoint&quot;TOP&quot;
self.Health:SetPoint&quot;LEFT&quot;
self.Health:SetPoint&quot;RIGHT&quot;
self.Health.frequentUpdates = true
--
-- healthbar background
--
self.Health.bg = self.Health:CreateTexture(nil, &quot;BORDER&quot;)
self.Health.bg:SetAllPoints(self.Health)
self.Health.bg:SetTexture(bartex)
self.Health.bg:SetAlpha(0.30)
--
-- healthbar text
--
self.Health.value = self.Health:CreateFontString(nil, &quot;OVERLAY&quot;)
self.Health.value:SetPoint(&quot;RIGHT&quot;, self.Health, -2, 2)
self.Health.value:SetFont(font, fontsize, &quot;OUTLINE&quot;)
self.Health.value:SetTextColor(1,1,1)
self.Health.value:SetShadowOffset(1, -1)
--
-- healthbar functions
--
self.Health.colorClass = true
self.Health.colorReaction = true
self.Health.colorDisconnected = true
self.Health.colorTapping = true
self.PostUpdateHealth = updateHealth -- let the colors be
--
-- powerbar
--
self.Power = CreateFrame&quot;StatusBar&quot;
self.Power:SetHeight(3) -- custom height used for partytargets/pets
self.Power:SetStatusBarTexture(bartex)
self.Power:SetParent(self)
self.Power:SetPoint&quot;LEFT&quot;
self.Power:SetPoint&quot;RIGHT&quot;
self.Power:SetPoint(&quot;TOP&quot;, self.Health, &quot;BOTTOM&quot;, 0, -1.45) -- Little offset to make it pretty
self.Power.frequentUpdates = true
--
-- powerbar background
--
self.Power.bg = self.Power:CreateTexture(nil, &quot;BORDER&quot;)
self.Power.bg:SetAllPoints(self.Power)
self.Power.bg:SetTexture(bartex)
self.Power.bg:SetAlpha(0.30)
--
-- powerbar text
--
self.Power.value = self.Power:CreateFontString(nil, &quot;OVERLAY&quot;)
self.Power.value:SetPoint(&quot;RIGHT&quot;, self.Health.value, &quot;BOTTOMRIGHT&quot;, 0, -5) -- powerbar text in health box
self.Power.value:SetFont(font, fontsize, &quot;OUTLINE&quot;)
self.Power.value:SetTextColor(1,1,1)
self.Power.value:SetShadowOffset(1, -1)
self.Power.value:Hide()
--
-- powerbar functions
--
self.Power.colorTapping = true
self.Power.colorDisconnected = true
self.Power.colorClass = true
self.Power.colorPower = true
self.Power.colorHappiness = false
self.PostUpdatePower = updatePower -- let the colors be
--
-- names
--
self.Name = self.Health:CreateFontString(nil, &quot;OVERLAY&quot;)
self.Name:SetPoint(&quot;LEFT&quot;, self, 0, 9)
self.Name:SetJustifyH&quot;LEFT&quot;
self.Name:SetFont(font, fontsize, &quot;OUTLINE&quot;)
self.Name:SetShadowOffset(1, -1)
self.UNIT_NAME_UPDATE = updateName
--
-- level
--
self.Level = self.Health:CreateFontString(nil, &quot;OVERLAY&quot;)
self.Level:SetPoint(&quot;LEFT&quot;, self.Health, 0, 9)
self.Level:SetJustifyH(&quot;LEFT&quot;)
self.Level:SetFont(font, fontsize, &quot;OUTLINE&quot;)
self.Level:SetTextColor(1,1,1)
self.Level:SetShadowOffset(1, -1)
self.UNIT_LEVEL = updateLevel
-- ------------------------------------
-- oUF_SpellRange fading and oUF_Smooth support for all frames
-- ------------------------------------
  if(unit) or (self:GetParent():GetName():match&quot;oUF_Raid&quot;) or (self:GetParent():GetName():match&quot;oUF_Party&quot;) then
  self.SpellRange = true; -- fadeout if units are out of range
  self.inRangeAlpha = 1.0; -- Frame alpha when in range
  self.outsideRangeAlpha = 0.6; -- 超出距离的边框透明度
  self.Power.Smooth = true
  self.Health.Smooth = true
  end
-- ------------------------------------
-- Hide Portrait for units that are disconnected, don't exist or are not visible (out of range)
-- ------------------------------------
local HidePortrait = function(self, unit)
  if (self.unit == 'target' or (self:GetParent():GetName():match&quot;oUF_Party&quot;)) then
   if (not UnitExists(self.unit) or not UnitIsConnected(self.unit) or not UnitIsVisible(self.unit)) then
    self.Portrait:SetAlpha(0)
   else
    self.Portrait:SetAlpha(1)
   end
  elseif (self.unit == 'player' or (self:GetParent():GetName():match&quot;oUF_Raid&quot;)) then
   if (not UnitExists(self.unit) or not UnitIsConnected(self.unit) or not UnitIsVisible(self.unit)) then
    self.Portrait:SetAlpha(0)
   else
    self.Portrait:SetAlpha(0.3) -- 小队在团队中的透明度
   end
  end
end
-- ------------------------------------
-- oUF_DebuffHighlight support - border highlight debuff边框高亮设置
-- ------------------------------------
if unit==&quot;player&quot; or unit==&quot;target&quot; or unit==&quot;pet&quot; or (self:GetParent():GetName():match&quot;oUF_Party&quot;) then
  self.DebuffHighlight = self:CreateTexture(nil, &quot;OVERLAY&quot;)
  self.DebuffHighlight:SetPoint(&quot;TOPLEFT&quot;,self,&quot;TOPLEFT&quot;,-6,6)
  self.DebuffHighlight:SetPoint(&quot;BOTTOMRIGHT&quot;,self,&quot;BOTTOMRIGHT&quot;,6,-6)
  self.DebuffHighlight:SetTexture(borderDebuffHigh)
  self.DebuffHighlight:SetVertexColor(0, 0, 0, 0)
  self.DebuffHighlight:SetBlendMode(&quot;BLEND&quot;)
  self.DebuffHighlightAlpha = 0.8
  self.DebuffHighlightFilter = true
elseif(self:GetParent():GetName():match&quot;oUF_Raid&quot;) then
  self.DebuffHighlight = self:CreateTexture(nil, &quot;OVERLAY&quot;)
  self.DebuffHighlight:SetPoint(&quot;TOPLEFT&quot;,self,&quot;TOPLEFT&quot;,-6,6)
  self.DebuffHighlight:SetPoint(&quot;BOTTOMRIGHT&quot;,self,&quot;BOTTOMRIGHT&quot;,6,-6)
  self.DebuffHighlight:SetTexture(frameborder)
  self.DebuffHighlight:SetVertexColor(0, 0, 0, 0)
  self.DebuffHighlight:SetBlendMode(&quot;BLEND&quot;)
  self.DebuffHighlightAlpha = 0.8
  self.DebuffHighlightFilter = true
end

-- ------------------------------------
-- player --玩家设置
-- ------------------------------------
if unit==&quot;player&quot; then
  self:SetWidth(250) --头像长度
        self:SetHeight(42) --头像高度
  self.Health:SetHeight(15) --血条高度
  self.Name:Hide() --姓名显示(隐藏),显示改为Show()
  self.Health.value:SetPoint(&quot;RIGHT&quot;, 0, 9) 生命条位置
  self.Power:SetHeight(5) --蓝条高度
  self.Power.value:Show()
  self.Power.value:SetPoint(&quot;LEFT&quot;, self.Health, 0, 9)
  self.Power.value:SetJustifyH&quot;LEFT&quot;
  self.Level:Hide() --等级显示(隐藏),显示改为Show()
  self.Power:SetAlpha(1.0) --透明度
  self.Health:SetAlpha(1.0) --透明度
  self.Power:SetPoint(&quot;TOP&quot;, self.Health, &quot;BOTTOM&quot;, 0, -22) --蓝条位置,如果自己添加2D 或者3D头像,可添加这句,具体数值由添加的头像高度决定

--
  -- Portrait --添加的玩家3D头像
  --
  local portrait = CreateFrame(&quotlayerModel&quot;, nil, self)
  portrait:SetScript(&quot;OnShow&quot;, function(self) self:SetCamera(0) end)
  portrait:SetWidth(250) --头像宽度
  portrait:SetHeight(20) --头像高度
  portrait:SetPoint(&quot;TOPLEFT&quot;, self.Health, &quot;BOTTOMLEFT&quot;, 0, -1) --头像位置,TOPLEFT指3d头像左上角,self.Health指自己的血条,BOTTOMLEFT指自己血条底部左下角
  portrait.type = &quot;3D&quot; 头像类型
  self.Portrait = portrait
  portrait:SetFrameLevel(0)

--
  -- oUF_Banzai - ignore aggro coloring for player - uncomment this if you want aggro coloring on your player frame
  --
  self.ignoreBanzai = true
  --
  -- resting icon --休息标识(zzZ)
  --
  self.Resting = self.Health:CreateTexture(nil, 'OVERLAY') --素材无
  self.Resting:SetHeight(14) --标识的高度
  self.Resting:SetWidth(14) --标识的宽度
  self.Resting:SetPoint('BOTTOMLEFT', self, 2, 6) --标识的位置
  self.Resting:SetTexture('InterfaceCharacterFrameUI-StateIcon')
  self.Resting:SetTexCoord(0,0.5,0,0.5)
  --
  -- Druid Mana --XD蓝条相关设置
  --
  if playerClass==&quot;DRUID&quot; then
   self.DruidPower = CreateFrame&quot;StatusBar&quot;
   self.DruidPower:SetStatusBarTexture(bartex)
   self.DruidPower:SetPoint(&quot;TOPLEFT&quot;, self, &quot;BOTTOMLEFT&quot;, 0, -14)
   self.DruidPower:SetHeight(8)
   self.DruidPower:SetWidth(225)
   self.DruidPower.Smooth = true

   self.DruidPower.bg = self.DruidPower:CreateTexture(nil, &quot;BORDER&quot;)
   self.DruidPower.bg:SetAllPoints(self.DruidPower)
   self.DruidPower.bg:SetTexture(bartex)
   self.DruidPower.bg:SetAlpha(0.30)

   self.DruidPower.value = self.DruidPower:CreateFontString(nil, &quot;OVERLAY&quot;)
   self.DruidPower.value:SetPoint(&quot;LEFT&quot;, self.DruidPower, 2, 0)
   self.DruidPower.value:SetFont(font, fontsize-1)
   self.DruidPower.value:SetTextColor(1,1,1)
   self.DruidPower.value:SetShadowOffset(1, -1)

   self.DruidPower.percent = self.DruidPower:CreateFontString(nil, &quot;OVERLAY&quot;)
   self.DruidPower.percent:SetPoint(&quot;RIGHT&quot;, self.DruidPower, -1, 0)
   self.DruidPower.percent:SetFont(font, fontsize-1)
   self.DruidPower.percent:SetTextColor(1,1,1)
   self.DruidPower.percent:SetShadowOffset(1, -1)
   self.DruidPower:SetBackdrop{
   bgFile = &quot;InterfaceChatFrameChatFrameBackground&quot;, tile = true, tileSize = 16,
   insets = {left = -1, right = -1, top = -1, bottom = -1},
   }
   self.DruidPower:SetBackdropColor(0,0,0,0.6)
   self:RegisterEvent(&quot;UNIT_MANA&quot;, UpdateDruidPower)
   self:RegisterEvent(&quot;UNIT_ENERGY&quot;, UpdateDruidPower)
   self:RegisterEvent(&quotLAYER_LOGIN&quot;, UpdateDruidPower)

-- Druid Mana border
   local TopLeft = self.DruidPower:CreateTexture(nil, &quot;OVERLAY&quot;)
   TopLeft:SetTexture(frameborder)
   TopLeft:SetTexCoord(0, 1/3, 0, 1/3)
   TopLeft:SetPoint(&quot;TOPLEFT&quot;, -6, 6)
   TopLeft:SetWidth(12) TopLeft:SetHeight(12)
   TopLeft:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

   local TopRight = self.DruidPower:CreateTexture(nil, &quot;OVERLAY&quot;)
   TopRight:SetTexture(frameborder)
   TopRight:SetTexCoord(2/3, 1, 0, 1/3)
   TopRight:SetPoint(&quot;TOPRIGHT&quot;, 6, 6)
   TopRight:SetWidth(12) TopRight:SetHeight(12)
   TopRight:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

   local BottomLeft = self.DruidPower:CreateTexture(nil, &quot;OVERLAY&quot;)
   BottomLeft:SetTexture(frameborder)
   BottomLeft:SetTexCoord(0, 1/3, 2/3, 1)
   BottomLeft:SetPoint(&quot;BOTTOMLEFT&quot;, -6, -6)
   BottomLeft:SetWidth(12) BottomLeft:SetHeight(12)
   BottomLeft:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

   local BottomRight = self.DruidPower:CreateTexture(nil, &quot;OVERLAY&quot;)
   BottomRight:SetTexture(frameborder)
   BottomRight:SetTexCoord(2/3, 1, 2/3, 1)
   BottomRight:SetPoint(&quot;BOTTOMRIGHT&quot;, 6, -6)
   BottomRight:SetWidth(12) BottomRight:SetHeight(12)
   BottomRight:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

   local TopEdge = self.DruidPower:CreateTexture(nil, &quot;OVERLAY&quot;)
   TopEdge:SetTexture(frameborder)
   TopEdge:SetTexCoord(1/3, 2/3, 0, 1/3)
   TopEdge:SetPoint(&quot;TOPLEFT&quot;, TopLeft, &quot;TOPRIGHT&quot;)
   TopEdge:SetPoint(&quot;TOPRIGHT&quot;, TopRight, &quot;TOPLEFT&quot;)
   TopEdge:SetHeight(12)
   TopEdge:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

   local BottomEdge = self.DruidPower:CreateTexture(nil, &quot;OVERLAY&quot;)
   BottomEdge:SetTexture(frameborder)
   BottomEdge:SetTexCoord(1/3, 2/3, 2/3, 1)
   BottomEdge:SetPoint(&quot;BOTTOMLEFT&quot;, BottomLeft, &quot;BOTTOMRIGHT&quot;)
   BottomEdge:SetPoint(&quot;BOTTOMRIGHT&quot;, BottomRight, &quot;BOTTOMLEFT&quot;)
   BottomEdge:SetHeight(12)
   BottomEdge:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

   local LeftEdge = self.DruidPower:CreateTexture(nil, &quot;OVERLAY&quot;)
   LeftEdge:SetTexture(frameborder)
   LeftEdge:SetTexCoord(0, 1/3, 1/3, 2/3)
   LeftEdge:SetPoint(&quot;TOPLEFT&quot;, TopLeft, &quot;BOTTOMLEFT&quot;)
   LeftEdge:SetPoint(&quot;BOTTOMLEFT&quot;, BottomLeft, &quot;TOPLEFT&quot;)
   LeftEdge:SetWidth(12)
   LeftEdge:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)

   local RightEdge = self.DruidPower:CreateTexture(nil, &quot;OVERLAY&quot;)
   RightEdge:SetTexture(frameborder)
   RightEdge:SetTexCoord(2/3, 1, 1/3, 2/3)
   RightEdge:SetPoint(&quot;TOPRIGHT&quot;, TopRight, &quot;BOTTOMRIGHT&quot;)
   RightEdge:SetPoint(&quot;BOTTOMRIGHT&quot;, BottomRight, &quot;TOPRIGHT&quot;)
   RightEdge:SetWidth(12)
   RightEdge:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)
  end

   --
  -- leader icon --队长标识
  --
  self.Leader = self.Health:CreateTexture(nil, &quot;OVERLAY&quot;)
  self.Leader:SetHeight(12)
  self.Leader:SetWidth(12)
  self.Leader:SetPoint(&quot;BOTTOMRIGHT&quot;, self, -2, 6)
  self.Leader:SetTexture&quot;InterfaceGroupFrameUI-Group-LeaderIcon&quot;
  --
  -- Combat icon --战斗状态标志(交叉剑)
  --
  self.Combat = self.Health:CreateTexture(nil, 'OVERLAY')
  self.Combat:SetHeight(14)
  self.Combat:SetWidth(14)
  self.Combat:SetPoint('BOTTOM', self, 0, -9)
  self.Combat:SetTexture('InterfaceCharacterFrameUI-StateIcon')
  self.Combat:SetTexCoord(0.58, 0.90, 0.08, 0.41)
  --
  -- raid target icons -团队标记
  --
  self.RaidIcon = self.Health:CreateTexture(nil, &quot;OVERLAY&quot;)
  self.RaidIcon:SetHeight(16)
  self.RaidIcon:SetWidth(16)
  self.RaidIcon:SetPoint(&quot;TOP&quot;, self, 0, 9)
  self.RaidIcon:SetTexture&quot;InterfaceTargetingFrameUI-RaidTargetingIcons&quot;

--
  -- oUF_PowerSpark support --对PowerSpark插件的支持代码,提示战斗回蓝的光标效果
  --
  self.Spark = self.Power:CreateTexture(nil, &quot;OVERLAY&quot;)
  self.Spark:SetTexture(&quot;InterfaceCastingBarUI-CastingBar-Spark&quot;)
  self.Spark:SetVertexColor(1, 1, 1, 1)
  self.Spark:SetBlendMode(&quot;ADD&quot;)
  self.Spark:SetHeight(self.Power:GetHeight()*2.5)
  self.Spark:SetWidth(self.Power:GetHeight()*2)

  -- self.Spark.rtl = true -- Make the spark go from Right To Left instead
  -- self.Spark.manatick = true -- Show mana regen ticks outside FSR (like the energy ticker)
  -- self.Spark.highAlpha = 1 -- What alpha setting to use for the FSR and energy spark
  -- self.Spark.lowAlpha = 0.25 -- What alpha setting to use for the mana regen ticker

  --
  -- oUF_BarFader --对BarFader插件的支持代码,可以在你满血满蓝的时候渐隐或者全隐玩家头像
  --
  self.BarFade = true
end

-- ------------------------------------
-- pet --bb设置
-- ------------------------------------
if unit==&quot;pet&quot; then
  self:SetWidth(120) --头像宽度
  self:SetHeight(20) --头像高度
  self.Health:SetHeight(14.5) --血条高度
  self.Power:SetHeight(4) --蓝条高度
  self.Power.value:Hide()
  --self.Health.value:Hide() --生命值隐藏,也可在前面添加(去掉注释--即加载)
  self.Level:Hide() --BB等级
  self.Name:Hide() --BB名字
  self.Power:SetAlpha(1.0) --透明度
  self.Health:SetAlpha(1.0) --透明度

  if playerClass==&quot;HUNTER&quot; then
   self.Health.colorReaction = false
   self.Health.colorClass = false
   self.Health.colorHappiness = true
  end

  --
  -- buffs buff参数设置
  --
  self.Buffs = CreateFrame(&quot;Frame&quot;, nil, self) -- buffs
  self.Buffs.size = 26 --buff尺寸
  self.Buffs:SetHeight(self.Buffs.size)
  self.Buffs:SetWidth(self.Buffs.size * 6) --buff栏宽度,以buff的数量计算
  self.Buffs:SetPoint(&quot;BOTTOMLEFT&quot;, self, &quot;RIGHT&quot;, 15, -10) --buff位置
  self.Buffs.initialAnchor = &quot;BOTTOMLEFT&quot;
  self.Buffs[&quot;growth-y&quot;] = &quot;TOP&quot;
  self.Buffs.num = 4
  self.Buffs.spacing = 2  间隔

  --
  -- debuffs
  --
  self.Debuffs = CreateFrame(&quot;Frame&quot;, nil, self)
  self.Debuffs.size = 26 --debuff的设置,同buff设置
  self.Debuffs:SetHeight(self.Debuffs.size)
  self.Debuffs:SetWidth(self.Debuffs.size * 5)
  self.Debuffs:SetPoint(&quot;TOPLEFT&quot;, self, &quot;BOTTOMLEFT&quot;, -2, -10)
  self.Debuffs.initialAnchor = &quot;TOPLEFT&quot;
  self.Debuffs[&quot;growth-y&quot;] = &quot;DOWN&quot; 延伸方向
  self.Debuffs.filter = false  自身放的debuff突出放大
  self.Debuffs.num = 4
  self.Debuffs.spacing = 2
  --
  -- oUF_BarFader
  --
  self.BarFade = true
end

-- ------------------------------------
-- target --目标的设置
-- ------------------------------------
if unit==&quot;target&quot; then
  self:SetWidth(250) --宽度
  self:SetHeight(20) --高度
  self.Health:SetHeight(14.5) --血条高度
  self.Power:SetHeight(4) --蓝条高度
       self.Power.value:Hide()
  self.Health.value:SetPoint(&quot;RIGHT&quot;, 0, 9)
  self.Name:SetPoint(&quot;LEFT&quot;, self.Level, &quot;RIGHT&quot;, 0, 0)
  self.Name:SetHeight(20) --姓名高度
  self.Name:SetWidth(154) --姓名长度限制
  self.Power:SetAlpha(1.0) --透明度
  self.Health:SetAlpha(1.0)
  table.insert(self.__elements, HidePortrait)
  self.Health.colorClass = true
  --
  -- PvP Icon --pvp 标识
  --
  local pvp = self.Health:CreateTexture(nil, &quot;OVERLAY&quot;)
  pvp:SetPoint(&quot;LEFT&quot;, self.Health, &quot;LEFT&quot;, -22, -7)
  pvp:SetHeight(30)
  pvp:SetWidth(30)
  self.PvP = pvp
  --
  -- Portrait --中部3D头像 设置
  --
  local portrait = CreateFrame(&quotlayerModel&quot;, nil, self)
  portrait:SetScript(&quot;OnShow&quot;, function(self) self:SetCamera(0) end)
  portrait:SetWidth(90) --宽度
  portrait:SetHeight(100) --高度
  portrait:SetPoint(&quot;TOPLEFT&quot;, self.Power, &quot;BOTTOMLEFT&quot;, 0, -20) --位置
  portrait.type = &quot;3D&quot;
  self.Portrait = portrait
  portrait:SetFrameLevel(0)
  --
  -- Portrait background --目标头像背景材质
  --
  local TargetPorBG = CreateFrame(&quot;Frame&quot;, nil, oUF_Target)
  local TPBG = TargetPorBG:CreateTexture(nil,&quot;BACKGROUND&quot;)
  TargetPorBG:SetPoint(&quot;TOPLEFT&quot;, self.Power, &quot;BOTTOMLEFT&quot;, -6, -14)
  TargetPorBG:SetWidth(102) -- default 102
  TargetPorBG:SetHeight(111) -- default 111
  --TargetPorBG:SetFrameStrata(&quot;BACKGROUND&quot;) -- move the texture behind the portrait
  TPBG:SetTexture(PorBG)
  --TPBG:SetTexture(frameborder)
  TPBG:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)
  TPBG:SetAllPoints(TargetPorBG)
  TargetPorBG.texture = TPBG
  TargetPorBG:Show()

--[[
-- alternative (old/default/whatever) background
TargetPorBG = CreateFrame('Frame', 'TargetBG', oUF_Target)
TargetPorBG:SetFrameStrata'BACKGROUND'
TargetPorBG:SetWidth(102)
TargetPorBG:SetHeight(112)
TargetPorBG:SetPoint(&quot;TOPLEFT&quot;, self.Power, &quot;BOTTOMLEFT&quot;, -6, -14)
TargetPorBG:SetBackdrop({bgFile = &quot;InterfaceChatFrameChatFrameBackground&quot;,edgeFile = &quot;InterfaceTooltipsChatBubble-Backdrop&quot;,tile = false, tileSize = 0,edgeSize = 9,insets = { left = 6, right = 6, top = 6, bottom = 6 }})
TargetPorBG:SetBackdropColor(0,0,0,0.8)
TargetPorBG:SetBackdropBorderColor(0.2,0.5,0.5,0.35)
--]]
  --
  -- combo points --连击点设置
  --
  if(playerClass==&quot;ROGUE&quot; or playerClass==&quot;DRUID&quot;) then
   self.CPoints = self:CreateFontString(nil, &quot;OVERLAY&quot;)
   self.CPoints:SetPoint(&quot;RIGHT&quot;, self, &quot;LEFT&quot;, -10, 0)
   self.CPoints:SetFont(font, 38, &quot;OUTLINE&quot;)
   self.CPoints:SetTextColor(0, 0.81, 1)
   self.CPoints:SetShadowOffset(1, -1)
   self.CPoints:SetJustifyH&quot;RIGHT&quot;
  end
  --
  -- raid target icons --团队标记
  --
  self.RaidIcon = self.Health:CreateTexture(nil, &quot;OVERLAY&quot;)
  self.RaidIcon:SetHeight(24)
  self.RaidIcon:SetWidth(24)
  self.RaidIcon:SetPoint(&quot;LEFT&quot;, self, -30, 0)
  self.RaidIcon:SetTexture&quot;InterfaceTargetingFrameUI-RaidTargetingIcons&quot;
  --
  -- buffs --目标buff的设置,同上
  --
  self.Buffs = CreateFrame(&quot;Frame&quot;, nil, self)  -- buffs
  self.Buffs.size = 30
  self.Buffs:SetHeight(self.Buffs.size)
  self.Buffs:SetWidth(self.Buffs.size * 6)
  self.Buffs:SetPoint(&quot;BOTTOMLEFT&quot;, self, &quot;RIGHT&quot;, 15, -15)
  self.Buffs.initialAnchor = &quot;BOTTOMLEFT&quot;
  self.Buffs[&quot;growth-y&quot;] = &quot;TOP&quot;
  self.Buffs.num = 30
  self.Buffs.spacing = 2
  --
  -- debuffs --目标debuff的设置,同上
  --
  self.Debuffs = CreateFrame(&quot;Frame&quot;, nil, self)
  self.Debuffs.size = 30
  self.Debuffs:SetHeight(self.Debuffs.size)
  self.Debuffs:SetWidth(self.Debuffs.size * 9)
  self.Debuffs:SetPoint(&quot;BOTTOMLEFT&quot;, self, &quot;TOPLEFT&quot;, -2, 15)
  self.Debuffs.initialAnchor = &quot;BOTTOMLEFT&quot;
  self.Debuffs[&quot;growth-y&quot;] = &quot;TOP&quot;
  self.Debuffs.filter = &quot;HARMFUL|PLAYER&quot; --debuff过滤器,只显示自己的还是全部的,(&quot;HARMFUL|PLAYER&quot;改成false 即可显示全部)
  self.Debuffs.num = 40
  self.Debuffs.spacing = 2
end
-- ------------------------------------
-- player and target castbar --施法条的设置,玩家的和目标的
-- ------------------------------------
if(unit == 'player' or unit == 'target') then
     self.Castbar = CreateFrame('StatusBar', nil, self)
     self.Castbar:SetStatusBarTexture(castbartex)
     self.Castbar:SetFrameStrata'HIGH'
if(unit == &quot;player&quot;) then
  local _, class = UnitClass(unit)
  color = self.colors.class[class]
  --self.Castbar:SetStatusBarColor(0.10, 0.3, 0.70, 0.9)
  self.Castbar:SetStatusBarColor(0.5, 0.5, 0.5, 0.8) --施法条颜色
  self.Castbar:SetHeight(20) --玩家施法条高度
  self.Castbar:SetWidth(250) --玩家施法条宽度
  self.Castbar:SetBackdrop{
   bgFile = &quot;InterfaceChatFrameChatFrameBackground&quot;, tile = true, tileSize = 16,
   insets = {left = -1, right = -1, top = -1, bottom = -1}} --玩家施法条背景(可删)
  self.Castbar.SafeZone = self.Castbar:CreateTexture(nil,&quot;ARTWORK&quot;)
  self.Castbar.SafeZone:SetTexture(castbartex)
  self.Castbar.SafeZone:SetVertexColor(0.75,0.10,0.10,0.7)
  self.Castbar.SafeZone:SetPoint(&quot;TOPRIGHT&quot;)
  self.Castbar.SafeZone:SetPoint(&quot;BOTTOMRIGHT&quot;)
  self.Castbar:SetPoint('CENTER', UIParent, 'CENTER', playerCB_x, playerCB_y)
  else --else 目标的施法条设置
  --self.Castbar:SetStatusBarColor(0.10, 0.3, 0.70, 0.9)
  self.Castbar:SetStatusBarColor(0.5, 0.5, 0.5, 0.8) --施法条颜色
  self.Castbar:SetHeight(20) --高度
  self.Castbar:SetWidth(250) --宽度
  self.Castbar:SetBackdrop{
   bgFile = &quot;InterfaceChatFrameChatFrameBackground&quot;, tile = true, tileSize = 16,
   insets = {left = -1, right = -1, top = -1, bottom = -1}}
  self.Castbar:SetPoint('CENTER', UIParent, 'CENTER', targetCB_x, targetCB_y)
  end
  self.Castbar:SetBackdropColor(0, 0, 0, 0.25)
  self.Castbar.Text = self.Castbar:CreateFontString(nil, 'OVERLAY')
  self.Castbar.Text:SetPoint('CENTER', self.Castbar, 0, 0)
  self.Castbar.Text:SetFont(font, fontsizeCB)
  self.Castbar.Text:SetShadowOffset(1, -1)
  self.Castbar.Text:SetTextColor(1, 1, 1)
  self.Castbar.Text:SetJustifyH('LEFT')
  self.Castbar.Time = self.Castbar:CreateFontString(nil, 'OVERLAY')
  self.Castbar.Time:SetPoint('RIGHT', self.Castbar, -4, 0)
  self.Castbar.Time:SetFont(font, fontsizeCB)
  self.Castbar.Time:SetTextColor(1, 1, 1)
  self.Castbar.Time:SetJustifyH('RIGHT')
   --
   -- Castbar frameborder --施法条背景框设置
   --
   local TopLeft = self.Castbar:CreateTexture(nil, &quot;OVERLAY&quot;)
   --TopLeft:SetTexture(frameborder) --前面加--,即表示不显示施法条背景框 (以下相同)
   TopLeft:SetTexCoord(0, 1/3, 0, 1/3)
   TopLeft:SetPoint(&quot;TOPLEFT&quot;, -6, 6)
   TopLeft:SetWidth(16) TopLeft:SetHeight(16)
   TopLeft:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)
   local TopRight = self.Castbar:CreateTexture(nil, &quot;OVERLAY&quot;)
   
   --TopRight:SetTexture(frameborder)
   TopRight:SetTexCoord(2/3, 1, 0, 1/3)
   TopRight:SetPoint(&quot;TOPRIGHT&quot;, 6, 6)
   TopRight:SetWidth(16) TopRight:SetHeight(16)
   TopRight:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)
   local BottomLeft = self.Castbar:CreateTexture(nil, &quot;OVERLAY&quot;)
   
   --BottomLeft:SetTexture(frameborder)
   BottomLeft:SetTexCoord(0, 1/3, 2/3, 1)
   BottomLeft:SetPoint(&quot;BOTTOMLEFT&quot;, -6, -6)
   BottomLeft:SetWidth(16) BottomLeft:SetHeight(16)
   BottomLeft:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)
   local BottomRight = self.Castbar:CreateTexture(nil, &quot;OVERLAY&quot;)
   
   --BottomRight:SetTexture(frameborder)
   BottomRight:SetTexCoord(2/3, 1, 2/3, 1)
   BottomRight:SetPoint(&quot;BOTTOMRIGHT&quot;, 6, -6)
   BottomRight:SetWidth(16) BottomRight:SetHeight(16)
   BottomRight:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)
   local TopEdge = self.Castbar:CreateTexture(nil, &quot;OVERLAY&quot;)
   
   --TopEdge:SetTexture(frameborder)
   TopEdge:SetTexCoord(1/3, 2/3, 0, 1/3)
   TopEdge:SetPoint(&quot;TOPLEFT&quot;, TopLeft, &quot;TOPRIGHT&quot;)
   TopEdge:SetPoint(&quot;TOPRIGHT&quot;, TopRight, &quot;TOPLEFT&quot;)
   TopEdge:SetHeight(16)
   TopEdge:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)
   local BottomEdge = self.Castbar:CreateTexture(nil, &quot;OVERLAY&quot;)
   
   --BottomEdge:SetTexture(frameborder)
   BottomEdge:SetTexCoord(1/3, 2/3, 2/3, 1)
   BottomEdge:SetPoint(&quot;BOTTOMLEFT&quot;, BottomLeft, &quot;BOTTOMRIGHT&quot;)
   BottomEdge:SetPoint(&quot;BOTTOMRIGHT&quot;, BottomRight, &quot;BOTTOMLEFT&quot;)
   BottomEdge:SetHeight(16)
   BottomEdge:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)
   local LeftEdge = self.Castbar:CreateTexture(nil, &quot;OVERLAY&quot;)
  
   --LeftEdge:SetTexture(frameborder)
   LeftEdge:SetTexCoord(0, 1/3, 1/3, 2/3)
   LeftEdge:SetPoint(&quot;TOPLEFT&quot;, TopLeft, &quot;BOTTOMLEFT&quot;)
   LeftEdge:SetPoint(&quot;BOTTOMLEFT&quot;, BottomLeft, &quot;TOPLEFT&quot;)
   LeftEdge:SetWidth(16)
   LeftEdge:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)
   local RightEdge = self.Castbar:CreateTexture(nil, &quot;OVERLAY&quot;)
   
   --RightEdge:SetTexture(frameborder)
   RightEdge:SetTexCoord(2/3, 1, 1/3, 2/3)
   RightEdge:SetPoint(&quot;TOPRIGHT&quot;, TopRight, &quot;BOTTOMRIGHT&quot;)
   RightEdge:SetPoint(&quot;BOTTOMRIGHT&quot;, BottomRight, &quot;TOPRIGHT&quot;)
   RightEdge:SetWidth(16)
   RightEdge:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)
end

-- ------------------------------------
-- target of target and focus --目标的目标 和 焦点设置
-- ------------------------------------
if unit==&quot;targettarget&quot; or unit==&quot;focus&quot; then
  self:SetWidth(120)
  self:SetHeight(20)
  self.Health:SetHeight(14.5)
  self.Power:Show()
  self.Power:SetHeight(4
  self.Power.value:Hide()
  self.Health.value:Hide()
  self.Name:SetWidth(95)
  self.Name:SetHeight(18)
  self.Power:SetAlpha(1.0)
  self.Health:SetAlpha(1.0)

--
  -- raid target icons
  --
  self.RaidIcon = self.Health:CreateTexture(nil, &quot;OVERLAY&quot;)
  self.RaidIcon:SetHeight(16)
  self.RaidIcon:SetWidth(16)
  self.RaidIcon:SetPoint(&quot;RIGHT&quot;, self, 0, 9)
  self.RaidIcon:SetTexture&quot;InterfaceTargetingFrameUI-RaidTargetingIcons&quot;
  --
  -- oUF_BarFader
  --
  if unit==&quot;focus&quot; then
   self.BarFade = false
  end
end
-- ------------------------------------
-- party --小队的设置
-- ------------------------------------
if(self:GetParent():GetName():match&quot;oUF_Party&quot;) then
  self:SetWidth(180)
  self:SetHeight(20)
  self.Health:SetHeight(15)
  self.Power:SetHeight(3)
  self.Power.value:Hide()
  self.Health.value:SetPoint(&quot;RIGHT&quot;, 0 , 9)
  self.Name:SetPoint(&quot;LEFT&quot;, 0, 9)
  self.Power:SetAlpha(0.8)
  self.Health:SetAlpha(0.8)
  --
  -- Portrait (party) --小队头像的设置
  --
  if partyport == 1 then
  local portrait = CreateFrame(&quotlayerModel&quot;, nil, self)
  portrait:SetScript(&quot;OnShow&quot;, function(self) self:SetCamera(0) end)
  portrait:SetWidth(45)
  portrait:SetHeight(45)
  portrait:SetPoint(&quot;LEFT&quot;, self.Health, &quot;LEFT&quot;, -55, 11)
  portrait.type = &quot;3D&quot;
  self.Portrait = portrait
  table.insert(self.__elements, HidePortrait)
  local PartyPorBG = CreateFrame(&quot;Frame&quot;, nil, self) --小队头像背景材质设置
  local PPBG = PartyPorBG:CreateTexture(nil,&quot;BACKGROUND&quot;)
  PartyPorBG:SetPoint(&quot;LEFT&quot;, self.Health, &quot;LEFT&quot;, -57, 12)
  PartyPorBG:SetWidth(49)
  PartyPorBG:SetHeight(49)
  --PartyPorBG:SetFrameStrata(&quot;BACKGROUND&quot;) -- move the texture behind the portrait
  PPBG:SetTexture(PorBG)
  --TPBG:SetTexture(frameborder)
  PPBG:SetVertexColor(color_rb,color_gb,color_bb,alpha_fb)
  PPBG:SetAllPoints(PartyPorBG)
  PartyPorBG.texture = PPBG
  PartyPorBG:Show()
  else
  --
  end
  --
  -- buffs --小队buff设置
  --
  self.Buffs = CreateFrame(&quot;Frame&quot;, nil, self) -- buffs
  self.Buffs.size = 16
  self.Buffs:SetHeight(self.Buffs.size)
  self.Buffs:SetWidth(self.Buffs.size * 12)
  self.Buffs:SetPoint(&quot;BOTTOMLEFT&quot;, self, &quot;BOTTOMLEFT&quot;, -2, -23)
  self.Buffs.initialAnchor = &quot;BOTTOMLEFT&quot;
  --self.Buffs[&quot;growth-y&quot;] = &quot;TOP&quot;
  self.Buffs.num = 10
  self.Buffs.spacing = 2
  self.Buffs.filter = &quot;HELPFUL|PLAYER&quot;
  --
  -- debuffs --小队debuff设置
  --
  self.Debuffs = CreateFrame(&quot;Frame&quot;, nil, self)
  self.Debuffs.size = 20 * 1.3
  self.Debuffs:SetHeight(self.Debuffs.size)
  self.Debuffs:SetWidth(self.Debuffs.size * 5)
  self.Debuffs:SetPoint(&quot;LEFT&quot;, self, &quot;RIGHT&quot;, 8, 0)
  self.Debuffs.initialAnchor = &quot;TOPLEFT&quot;
  self.Debuffs.filter = false
  self.Debuffs.showDebuffType = true
  self.Debuffs.spacing = 2
  self.Debuffs.num = 8 -- max debuffs
  --
  -- raid target icons
  --
  self.RaidIcon = self.Health:CreateTexture(nil, &quot;OVERLAY&quot;)
  self.RaidIcon:SetHeight(24)
  self.RaidIcon:SetWidth(24)
  self.RaidIcon:SetPoint(&quot;LEFT&quot;, self, -30, 0)
  self.RaidIcon:SetTexture&quot;InterfaceTargetingFrameUI-RaidTargetingIcons&quot;
  -- party pet and target appearance --小队队友的宠物和目标设置
  if unit==&quot;partypet&quot; or unit==&quot;partytarget&quot; then
   self:SetWidth(75)
   self:SetHeight(12)
   self.Health:SetHeight(10)
   self.Power.value:Hide()
   self.Health.value:Hide()
   self.Power:SetHeight(2)
   self.Name:SetPoint(&quot;LEFT&quot;, 0, 9)
   self.Name:SetWidth(50)
  end
end
-- ------------------------------------
-- raid --团队设置
-- ------------------------------------
    if(self:GetParent():GetName():match&quot;oUF_Raid&quot;) then
  self:SetWidth(35)
  self:SetHeight(40)
  self.Health:SetOrientation(&quot;VERTICAL&quot;)
  self.Health:SetHeight(36)
  self.Health:SetFrameLevel(2)
  self.Health.value:SetPoint(&quot;TOP&quot;, 0, 6)
  self.Health.value:SetFont(font, 10, &quot;OUTLINE&quot;)
  self.Health:SetAlpha(0.8)
  self.Name:Hide()
  self.Power:SetFrameLevel(2)
  self.Power:SetHeight(3)
  self.Power:SetAlpha(0.8)
  self.Power.value:Hide()
  --
  -- Portrait (raid) --团队头像
  --
  if raidport == 1 then
  local portrait = CreateFrame(&quotlayerModel&quot;, nil, self)
  portrait:SetScript(&quot;OnShow&quot;, function(self) self:SetCamera(0) end)
  portrait:SetWidth(35)
  portrait:SetHeight(36)
  portrait:SetPoint(&quot;CENTER&quot;, self.Health, &quot;CENTER&quot;, 0, 0)
  --portrait:SetAlpha(0.4) -- change alpha for raid portraits here
  portrait.type = &quot;3D&quot;
  self.Portrait = portrait
  table.insert(self.__elements, HidePortrait)
  else
  --
  end
  --
  -- oUF_ReadyCheck support --团队就位框
  --
  self.ReadyCheck = self.Health:CreateTexture(nil, 'OVERLAY')
  self.ReadyCheck:SetPoint('CENTER', self, 0, -10)
  self.ReadyCheck:SetHeight(20)
  self.ReadyCheck:SetWidth(20)
    end
--
-- custom aura textures
--
self.PostCreateAuraIcon = auraIcon
self.SetAuraPosition = auraOffset
-- swing the magic stick ....
if(self:GetParent():GetName():match&quot;oUF_Party&quot;) or unit==&quot;targettarget&quot; or unit==&quot;focus&quot; or unit==&quot;player&quot; or unit==&quot;target&quot; or unit==&quot;pet&quot; or (self:GetParent():GetName():match&quot;oUF_Raid&quot;) then
  self:SetAttribute('initial-height', height)
  self:SetAttribute('initial-width', width)
else
  self:SetAttribute('initial-height', 12)
  self:SetAttribute('initial-width', 80)
  self.Name:SetPoint(&quot;LEFT&quot;, 0, 5)
  self.Health.value:Hide() -- hide partytarget/partypet health
  --self.Name:Hide()  -- hide partytarget/partypet name
  self.Power:Hide() -- hide powerbar
  self.Health:SetAlpha(0.8)
  --self.Power:SetAlpha(0.8)
end
return self
end

-- ------------------------------------------------------------------------
-- spawning the frames
-- ------------------------------------------------------------------------
--
-- normal frames
--
oUF:RegisterStyle(&quot;Asym&quot;, func)
oUF:SetActiveStyle(&quot;Asym&quot;)
local player = oUF:Spawn(&quot;player&quot;, &quot;oUF_Player&quot;)
player:SetPoint(&quot;CENTER&quot;, 0, -260) --自己头像的位置
local target = oUF:Spawn(&quot;target&quot;, &quot;oUF_Target&quot;)
target:SetPoint(&quot;CENTER&quot;, 270, -152) --目标头像的位置
local pet = oUF:Spawn(&quot;pet&quot;, &quot;oUF_Pet&quot;)
pet:SetPoint(&quot;RIGHT&quot;, player, 270, -11) --宝宝头像的位置
local tot = oUF:Spawn(&quot;targettarget&quot;, &quot;oUF_TargetTarget&quot;)
tot:SetPoint(&quot;BOTTOMRIGHT&quot;, target, 0, -40) --目标头像的位置
local focus = oUF:Spawn(&quot;focus&quot;, &quot;oUF_Focus&quot;)
focus:SetPoint(&quot;RIGHT&quot;, player, 270, 40) --焦点头像的位置
--
-- party
--
local party = oUF:Spawn(&quot;header&quot;, &quot;oUF_Party&quot;)
party:SetManyAttributes(&quot;showParty&quot;, true, &quot;yOffset&quot;, -58)
party:SetPoint(&quot;LEFT&quot;, 70, 50) -- default (&quot;LEFT&quot;, 70, -50) --小队头像的位置
party:Show()
-- party target
local partytarget = {}
for i = 1, 5 do
partytarget = oUF:Spawn('party'..i..'target', 'oUF_Party'..i..'Target')
if i == 1 then
  partytarget:SetPoint('BOTTOMRIGHT', party, 'TOPRIGHT', 0, 15)
else
  partytarget:SetPoint('TOP', partytarget[i-1], 'BOTTOM', 0, -67)
end
end
-- party pet
local partypet = {}
for i = 1, 4 do
partypet = oUF:Spawn('partypet'..i, 'oUF_PartyPet'..i)
partypet:SetPoint('RIGHT', partytarget, 'LEFT', -20, 0)
end
--
-- raid
--
local raid = {}
for i = 1, 8 do
local raidgroup = oUF:Spawn('header', 'oUF_Raid'..i)
raidgroup:SetManyAttributes('groupFilter', tostring(i), 'showRaid', true, 'yOffSet', -16)
table.insert(raid, raidgroup)
if(i==1) then
  raidgroup:SetPoint('TOPLEFT', UIParent, 'LEFT', 40, 55)
else
  raidgroup:SetPoint('TOPLEFT', raid[i-1], 'TOPRIGHT', 15, 0)
end
end
--
-- party toggle in raid
--
local partyToggle = CreateFrame('Frame')
partyToggle:RegisterEvent('PLAYER_LOGIN')
partyToggle:RegisterEvent('RAID_ROSTER_UPDATE')
partyToggle:RegisterEvent('PARTY_LEADER_CHANGED')
partyToggle:RegisterEvent('PARTY_MEMBERS_CHANGED')
partyToggle:SetScript('OnEvent', function(self)
if(InCombatLockdown()) then
  self:RegisterEvent('PLAYER_REGEN_ENABLED')
else
  self:UnregisterEvent('PLAYER_REGEN_ENABLED')
  if(GetNumRaidMembers() > 40) then --团队人员数量,超过这个人数将在团队中隐藏小队
   party:Hide()
   for i,v in ipairs(raid) do v:Show() end
   for i,v in ipairs(partypet) do visable() end
   for i,v in ipairs(partytarget) do visable() end
  else
   party:Show()
   for i,v in ipairs(raid) do v:Hide() end
   for i,v in ipairs(partypet) do v:Enable() end
   for i,v in ipairs(partytarget) do v:Enable() end
  end
end
end)

※实例2、Kyron的oUF_Caellian

作者:kyron
下载地址:http://www.wowinterface.com/downloads/info9974-oUF_Caellian.html
多玩分流:http://wowui.duowan.com/html/AddOns/1/1/20081105/1286.html

代码篇幅过长,换42楼点击进入更新~



[ 本帖最后由 vans67 于 2009-7-5 12:56 编辑 ]
回复 支持 反对

使用道具 举报

发表于 2015-8-13 21:05:27 | 显示全部楼层
〓介绍一些优秀的oUF〓













      还有很多就不一一罗列了,其实ouf是一款自由度非常高的头像插件,但是因为其设置比传统的头像要复杂许多,关系到很多代码的编写运用和材质导入使用等问题,使得大部分的玩家都宁可选择设置比较简单的Ag或者Xperl之类带GUI(设置界面)的头像插件,毕竟不是每个人都有耐心为了测试代码是否达到预期的效果而进行不断上下线等频繁修改操作


     不过,ouf其占用资源较小,自由度高,且简洁大方的优点还是吸引了不少玩家的青睐~简单了介绍了下一些代码使用和个别实例代码分析,希望有兴趣的玩家,在关服期间能找到一款感觉不错的ouf layout文件学着修改参数,制作属于自己风格的头像插件~有关代码设置不懂的地方可以在坛子里发帖提问




[ 本帖最后由 vans67 于 2009-7-3 19:31 编辑 ]
回复 支持 反对

使用道具 举报

发表于 2015-8-13 21:09:45 | 显示全部楼层
一樓一片茫茫然不知所以然~完全空白呀~

看在OUF和飯版的面子上一定要頂,但是~我絕對懷疑這帖子有多少人會從頭看到尾~
回复 支持 反对

使用道具 举报

发表于 2015-8-13 21:12:00 | 显示全部楼层
人家覺得,OUF還是讓他去小眾吧~以目前的情況來看,OUF不可能在多玩流行起來的。
我們就是高端玩家,就喜歡玩別人玩不會的東西~WOHOHOHO

其實我每次修改文件也都是直接搜索句頭,畢竟句頭是不會變的。讓我一點一點看我也沒耐心的~
回复 支持 反对

使用道具 举报

发表于 2015-8-13 21:13:54 | 显示全部楼层
没事普及下,玩游戏的过程中学点东西也未必不是件好事
回复 支持 反对

使用道具 举报

发表于 2015-8-13 21:17:57 | 显示全部楼层
毛主席教導我們要活到老學到老,支持X頭飯!
回复 支持 反对

使用道具 举报

发表于 2015-8-13 21:18:46 | 显示全部楼层
看完后,還是一片迷茫...哈哈[ddt3]
回复 支持 反对

使用道具 举报

发表于 2015-8-13 21:22:25 | 显示全部楼层
黑压压的字

弄个傻瓜教程 不是更好~

1G燃P:搜索字头怎么怎么搞
回复 支持 反对

使用道具 举报

发表于 2015-8-13 21:25:21 | 显示全部楼层
这种东西傻瓜不起来。。

1G燃P??

搜索:用文本编辑器打开lua文件,ctrl+f

字头就是一些比较死的字词句,譬如显示团队是showraid ,搜索找到后就可以改变后面相应的值true/false(显示/不显示)
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 加入我们

本版积分规则

小黑屋|手机版|Archiver|LUACN论坛

GMT+8, 2025-5-3 07:18 PM , Processed in 0.065076 second(s), 32 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表