clicks fix

This commit is contained in:
Sumsebrum 2021-06-20 00:55:06 +02:00
parent 2988177128
commit 0d7bd3c688
2 changed files with 14 additions and 7 deletions

View File

@ -311,17 +311,18 @@ function Gladdy:CreateButton(i)
local secure = CreateFrame("Button", "GladdyButton" .. i, button, "SecureActionButtonTemplate, SecureHandlerEnterLeaveTemplate") local secure = CreateFrame("Button", "GladdyButton" .. i, button, "SecureActionButtonTemplate, SecureHandlerEnterLeaveTemplate")
secure:RegisterForClicks("AnyUp") secure:RegisterForClicks("AnyUp")
secure:SetAttribute("*type*", "macro") secure:RegisterForClicks("AnyDown")
--secure:SetAttribute("*type*", "macro")
--secure:SetAttribute("*type1", "target") --secure:SetAttribute("*type1", "target")
--secure:SetAttribute("*type2", "focus") --secure:SetAttribute("*type2", "focus")
--secure:SetAttribute("unit", "target")
secure:SetAttribute("unit", "arena" .. i) secure:SetAttribute("unit", "arena" .. i)
--secure:SetAttribute("unit", i == 1 and "player" or "focus")
--secure.texture = secure:CreateTexture(nil, "OVERLAY") --secure.texture = secure:CreateTexture(nil, "OVERLAY")
--secure.texture:SetAllPoints(secure) --secure.texture:SetAllPoints(secure)
--secure.texture:SetTexture("Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp") --secure.texture:SetTexture("Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp")
button.id = i button.id = i
--button.unit = "target" --button.unit = i == 1 and "player" or "focus"
button.unit = "arena" .. i button.unit = "arena" .. i
button.secure = secure button.secure = secure

View File

@ -120,18 +120,24 @@ function Clicks:SetupAttributes(unit)
end end
function Clicks:SetupAttribute(button, key, mod, action, spell) function Clicks:SetupAttribute(button, key, mod, action, spell)
local attr = mod .. "macrotext" .. key local attr = ""
local text = "" local text = ""
if (action == "macro") then if (action == "macro") then
attr = mod .. "macrotext" .. key
text = spell:gsub("%*arena%*", button.unit) text = spell:gsub("%*arena%*", button.unit)
button.secure:SetAttribute(mod .. "type" .. key, "macro")
elseif (action ~= "disabled") then elseif (action ~= "disabled") then
if (action == "target") then if (action == "target") then
text = "/target [@" .. button.unit .. "]" attr = mod .. "type" .. key
text = "target"
elseif (action == "focus") then elseif (action == "focus") then
text = "/focus [@" .. button.unit .. "]" attr = mod .. "type" .. key
text = "focus"
elseif (action == "spell") then elseif (action == "spell") then
text = "/cast [@" .. button.unit .. "] " .. spell attr = mod .. "type" .. key
text = "spell"
button.secure:SetAttribute(mod .. "spell" .. key, spell)
end end
end end