ouf_mono头像插件如何修改血条颜色 台服4.1版本
展开全部
简介 oUF是个自定义很强的头像插件....布局是通过自己定义layout文件来实现的. 无命令设置, 适合中高级玩家,当然不会修改的也可以直接通过下载别人的layout来享受下 ^ ^
0611PM23:41版本 字体指向至魔兽世界根目录"Fonts\\ZYhei.ttf" 不在需要重复安装字体!未更改默认字体的请在魔兽根目录下安装Fonts文件夹及Zyhei.ttf!0611更改了素材 修正了HP显示比例 添加PVP 休息=标记,添加焦点目标,,,其他等等依然未添加,,,
======简单教程=======
CENTER 中心点(屏幕中心)如("CENTER", -220, -260) 就是以屏幕中心点为基准窗体偏移量的一个设置!
TOPLEFT 屏幕左上
TOPRIGHT 屏幕右上
BOTTOMLEFT 屏幕左下
BOTTOMRIGHT 屏幕右下! 先区分你要修改的窗体位置。然后搞明白你要修改到何处!
偏移量 0(横向), 0(纵向)
如:player:SetPoint("CENTER", -220, -260)
玩家窗体窗体为屏幕中心点横向-220 纵向-260处。
pettarget:SetPoint("TOPRIGHT", player, "BOTTOMRIGHT", 0, -20
窗体跟随 此句的意思表达为 宠物窗体 跟随玩家窗体 位置在玩家窗体右下方 0 -20 是以玩家窗体的为基准的一个偏移量!如我修改的焦点,原版是不跟随的,但我修改为
focus:SetPoint("TOPLEFT", player, "TOPLEFT", 0, 50) 就变成了焦点跟随玩家窗体左上方
-- Spawn the frames we want
local player = oUF:Spawn"player"
player:SetPoint("CENTER", -220, -260) 玩家窗体设置!
player:SetHeight(30) 高度
player:SetWidth(220)宽度
local target = oUF:Spawn"target"
target:SetPoint("CENTER", 220, -260) 目标窗体
target:SetHeight(30)
target:SetWidth(220)
local pet = oUF:Spawn"pet"
pet:SetPoint("TOPLEFT", player, "BOTTOMLEFT", 0, -20) 宠物窗体
pet:SetHeight(22)
pet:SetWidth(145)
local pettarget = oUF:Spawn"pettarget"
pettarget:SetPoint("TOPRIGHT", player, "BOTTOMRIGHT", 0, -20) 宠物目标
pettarget:SetHeight(22)
pettarget:SetWidth(145)
local tot = oUF:Spawn"targettarget"
tot:SetPoint("CENTER", 0, -260) 目标的目标
tot:SetHeight(10)
tot:SetWidth(160)
local focus = oUF:Spawn"focus" 焦点
focus:SetPoint("TOPLEFT", player, "TOPLEFT", 0, 50)
focus:SetHeight(10)
focus:SetWidth(140)
----------------------------
队友设置
----------------------------
local party = oUF:Spawn("party")
party:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 15, -200) 偏移量 及位置信息
party:SetManyAttributes("showParty", true, "yOffset", -50) 间距及延伸方向 是否显示小队
party:SetAttribute("showRaid", false)将团队显示与小队显示在一块...即true为团队时在小队后面递增添加团队模块....false只显示小队不显示团队!
local party1target = oUF:Spawn("party1target") 队伍1 目标 以下,2 3 4
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)
就是死性不改 提供的一些代码。。。同志们一起感谢!
为OUF的自己和目标加3D头像,打开layout.lua,在最后加上这段代码:
--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 --- 这里是需要在右边加头像的框体
portrait:SetPoint("RIGHT", 36, 0) --头像的位置
elseif (unit == "player" or self:GetParent():GetName() == "oUF_Party") then -- 这里是需要在左边加头像的框体
portrait:SetPoint("LEFT", -36, 0) -- 头像的位置
end
self.Portrait = portrait
--3D头像
local portrait = CreateFrame("PlayerModel", 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 == "target") 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
--头像背景设置
local portraitbg = portrait:CreateTexture(nil, "BORDER")
portraitbg:SetAllPoints(portrait)
portraitbg:SetTexture(tex)
portraitbg:SetTexture(0, 0, 0, 1)
------------------------ 我是传说中的分割线 ----------------------
或者都复制进去,加上一个判断,需要2D或者3D修改一个字就行了,代码如下:
-- 加入头像判断 ---
local viewtype = "2D" -- 2D - 头像显示为2D模式,3D - 头像为3D模式.
-- 3D模式
if viewtype == "3D" then
local portrait = CreateFrame("PlayerModel", 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
--头像背景
local portraitbg = portrait:CreateTexture(nil, "BORDER")
portraitbg:SetAllPoints(portrait)
portraitbg:SetTexture(tex)
portraitbg:SetTexture(0, 0, 0, 1)
-- 2D模式
elseif viewtype == "2D" then
local portrait = self:CreateTexture(nil, "OVERLAY")
portrait.type = "2D"
portrait:SetTexCoord(0.14644660941, 0.85355339059, 0.14644660941, 0.85355339059)
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
-- 头像背景
local portraitbg = self:CreateTexture(nil, "BORDER")
portraitbg:SetAllPoints(portrait)
portraitbg:SetTexture(tex)
portraitbg:SetTexture(0, 0, 0, 1)
end
如果想移动头像位置(同时按住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
如果想设置头像大小,就加上这段:
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
--------------------------------------------
-- 显示玩家的小队
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 <= numRaidMembers ) then
name, rank, subgroup = GetRaidRosterInfo(i);
-- Set the player's group number indicator
if ( name == UnitName(unit) ) then
numText = " "..subgroup.."小队";
end
end
end
end
RaidPartyNum:SetText(numText)
RaidPartyNum:SetTextColor(1, 1, 1)
end
if self.RaidPartyNum then
updatePartyNum(self, event, unit)
end
-- 玩家小队的显示位置
local RaidPartyNum
RaidPartyNum = pp:CreateFontString(nil, "OVERLAY")
RaidPartyNum:SetPoint("TOP", portrait, "TOP", 0, 15) -- 我设置的是显示在头像正上方
RaidPartyNum:SetFont(font, fontHeight)
RaidPartyNum:SetShadowColor(0, 0, 0)
RaidPartyNum:SetShadowOffset(0.8, -0.8)
self.RaidPartyNum = RaidPartyNum
0611PM23:41版本 字体指向至魔兽世界根目录"Fonts\\ZYhei.ttf" 不在需要重复安装字体!未更改默认字体的请在魔兽根目录下安装Fonts文件夹及Zyhei.ttf!0611更改了素材 修正了HP显示比例 添加PVP 休息=标记,添加焦点目标,,,其他等等依然未添加,,,
======简单教程=======
CENTER 中心点(屏幕中心)如("CENTER", -220, -260) 就是以屏幕中心点为基准窗体偏移量的一个设置!
TOPLEFT 屏幕左上
TOPRIGHT 屏幕右上
BOTTOMLEFT 屏幕左下
BOTTOMRIGHT 屏幕右下! 先区分你要修改的窗体位置。然后搞明白你要修改到何处!
偏移量 0(横向), 0(纵向)
如:player:SetPoint("CENTER", -220, -260)
玩家窗体窗体为屏幕中心点横向-220 纵向-260处。
pettarget:SetPoint("TOPRIGHT", player, "BOTTOMRIGHT", 0, -20
窗体跟随 此句的意思表达为 宠物窗体 跟随玩家窗体 位置在玩家窗体右下方 0 -20 是以玩家窗体的为基准的一个偏移量!如我修改的焦点,原版是不跟随的,但我修改为
focus:SetPoint("TOPLEFT", player, "TOPLEFT", 0, 50) 就变成了焦点跟随玩家窗体左上方
-- Spawn the frames we want
local player = oUF:Spawn"player"
player:SetPoint("CENTER", -220, -260) 玩家窗体设置!
player:SetHeight(30) 高度
player:SetWidth(220)宽度
local target = oUF:Spawn"target"
target:SetPoint("CENTER", 220, -260) 目标窗体
target:SetHeight(30)
target:SetWidth(220)
local pet = oUF:Spawn"pet"
pet:SetPoint("TOPLEFT", player, "BOTTOMLEFT", 0, -20) 宠物窗体
pet:SetHeight(22)
pet:SetWidth(145)
local pettarget = oUF:Spawn"pettarget"
pettarget:SetPoint("TOPRIGHT", player, "BOTTOMRIGHT", 0, -20) 宠物目标
pettarget:SetHeight(22)
pettarget:SetWidth(145)
local tot = oUF:Spawn"targettarget"
tot:SetPoint("CENTER", 0, -260) 目标的目标
tot:SetHeight(10)
tot:SetWidth(160)
local focus = oUF:Spawn"focus" 焦点
focus:SetPoint("TOPLEFT", player, "TOPLEFT", 0, 50)
focus:SetHeight(10)
focus:SetWidth(140)
----------------------------
队友设置
----------------------------
local party = oUF:Spawn("party")
party:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 15, -200) 偏移量 及位置信息
party:SetManyAttributes("showParty", true, "yOffset", -50) 间距及延伸方向 是否显示小队
party:SetAttribute("showRaid", false)将团队显示与小队显示在一块...即true为团队时在小队后面递增添加团队模块....false只显示小队不显示团队!
local party1target = oUF:Spawn("party1target") 队伍1 目标 以下,2 3 4
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)
就是死性不改 提供的一些代码。。。同志们一起感谢!
为OUF的自己和目标加3D头像,打开layout.lua,在最后加上这段代码:
--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 --- 这里是需要在右边加头像的框体
portrait:SetPoint("RIGHT", 36, 0) --头像的位置
elseif (unit == "player" or self:GetParent():GetName() == "oUF_Party") then -- 这里是需要在左边加头像的框体
portrait:SetPoint("LEFT", -36, 0) -- 头像的位置
end
self.Portrait = portrait
--3D头像
local portrait = CreateFrame("PlayerModel", 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 == "target") 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
--头像背景设置
local portraitbg = portrait:CreateTexture(nil, "BORDER")
portraitbg:SetAllPoints(portrait)
portraitbg:SetTexture(tex)
portraitbg:SetTexture(0, 0, 0, 1)
------------------------ 我是传说中的分割线 ----------------------
或者都复制进去,加上一个判断,需要2D或者3D修改一个字就行了,代码如下:
-- 加入头像判断 ---
local viewtype = "2D" -- 2D - 头像显示为2D模式,3D - 头像为3D模式.
-- 3D模式
if viewtype == "3D" then
local portrait = CreateFrame("PlayerModel", 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
--头像背景
local portraitbg = portrait:CreateTexture(nil, "BORDER")
portraitbg:SetAllPoints(portrait)
portraitbg:SetTexture(tex)
portraitbg:SetTexture(0, 0, 0, 1)
-- 2D模式
elseif viewtype == "2D" then
local portrait = self:CreateTexture(nil, "OVERLAY")
portrait.type = "2D"
portrait:SetTexCoord(0.14644660941, 0.85355339059, 0.14644660941, 0.85355339059)
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
-- 头像背景
local portraitbg = self:CreateTexture(nil, "BORDER")
portraitbg:SetAllPoints(portrait)
portraitbg:SetTexture(tex)
portraitbg:SetTexture(0, 0, 0, 1)
end
如果想移动头像位置(同时按住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
如果想设置头像大小,就加上这段:
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
--------------------------------------------
-- 显示玩家的小队
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 <= numRaidMembers ) then
name, rank, subgroup = GetRaidRosterInfo(i);
-- Set the player's group number indicator
if ( name == UnitName(unit) ) then
numText = " "..subgroup.."小队";
end
end
end
end
RaidPartyNum:SetText(numText)
RaidPartyNum:SetTextColor(1, 1, 1)
end
if self.RaidPartyNum then
updatePartyNum(self, event, unit)
end
-- 玩家小队的显示位置
local RaidPartyNum
RaidPartyNum = pp:CreateFontString(nil, "OVERLAY")
RaidPartyNum:SetPoint("TOP", portrait, "TOP", 0, 15) -- 我设置的是显示在头像正上方
RaidPartyNum:SetFont(font, fontHeight)
RaidPartyNum:SetShadowColor(0, 0, 0)
RaidPartyNum:SetShadowOffset(0.8, -0.8)
self.RaidPartyNum = RaidPartyNum
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询