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