魔兽世界oUF_DD 头像插件怎么调节大小

发布网友 发布时间:2022-04-21 21:27

我来回答

1个回答

热心网友 时间:2023-09-29 01:16

  我是个程序白痴,只能用网上找到的一个教程来给你看看了
  如果感觉能找到希望采纳

  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.144660941, 0.85355339059, 0.144660941, 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.144660941, 0.85355339059, 0.144660941, 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

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com