raid: switch to flat config format
This commit is contained in:
@@ -12,9 +12,9 @@ local module = ShaguTweaks:register({
|
|||||||
|
|
||||||
module.enable = function(self)
|
module.enable = function(self)
|
||||||
-- overwrite config
|
-- overwrite config
|
||||||
ShaguTweaksRaidCluster.config.width = 64
|
ShaguTweaksRaidCluster.config["raid.width"] = 64
|
||||||
ShaguTweaksRaidCluster.config.height = 12
|
ShaguTweaksRaidCluster.config["raid.height"] = 12
|
||||||
ShaguTweaksRaidCluster.config.rows = 40
|
ShaguTweaksRaidCluster.config["raid.rows"] = 40
|
||||||
|
|
||||||
-- disable mana bars
|
-- disable mana bars
|
||||||
ShaguTweaks.UnitFrame_NewComponent('compact layout', {
|
ShaguTweaks.UnitFrame_NewComponent('compact layout', {
|
||||||
|
|||||||
+2
-2
@@ -52,8 +52,8 @@ module.enable = function(self)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- set raid frame size
|
-- set raid frame size
|
||||||
raid.cluster:SetWidth(x * (raid.cluster.config.width+2) + 6)
|
raid.cluster:SetWidth(x * (raid.cluster.config["raid.width"]+2) + 6)
|
||||||
raid.cluster:SetHeight(y * (raid.cluster.config.height+1) + 7)
|
raid.cluster:SetHeight(y * (raid.cluster.config["raid.height"]+1) + 7)
|
||||||
raid:Show()
|
raid:Show()
|
||||||
else
|
else
|
||||||
raid:Hide()
|
raid:Hide()
|
||||||
|
|||||||
+14
-12
@@ -10,11 +10,10 @@ local module = ShaguTweaks:register({
|
|||||||
maintainer = "@shagu (GitHub)",
|
maintainer = "@shagu (GitHub)",
|
||||||
enabled = true,
|
enabled = true,
|
||||||
config = {
|
config = {
|
||||||
raid = {
|
["raid.width"] = 64,
|
||||||
width = 64,
|
["raid.height"] = 32,
|
||||||
height = 32,
|
["raid.rows"] = 10,
|
||||||
rows = 10
|
["raid.scale"] = 1,
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -156,11 +155,11 @@ end
|
|||||||
|
|
||||||
local CreateUnitFrame = function(parent, i)
|
local CreateUnitFrame = function(parent, i)
|
||||||
local frame = parent.frames[i] or CreateFrame("Button", "ShaguTweaksRaidUnitFrame"..i, parent)
|
local frame = parent.frames[i] or CreateFrame("Button", "ShaguTweaksRaidUnitFrame"..i, parent)
|
||||||
local left, top = GetFramePosition(i, parent.config.rows)
|
local left, top = GetFramePosition(i, parent.config["raid.rows"])
|
||||||
|
|
||||||
frame:SetPoint("TOPLEFT", (left-1)*(parent.config.width+2) + 4, -(top-1)*(parent.config.height + 1) - 4)
|
frame:SetPoint("TOPLEFT", (left-1)*(parent.config["raid.width"]+2) + 4, -(top-1)*(parent.config["raid.height"] + 1) - 4)
|
||||||
frame:SetWidth(parent.config.width)
|
frame:SetWidth(parent.config["raid.width"])
|
||||||
frame:SetHeight(parent.config.height)
|
frame:SetHeight(parent.config["raid.height"])
|
||||||
|
|
||||||
frame.unitstr = "raid"..i
|
frame.unitstr = "raid"..i
|
||||||
frame.left = left
|
frame.left = left
|
||||||
@@ -504,14 +503,17 @@ module.enable = function(self)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- set raid frame size
|
-- set raid frame size
|
||||||
raid.cluster:SetWidth(x * (raid.cluster.config.width+2) + 6)
|
raid.cluster:SetWidth(x * (raid.cluster.config["raid.width"]+2) + 6)
|
||||||
raid.cluster:SetHeight(y * (raid.cluster.config.height+1) + 7)
|
raid.cluster:SetHeight(y * (raid.cluster.config["raid.height"]+1) + 7)
|
||||||
raid:Show()
|
raid:Show()
|
||||||
else
|
else
|
||||||
raid:Hide()
|
raid:Hide()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- assign defaul scale
|
||||||
|
raid:SetScale(module.config["raid.scale"])
|
||||||
|
|
||||||
do -- toggle button
|
do -- toggle button
|
||||||
-- create toggle button
|
-- create toggle button
|
||||||
raid.toggle = CreateFrame("Button", "ShaguTweaksRaidToggle", raid)
|
raid.toggle = CreateFrame("Button", "ShaguTweaksRaidToggle", raid)
|
||||||
@@ -604,6 +606,6 @@ module.enable = function(self)
|
|||||||
ShaguTweaks.DarkenFrame(raid.cluster)
|
ShaguTweaks.DarkenFrame(raid.cluster)
|
||||||
|
|
||||||
-- assign default config
|
-- assign default config
|
||||||
raid.cluster.config = module.config.raid
|
raid.cluster.config = module.config
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user