Cleanups and Created a new frame class "Frame Container"

This commit is contained in:
Tercio Jose
2023-04-17 21:59:17 -03:00
parent d2524bb4a6
commit ca91c10ff8
6 changed files with 265 additions and 183 deletions
-165
View File
@@ -331,9 +331,6 @@ function spellsTab.OnCreateTabCallback(tabButton, tabFrame)
--create the targets container
spellsTab.CreateTargetContainer(tabFrame)
--craete special backgrounds (still needed?)
spellsTab.CreateSpecialBackgrounds(tabFrame)
--create the report buttons for each container
spellsTab.CreateReportButtons(tabFrame)
@@ -357,152 +354,6 @@ function spellsTab.OnCreateTabCallback(tabButton, tabFrame)
--]=]
end
function spellsTab.TrocaBackgroundInfo(tabFrame) --> spells tab | to be refactored | called fom OpenJanelaInfo function
tabFrame.bg3_sec_texture:Hide()
tabFrame.bg2_sec_texture:Hide()
tabFrame.report_direita:Hide()
if (breakdownWindow.atributo == 1) then --damage
if (breakdownWindow.sub_atributo == 1 or breakdownWindow.sub_atributo == 2) then --damage done / dps
tabFrame.bg1_sec_texture:SetTexture("")
tabFrame.tipo = 1
if (breakdownWindow.sub_atributo == 2) then
tabFrame.targets:SetText(Loc ["STRING_TARGETS"] .. " " .. Loc ["STRING_ATTRIBUTE_DAMAGE_DPS"] .. ":")
tabFrame.target_persecond = true
else
tabFrame.targets:SetText(Loc ["STRING_TARGETS"] .. ":")
end
elseif (breakdownWindow.sub_atributo == 3) then --damage taken
tabFrame.bg1_sec_texture:SetColorTexture(.05, .05, .05, .4)
tabFrame.bg3_sec_texture:Show()
tabFrame.bg2_sec_texture:Show()
tabFrame.tipo = 2
for i = 1, spellBlockContainerSettings.amount do
tabFrame["right_background" .. i]:Hide()
end
tabFrame.targets:SetText(Loc ["STRING_TARGETS"] .. ":")
tabFrame.no_targets:Show()
tabFrame.no_targets.text:Show()
tabFrame.report_direita:Show()
elseif (breakdownWindow.sub_atributo == 4) then --friendly fire
tabFrame.bg1_sec_texture:SetColorTexture(.05, .05, .05, .4)
tabFrame.bg3_sec_texture:Show()
tabFrame.bg2_sec_texture:Show()
tabFrame.tipo = 3
for i = 1, spellBlockContainerSettings.amount do
tabFrame["right_background" .. i]:Hide()
end
tabFrame.targets:SetText(Loc ["STRING_SPELLS"] .. ":")
tabFrame.report_direita:Show()
elseif (breakdownWindow.sub_atributo == 6) then --enemies
tabFrame.bg1_sec_texture:SetColorTexture(.05, .05, .05, .4)
tabFrame.bg3_sec_texture:Show()
tabFrame.bg2_sec_texture:Show()
tabFrame.tipo = 3
for i = 1, spellBlockContainerSettings.amount do
tabFrame["right_background" .. i]:Hide()
end
tabFrame.targets:SetText(Loc ["STRING_DAMAGE_TAKEN_FROM"])
end
elseif (breakdownWindow.atributo == 2) then --healing
if (breakdownWindow.sub_atributo == 1 or breakdownWindow.sub_atributo == 2 or breakdownWindow.sub_atributo == 3) then --damage done / dps
tabFrame.bg1_sec_texture:SetTexture("")
tabFrame.tipo = 1
if (breakdownWindow.sub_atributo == 3) then
tabFrame.targets:SetText(Loc ["STRING_OVERHEALED"] .. ":")
tabFrame.target_member = "overheal"
tabFrame.target_text = Loc ["STRING_OVERHEALED"] .. ":"
elseif (breakdownWindow.sub_atributo == 2) then
tabFrame.targets:SetText(Loc ["STRING_TARGETS"] .. " " .. Loc ["STRING_ATTRIBUTE_HEAL_HPS"] .. ":")
tabFrame.target_persecond = true
else
tabFrame.targets:SetText(Loc ["STRING_TARGETS"] .. ":")
end
elseif (breakdownWindow.sub_atributo == 4) then --Healing taken
tabFrame.bg1_sec_texture:SetColorTexture(.05, .05, .05, .4)
tabFrame.bg3_sec_texture:Show()
tabFrame.bg2_sec_texture:Show()
tabFrame.tipo = 2
for i = 1, spellBlockContainerSettings.amount do
tabFrame ["right_background" .. i]:Hide()
end
tabFrame.targets:SetText(Loc ["STRING_TARGETS"] .. ":")
tabFrame.no_targets:Show()
tabFrame.no_targets.text:Show()
tabFrame.report_direita:Show()
end
elseif (breakdownWindow.atributo == 3) then --energy
tabFrame.bg1_sec_texture:SetTexture("")
tabFrame.tipo = 2
tabFrame.targets:SetText("Vindo de:")
elseif (breakdownWindow.atributo == 4) then --utility
tabFrame.bg1_sec_texture:SetTexture("")
tabFrame.tipo = 2
tabFrame.targets:SetText(Loc ["STRING_TARGETS"] .. ":")
end
end
do --hide bars functions - to be refactored
--hide all the bars of the skills in the window info
function spellsTab.HidaAllBarrasInfo()
local allBars = _detalhes.playerDetailWindow.barras1
for index = 1, #allBars, 1 do
allBars[index]:Hide()
allBars[index].textura:SetStatusBarColor(1, 1, 1, 1)
end
end
--hide the 5 bars on the right side of the window
function spellsTab.HidaAllDetalheInfo() --there's a call from the breakdown file yet
for i = 1, spellBlockContainerSettings.amount do
spellsTab.HidaDetalheInfo(i)
end
--breakdownWindow.barras3 will not exists anymore soon
--for _, thisBar in ipairs(breakdownWindow.barras3) do
-- thisBar:Hide()
--end
--_detalhes.playerDetailWindow.spell_icone:SetTexture("")
end
function spellsTab.ResetBars()
spellsTab.HidaAllBarrasInfo()
spellsTab.HidaAllBarrasAlvo()
spellsTab.HidaAllDetalheInfo()
end
function spellsTab.HidaDetalheInfo(index) --> spells tab this is getting called from class damage and heal
local info = _detalhes.playerDetailWindow.grupos_detalhes[index]
info.nome:SetText("")
info.nome2:SetText("")
info.dano:SetText("")
info.dano_porcento:SetText("")
info.dano_media:SetText("")
info.dano_dps:SetText("")
info.bg:Hide()
end
end
function spellsTab.CreateReportButtons(tabFrame)
--spell list report button
tabFrame.report_esquerda = Details.gump:NewDetailsButton(tabFrame, tabFrame, nil, _detalhes.Reportar, tabFrame, 1, 16, 16, "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", nil, "DetailsJanelaInfoReport2")
@@ -1488,22 +1339,6 @@ function spellsTab.CreateSpellScrollContainer(tabFrame)
return scrollFrame
end
--special backgrounds -- fundos especiais de friendly fire e outros
function spellsTab.CreateSpecialBackgrounds(tabFrame)
tabFrame.no_targets = tabFrame:CreateTexture("DetailsBreakdownWindow_no_targets", "overlay")
tabFrame.no_targets:SetPoint("bottomleft", tabFrame, "bottomleft", 20, 6)
tabFrame.no_targets:SetSize(301, 100)
tabFrame.no_targets:SetTexture([[Interface\QUESTFRAME\UI-QUESTLOG-EMPTY-TOPLEFT]])
tabFrame.no_targets:SetTexCoord(0.015625, 1, 0.01171875, 0.390625)
tabFrame.no_targets:SetDesaturated(true)
tabFrame.no_targets:SetAlpha(.7)
tabFrame.no_targets.text = tabFrame:CreateFontString(nil, "overlay", "GameFontNormal")
tabFrame.no_targets.text:SetPoint("center", tabFrame.no_targets, "center")
tabFrame.no_targets.text:SetText(Loc ["STRING_NO_TARGET_BOX"])
tabFrame.no_targets.text:SetTextColor(1, 1, 1, .4)
tabFrame.no_targets:Hide()
end
---on enter function for the spell target frame
---@param targetFrame breakdowntargetframe
local onEnterSpellTarget = function(targetFrame)