testmode only movable frames

This commit is contained in:
Sumsebrum 2021-09-25 14:03:57 +02:00
parent fabd9ae048
commit ebb56c4127
7 changed files with 45 additions and 27 deletions

View File

@ -305,6 +305,7 @@ end
function Gladdy:ToggleFrame(i) function Gladdy:ToggleFrame(i)
self:Reset() self:Reset()
if (self.frame and self.frame:IsShown() and i == self.curBracket) then if (self.frame and self.frame:IsShown() and i == self.curBracket) then
self.frame.testing = nil
self:HideFrame() self:HideFrame()
else else
self.curBracket = i self.curBracket = i
@ -312,6 +313,7 @@ function Gladdy:ToggleFrame(i)
if (not self.frame) then if (not self.frame) then
self:CreateFrame() self:CreateFrame()
end end
self.frame.testing = true
for o = 1, self.curBracket do for o = 1, self.curBracket do
local unit = "arena" .. o local unit = "arena" .. o

View File

@ -8,10 +8,10 @@ local tsort = table.sort
local str_lower = string.lower local str_lower = string.lower
local math_abs = math.abs local math_abs = math.abs
local GetTime = GetTime local GetTime = GetTime
local InCombatLockdown = InCombatLockdown
local CreateFrame = CreateFrame local CreateFrame = CreateFrame
local DEFAULT_CHAT_FRAME = DEFAULT_CHAT_FRAME local DEFAULT_CHAT_FRAME = DEFAULT_CHAT_FRAME
local IsAddOnLoaded = IsAddOnLoaded local IsAddOnLoaded = IsAddOnLoaded
local IsInInstance = IsInInstance
local GetBattlefieldStatus = GetBattlefieldStatus local GetBattlefieldStatus = GetBattlefieldStatus
local IsActiveBattlefieldArena = IsActiveBattlefieldArena local IsActiveBattlefieldArena = IsActiveBattlefieldArena
local RELEASE_TYPES = { alpha = "Alpha", beta = "Beta", release = "Release"} local RELEASE_TYPES = { alpha = "Alpha", beta = "Beta", release = "Release"}
@ -173,23 +173,28 @@ function Gladdy:NewModule(name, priority, defaults)
return module return module
end end
function Gladdy:CreateMover(frame, x, y, name, points) function Gladdy:CreateMover(frame, xConfig, yConfig, name, points, width, height, xOffset, yOffset)
if not frame.mover then if not frame.mover then
frame.mover = CreateFrame("Frame", nil, frame, BackdropTemplateMixin and "BackdropTemplate") frame.mover = CreateFrame("Frame", nil, frame, BackdropTemplateMixin and "BackdropTemplate")
frame.mover:SetFrameStrata("TOOLTIP") frame.mover:SetFrameStrata("DIALOG")
frame.mover:SetPoint(points[1], frame, points[2], 0, 0) frame.mover:SetPoint(points[1], frame, points[2], xOffset or 0, yOffset or 0)
frame.mover:SetHeight(height or frame:GetHeight())
frame.mover:SetWidth(width or frame:GetWidth())
local backdrop = { local backdrop = {
bgFile = "Interface/Tooltips/UI-Tooltip-Background", bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "", edgeFile = "",
tile = true, tileSize = 16, edgeSize = 10, tile = true, tileSize = 16, edgeSize = 10,
insets = {left = 0, right = 0, top = 0, bottom = 0} insets = {left = 0, right = 0, top = 0, bottom = 0}
} }
frame.mover:SetBackdrop(backdrop) frame.mover:SetBackdrop(backdrop)
frame.mover:SetBackdropColor(0,0,0,0.8) frame.mover:SetBackdropColor(0,1,0,0.5)
frame.mover:SetHeight(15) frame.mover.border = CreateFrame("Frame", nil, frame.mover, BackdropTemplateMixin and "BackdropTemplate")
frame.mover:SetWidth(60) frame.mover.border:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "highlightBorderStyle"), edgeSize = 2 })
frame.mover.text = frame.mover:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") frame.mover.border:SetAllPoints(frame.mover)
frame.mover.border:SetBackdropBorderColor(0,1,0,1)
frame.mover.text = frame.mover.border:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
frame.mover.text:SetText(name) frame.mover.text:SetText(name)
frame.mover.text:SetPoint("CENTER") frame.mover.text:SetPoint("CENTER")
@ -212,15 +217,21 @@ function Gladdy:CreateMover(frame, x, y, name, points)
diffY = self.start[2] > self.stop[2] and -diffY or diffY diffY = self.start[2] > self.stop[2] and -diffY or diffY
frame:ClearAllPoints() frame:ClearAllPoints()
frame:SetPoint(self.point[1], self.point[2], self.point[3], self.point[4] + diffX, self.point[5] + diffY) frame:SetPoint(self.point[1], self.point[2], self.point[3], self.point[4] + diffX, self.point[5] + diffY)
Gladdy.db[x] = self.point[4] + diffX Gladdy.db[xConfig] = self.point[4] + diffX
Gladdy.db[y] = self.point[5] + diffY Gladdy.db[yConfig] = self.point[5] + diffY
Gladdy:UpdateFrame() Gladdy:UpdateFrame()
end) end)
else else
frame.mover:ClearAllPoints() frame.mover:ClearAllPoints()
frame.mover:SetPoint(points[1], frame, points[2], 0, 0) frame.mover:SetPoint(points[1], frame, points[2], xOffset or 0, yOffset or 0)
frame.mover:SetHeight(height or frame:GetHeight())
frame.mover:SetWidth(width or frame:GetWidth())
end
if self.frame and self.frame.testing then
frame.mover:Show()
else
frame.mover:Hide()
end end
end end
--------------------------- ---------------------------
@ -298,7 +309,6 @@ function Gladdy:OnInitialize()
self.guids = {} self.guids = {}
self.curBracket = nil self.curBracket = nil
self.curUnit = 1 self.curUnit = 1
self.lastInstance = nil
self:SetupOptions() self:SetupOptions()
@ -402,16 +412,10 @@ function Gladdy:PLAYER_ENTERING_WORLD()
LibStub("AceConfigDialog-3.0"):Open("Gladdy", nil, LibStub("AceConfigDialog-3.0"):SelectGroup("Gladdy", "XiconProfiles")) LibStub("AceConfigDialog-3.0"):Open("Gladdy", nil, LibStub("AceConfigDialog-3.0"):SelectGroup("Gladdy", "XiconProfiles"))
self.showConfig = nil self.showConfig = nil
end end
local instance = select(2, IsInInstance()) if (self.frame and self.frame:IsVisible()) then
if (instance ~= "arena" and self.frame and self.frame:IsVisible() and not self.frame.testing) then
self:Reset() self:Reset()
self:HideFrame() self:HideFrame()
end end
if (instance == "arena") then
self:Reset()
self:HideFrame()
end
self.lastInstance = instance
end end
function Gladdy:UPDATE_BATTLEFIELD_STATUS(_, index) function Gladdy:UPDATE_BATTLEFIELD_STATUS(_, index)

View File

@ -331,7 +331,10 @@ function BuffsDebuffs:UpdateFrame(unit)
end end
end end
if (unit == "arena1") then if (unit == "arena1") then
Gladdy:CreateMover(self.frames[unit].debuffFrame, "buffsXOffset", "buffsYOffset", L["Debuffs"], {"BOTTOMLEFT", "TOPLEFT"}) Gladdy:CreateMover(self.frames[unit].debuffFrame, "buffsXOffset", "buffsYOffset", L["Debuffs"],
Gladdy.db.buffsCooldownGrowDirection == "LEFT" and {"TOPRIGHT", "TOPRIGHT"} or {"TOPLEFT", "TOPLEFT"},
Gladdy.db.buffsIconSize * Gladdy.db.buffsWidthFactor,
Gladdy.db.buffsIconSize, Gladdy.db.buffsCooldownGrowDirection == "LEFT"and -1 or 1, 0)
end end
--BUFFS --BUFFS
@ -428,7 +431,10 @@ function BuffsDebuffs:UpdateFrame(unit)
end end
end end
if (unit == "arena1") then if (unit == "arena1") then
Gladdy:CreateMover(self.frames[unit].buffFrame, "buffsBuffsXOffset", "buffsBuffsYOffset", L["Buffs"], {"BOTTOMLEFT", "TOPLEFT"}) Gladdy:CreateMover(self.frames[unit].buffFrame, "buffsBuffsXOffset", "buffsBuffsYOffset", L["Buffs"],
Gladdy.db.buffsBuffsCooldownGrowDirection == "LEFT" and {"TOPRIGHT", "TOPRIGHT"} or {"TOPLEFT", "TOPLEFT"},
Gladdy.db.buffsBuffsIconSize * Gladdy.db.buffsBuffsWidthFactor,
Gladdy.db.buffsBuffsIconSize, Gladdy.db.buffsBuffsCooldownGrowDirection == "LEFT"and -1 or 1, 0)
end end
for i=1, #self.frames[unit].auras[AURA_TYPE_BUFF] do for i=1, #self.frames[unit].auras[AURA_TYPE_BUFF] do

View File

@ -194,7 +194,7 @@ function Castbar:UpdateFrame(unit)
castBar.icon.texture.overlay:SetVertexColor(Gladdy.db.castBarIconColor.r, Gladdy.db.castBarIconColor.g, Gladdy.db.castBarIconColor.b, Gladdy.db.castBarIconColor.a) castBar.icon.texture.overlay:SetVertexColor(Gladdy.db.castBarIconColor.r, Gladdy.db.castBarIconColor.g, Gladdy.db.castBarIconColor.b, Gladdy.db.castBarIconColor.a)
if (unit == "arena1") then if (unit == "arena1") then
Gladdy:CreateMover(castBar, "castBarXOffset", "castBarYOffset", L["Cast Bar"], {"BOTTOMLEFT", "TOPLEFT"}) Gladdy:CreateMover(castBar, "castBarXOffset", "castBarYOffset", L["Cast Bar"], {"TOPLEFT", "TOPLEFT"}, Gladdy.db.castBarWidth, Gladdy.db.castBarHeight, 0, 0)
end end
end end

View File

@ -168,7 +168,9 @@ function Cooldowns:UpdateFrame(unit)
button.spellCooldownFrame:SetWidth(1) button.spellCooldownFrame:SetWidth(1)
button.spellCooldownFrame:Show() button.spellCooldownFrame:Show()
if (unit == "arena1") then if (unit == "arena1") then
Gladdy:CreateMover(button.spellCooldownFrame, "cooldownXOffset", "cooldownYOffset", L["Cooldown"], {"BOTTOMLEFT", "TOPLEFT"}) Gladdy:CreateMover(button.spellCooldownFrame, "cooldownXOffset", "cooldownYOffset", L["Cooldown"],
Gladdy.db.cooldownXPos == "RIGHT" and {"TOPRIGHT", "TOPRIGHT"} or {"TOPLEFT", "TOPLEFT"},
Gladdy.db.cooldownSize * Gladdy.db.cooldownWidthFactor, Gladdy.db.cooldownSize)
end end
-- Update each cooldown icon -- Update each cooldown icon
local o = 1 local o = 1

View File

@ -180,7 +180,11 @@ function Diminishings:UpdateFrame(unit)
drFrame:SetHeight(Gladdy.db.drIconSize) drFrame:SetHeight(Gladdy.db.drIconSize)
if (unit == "arena1") then if (unit == "arena1") then
Gladdy:CreateMover(drFrame, "drXOffset", "drYOffset", L["Diminishings"], Gladdy:CreateMover(drFrame, "drXOffset", "drYOffset", L["Diminishings"],
Gladdy.db.drCooldownPos == "RIGHT" and {"BOTTOMLEFT", "TOPLEFT"} or {"BOTTOMRIGHT", "TOPRIGHT"}) Gladdy.db.drCooldownPos == "RIGHT" and {"TOPLEFT", "TOPLEFT"} or {"TOPRIGHT", "TOPRIGHT"}, --point
Gladdy.db.drIconSize * Gladdy.db.drWidthFactor, -- width
Gladdy.db.drIconSize,
0, --xoffset
0) --yoffset
end end
for i = 1, 16 do for i = 1, 16 do

View File

@ -305,7 +305,7 @@ function Pets:UpdateFrame(unitId)
healthBar.nameText:SetTextColor(Gladdy.db.petHealthBarFontColor.r, Gladdy.db.petHealthBarFontColor.g, Gladdy.db.petHealthBarFontColor.b, Gladdy.db.petHealthBarFontColor.a) healthBar.nameText:SetTextColor(Gladdy.db.petHealthBarFontColor.r, Gladdy.db.petHealthBarFontColor.g, Gladdy.db.petHealthBarFontColor.b, Gladdy.db.petHealthBarFontColor.a)
healthBar.healthText:SetTextColor(Gladdy.db.petHealthBarFontColor.r, Gladdy.db.petHealthBarFontColor.g, Gladdy.db.petHealthBarFontColor.b, Gladdy.db.petHealthBarFontColor.a) healthBar.healthText:SetTextColor(Gladdy.db.petHealthBarFontColor.r, Gladdy.db.petHealthBarFontColor.g, Gladdy.db.petHealthBarFontColor.b, Gladdy.db.petHealthBarFontColor.a)
if (unit == "arenapet1") then if (unit == "arenapet1") then
Gladdy:CreateMover(self.frames[unit], "petXOffset", "petYOffset", L["Pets"], {"BOTTOMLEFT", "TOPLEFT"}) Gladdy:CreateMover(self.frames[unit], "petXOffset", "petYOffset", L["Pets"], {"TOPLEFT", "TOPLEFT"})
end end
end end