raid: add layouts and raidcluster frame

This commit is contained in:
shagu
2020-04-02 17:54:30 +02:00
parent 3086acde21
commit 66fbc6c205
3 changed files with 59 additions and 16 deletions
+4
View File
@@ -303,6 +303,10 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "raid", "txthpright", "healthmiss")
pfUI:UpdateConfig("unitframes", "raid", "overhealperc", "10")
pfUI:UpdateConfig("unitframes", "raid", "raidlayout", "8x5")
pfUI:UpdateConfig("unitframes", "raid", "raidpadding", "3")
pfUI:UpdateConfig("unitframes", "raid", "raidfill", "VERTICAL")
pfUI:UpdateConfig("unitframes", "ttarget", "width", "100")
pfUI:UpdateConfig("unitframes", "ttarget", "height", "17")
pfUI:UpdateConfig("unitframes", "ttarget", "pheight", "3")
+17
View File
@@ -950,6 +950,16 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
"8:" .. T["Slow"],
"16:" .. T["Very Slow"],
},
["uf_raidlayout"] = {
"1x40:" .. T["1x40"],
"2x20:" .. T["2x20"],
"4x10:" .. T["4x10"],
"5x8:" .. T["5x8"],
"8x5:" .. T["8x5"],
"10x4:" .. T["10x4"],
"20x2:" .. T["20x2"],
"40x1:" .. T["40x1"],
},
["uf_powerbar_position"] = {
"TOPLEFT:" .. T["Left"],
"TOP:" .. T["Center"],
@@ -1654,6 +1664,13 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
CreateConfig(U[c], T["Show Class Buff Indicators"], C.unitframes[c], "buff_indicator", "checkbox")
CreateConfig(U[c], T["Display Overheal"], C.unitframes[c], "overhealperc", "dropdown", pfUI.gui.dropdowns.uf_overheal)
if c == "raid" then
CreateConfig(U[c], T["Layout"], nil, nil, "header")
CreateConfig(U["raid"], T["Raid Padding"], C.unitframes[c], "raidpadding")
CreateConfig(U["raid"], T["Raid Layout"], C.unitframes[c], "raidlayout", "dropdown", pfUI.gui.dropdowns.uf_raidlayout)
CreateConfig(U["raid"], T["Raid Fill Direction"], C.unitframes[c], "raidfill", "dropdown", pfUI.gui.dropdowns.orientation)
end
CreateConfig(U[c], T["Healthbar"], nil, nil, "header")
CreateConfig(U[c], T["Health Bar Width"], C.unitframes[c], "width")
CreateConfig(U[c], T["Health Bar Height"], C.unitframes[c], "height")
+38 -16
View File
@@ -4,7 +4,13 @@ pfUI:RegisterModule("raid", "vanilla:tbc", function ()
local rawborder, default_border = GetBorderSize("unitframes")
pfUI.uf.raid = CreateFrame("Button","pfRaid",UIParent)
pfUI.uf.raid = CreateFrame("Button", "pfRaidCluster", UIParent)
pfUI.uf.raid:SetWidth(120)
pfUI.uf.raid:SetHeight(10)
pfUI.uf.raid:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", default_border*2, C.chat.left.height + default_border*5)
pfUI.uf.raid:SetFrameLevel(20)
pfUI.uf.raid:Hide()
UpdateMovable(pfUI.uf.raid)
pfUI.uf.raid.tanksfirst = {
["PF_TANK_TOGGLE"] = { T["Toggle as Tank"], "toggleTank" }
@@ -14,28 +20,44 @@ pfUI:RegisterModule("raid", "vanilla:tbc", function ()
pfUI.uf.raid.tankrole = { }
function pfUI.uf.raid:UpdateConfig()
for i=1, 40 do
local rawborder, default_border = GetBorderSize("unitframes")
for i=1,40 do
pfUI.uf.raid[i] = pfUI.uf.raid[i] or pfUI.uf:CreateUnitFrame("Raid", i, C.unitframes.raid)
pfUI.uf.raid[i]:SetParent(pfUI.uf.raid)
pfUI.uf.raid[i]:SetFrameLevel(5)
pfUI.uf.raid[i]:UpdateConfig()
end
end
for r=1, 8 do
for g=1, 5 do
local i = g + 5*(r-1)
pfUI.uf.raid[i] = pfUI.uf:CreateUnitFrame("Raid", i, C.unitframes.raid)
pfUI.uf.raid[i]:UpdateFrameSize()
end
local spacing = pfUI.uf.raid[i].config.pspace
local width = pfUI.uf.raid[i].config.width
local height = pfUI.uf.raid[i].config.height
local pheight = pfUI.uf.raid[i].config.pheight
local real_height = height + spacing + pheight + 2*default_border
local i = 1
local width = pfUI.uf.raid[1]:GetWidth()+2*default_border
local height = pfUI.uf.raid[1]:GetHeight()+2*default_border
local layout = pfUI.uf.raid[1].config.raidlayout
local padding = tonumber(pfUI.uf.raid[1].config.raidpadding)*GetPerfectPixel()
local fill = pfUI.uf.raid[1].config.raidfill
local _, _, x, y = string.find(layout,"(.+)x(.+)")
x, y = tonumber(x), tonumber(y)
pfUI.uf.raid[i]:SetPoint("BOTTOMLEFT", (r-1) * (width+3*default_border) + 5, C.chat.left.height + default_border + 10 + (g-1)*(real_height+3*default_border))
UpdateMovable(pfUI.uf.raid[i])
if fill == "VERTICAL" then
for r=1, x do for g=1, y do
pfUI.uf.raid[i]:ClearAllPoints()
pfUI.uf.raid[i]:SetPoint("BOTTOMLEFT", (r-1)*(padding+width), (g-1)*(padding+height))
UpdateMovable(pfUI.uf.raid[i], true)
i = i + 1
end end
else
for g=1, y do for r=1, x do
pfUI.uf.raid[i]:ClearAllPoints()
pfUI.uf.raid[i]:SetPoint("BOTTOMLEFT", (r-1)*(padding+width), (g-1)*(padding+height))
UpdateMovable(pfUI.uf.raid[i], true)
i = i + 1
end end
end
end
pfUI.uf.raid:UpdateConfig()
local function SetRaidIndex(frame, id)
frame.id = id