Rewrite on Faders: Details.FadeHandler.Fader(frame, animationType, speed, hideType)

This commit is contained in:
Tercio Jose
2021-04-24 18:17:59 -03:00
parent 4a28c63b4e
commit 2379884746
35 changed files with 722 additions and 337 deletions
+53 -18
View File
@@ -2,7 +2,7 @@
local Details = _G.Details
local libwindow = LibStub("LibWindow-1.1")
local DF = DetailsFramework
function Details:OpenCurrentRealDPSOptions(from_options_panel)
@@ -241,7 +241,7 @@ function Details:OpenCurrentRealDPSOptions(from_options_panel)
end)
end
--> check if the frame was been created
if (not DetailsCurrentDpsMeter) then
Details:CreateCurrentDpsFrame(UIParent, "DetailsCurrentDpsMeter")
@@ -287,6 +287,24 @@ function Details:CreateCurrentDpsFrame(parent, name)
LibWindow.MakeDraggable (f)
LibWindow.RestorePosition (f)
--> arena dps bars
--code for the dps bars shown in arenas
--frame to support the two bars, one for the dps and another for heal
--the dps bar is wider and taller, hps is below it and smaller
local barFrame = CreateFrame("frame", "DetailsArenaDpsBars", f, "BackdropTemplate")
f.dpsBarFrame = barFrame
barFrame:SetSize(400, 80)
barFrame:SetPoint("center", f, "center")
barFrame.splitBar = DF:CreateSplitBar(barFrame, 400, 50)
barFrame.splitBar:SetSize(400, 50)
barFrame.splitBar:SetPoint("center", barFrame, "center", 0, 0)
barFrame.splitBar.fontsize = 10
barFrame.splitBar:SetMinMaxValues(0, 1.0)
barFrame.splitBar:SetValue(0.5)
barFrame.splitBar:EnableAnimations()
--> title bar
local TitleString = f:CreateFontString (nil, "overlay", "GameFontNormal")
TitleString:SetPoint ("top", f, "top", 0, -1)
@@ -359,14 +377,6 @@ function Details:CreateCurrentDpsFrame(parent, name)
labelGroupDamage_DPS:SetPoint ("center", labelGroupDamage, "center")
labelGroupDamage_DPS:SetPoint ("top", labelGroupDamage, "bottom", 0, spacing_vertical)
--[=[
local labelGroupDamage_DPS_Icon = f:CreateTexture (nil, "overlay")
labelGroupDamage_DPS_Icon:SetTexture ([[Interface\LFGFRAME\UI-LFG-ICON-ROLES]])
labelGroupDamage_DPS_Icon:SetTexCoord (72/256, 130/256, 69/256, 127/256)
labelGroupDamage_DPS_Icon:SetSize (icon_size, icon_size)
labelGroupDamage_DPS_Icon:SetPoint ("topleft", labelPlayerTeam, "bottomleft", 0, -4)
--]=]
--> frame update function
--> update
@@ -400,11 +410,13 @@ function Details:CreateCurrentDpsFrame(parent, name)
if (not _detalhes.current_dps_meter.enabled) then
f:Hide()
print("D! debug currentdps.lua > !current_dps_meter.enabled")
return
end
if (not _detalhes.current_dps_meter.arena_enabled and not _detalhes.current_dps_meter.mythic_dungeon_enabled) then
f:Hide()
print("D! debug currentdps.lua > not _detalhes.current_dps_meter.arena_enabled and not _detalhes.current_dps_meter.mythic_dungeon_enabled")
return
end
@@ -416,7 +428,8 @@ function Details:CreateCurrentDpsFrame(parent, name)
labelYellowTeam:Show()
labelPlayerTeam_DPS_Icon:Show()
labelYellowTeam_DPS_Icon:Show()
f.dpsBarFrame:Show()
--> update arena labels
DF:SetFontColor (labelPlayerTeam_DPS, _detalhes.current_dps_meter.font_color)
DF:SetFontFace (labelPlayerTeam_DPS, _detalhes.current_dps_meter.font_face)
@@ -473,6 +486,7 @@ function Details:CreateCurrentDpsFrame(parent, name)
else
labelGroupDamage:Hide()
labelGroupDamage_DPS:Hide()
f.dpsBarFrame:Hide()
end
--> frame position
@@ -583,6 +597,23 @@ function Details:CreateCurrentDpsFrame(parent, name)
end
self.NextScreenUpdate = self.NextScreenUpdate - time_fraction
--> update double bar
local teamGreenDps = self.PlayerTeamDamage / self.SampleSize
local teamYellowDps = self.YellowDamage / self.SampleSize
local totalDamage = teamGreenDps + teamYellowDps
local dpsBarFrame = DetailsArenaDpsBars.splitBar
dpsBarFrame.currentValue = teamGreenDps / totalDamage * 100
if (f.PlayerTeam == 0) then
dpsBarFrame:SetLeftColor(unpack (green_team_color))
dpsBarFrame:SetRightColor(unpack (yellow_team_color))
else
dpsBarFrame:SetLeftColor(unpack (yellow_team_color))
dpsBarFrame:SetRightColor(unpack (green_team_color))
end
if (self.NextScreenUpdate <= 0) then
if (f.PlayerTeam == 0) then
labelPlayerTeam_DPS:SetText (_detalhes:ToK2 (self.PlayerTeamDamage / self.SampleSize))
@@ -650,24 +681,23 @@ function Details:CreateCurrentDpsFrame(parent, name)
function f:StartForArenaMatch()
if (not f.ShowingArena) then
_detalhes:UpdateTheRealCurrentDPSFrame ("arena")
f.ShowingArena = true
f:SetScript ("OnUpdate", on_tick)
end
end
function f:StartForMythicDungeon()
if (not f.ShowingMythicDungeon) then
_detalhes:UpdateTheRealCurrentDPSFrame ("mythicdungeon")
f.ShowingMythicDungeon = true
f:SetScript ("OnUpdate", on_tick)
end
end
local eventListener = _detalhes:CreateEventListener()
function eventListener:ArenaStarted()
if (_detalhes.current_dps_meter.arena_enabled) then
--it is working here, f:StartForArenaMatch() is called but the frame is still now shown.
f:StartForArenaMatch()
end
end
@@ -699,14 +729,19 @@ function Details:CreateCurrentDpsFrame(parent, name)
f.LastYellowDamage = 0
end
end
eventListener:RegisterEvent ("COMBAT_ARENA_START", "ArenaStarted")
eventListener:RegisterEvent ("COMBAT_ARENA_END", "ArenaEnded")
eventListener:RegisterEvent ("COMBAT_MYTHICDUNGEON_START", "MythicDungeonStarted")
eventListener:RegisterEvent ("COMBAT_MYTHICDUNGEON_END", "MythicDungeonEnded")
eventListener:RegisterEvent ("COMBAT_PLAYER_ENTER", "ResetBuffer")
_detalhes.Broadcaster_CurrentDpsLoaded = true
_detalhes.Broadcaster_CurrentDpsFrame = f
f:Hide()
end
--initialize frames
function Details:InitializeCurrentDpsFrames()
Details:CreateCurrentDpsFrame(UIParent, "DetailsCurrentDpsMeter")
end
+1 -1
View File
@@ -812,7 +812,7 @@
for key, value in pairs (custom_object) do
if (object_keys [key]) then
if (type (value) == "table") then
export_object [key] = table_deepcopy (value)
export_object [key] = Details.CopyTable (value)
else
export_object [key] = value
end
+33 -33
View File
@@ -313,7 +313,7 @@ local function OnLeaveMainWindow (instancia, self)
end
--> stretch button
gump:Fade (instancia.baseframe.button_stretch, "ALPHA", 0)
Details.FadeHandler.Fader (instancia.baseframe.button_stretch, "ALPHA", 0)
elseif (instancia.modo ~= _detalhes._detalhes_props["MODO_ALONE"] and instancia.baseframe.isLocked) then
@@ -323,7 +323,7 @@ local function OnLeaveMainWindow (instancia, self)
instancia.break_snap_button:SetAlpha (0)
end
gump:Fade (instancia.baseframe.button_stretch, "ALPHA", 0)
Details.FadeHandler.Fader (instancia.baseframe.button_stretch, "ALPHA", 0)
end
end
@@ -362,7 +362,7 @@ local function OnEnterMainWindow (instancia, self)
--> stretch button
if (not _detalhes.disable_stretch_button) then
gump:Fade (instancia.baseframe.button_stretch, "ALPHA", 0.6)
Details.FadeHandler.Fader (instancia.baseframe.button_stretch, "ALPHA", 0.6)
end
elseif (instancia.modo ~= _detalhes._detalhes_props["MODO_ALONE"] and instancia.baseframe.isLocked) then
@@ -381,7 +381,7 @@ local function OnEnterMainWindow (instancia, self)
end
if (not _detalhes.disable_stretch_button) then
gump:Fade (instancia.baseframe.button_stretch, "ALPHA", 0.6)
Details.FadeHandler.Fader (instancia.baseframe.button_stretch, "ALPHA", 0.6)
end
end
end
@@ -582,9 +582,9 @@ local movement_onupdate = function (self, elapsed)
if (tempo_movendo and tempo_movendo < 0) then
if (precisa_ativar) then --> se a instncia estiver fechada
gump:Fade (instancia_alvo.baseframe, "ALPHA", 0.2)
gump:Fade (instancia_alvo.baseframe.cabecalho.ball, "ALPHA", 0.2)
gump:Fade (instancia_alvo.baseframe.cabecalho.atributo_icon, "ALPHA", 0.2)
Details.FadeHandler.Fader (instancia_alvo.baseframe, "ALPHA", 0.2)
Details.FadeHandler.Fader (instancia_alvo.baseframe.cabecalho.ball, "ALPHA", 0.2)
Details.FadeHandler.Fader (instancia_alvo.baseframe.cabecalho.atributo_icon, "ALPHA", 0.2)
instancia_alvo:SaveMainWindowPosition()
instancia_alvo:RestoreMainWindowPosition()
precisa_ativar = false
@@ -810,9 +810,9 @@ local function move_janela (baseframe, iniciando, instancia, just_updating)
instancia_alvo:SaveMainWindowPosition()
instancia_alvo:RestoreMainWindowPosition()
gump:Fade (instancia_alvo.baseframe, 1)
gump:Fade (instancia_alvo.rowframe, 1)
gump:Fade (instancia_alvo.baseframe.cabecalho.ball, 1)
Details.FadeHandler.Fader (instancia_alvo.baseframe, 1)
Details.FadeHandler.Fader (instancia_alvo.rowframe, 1)
Details.FadeHandler.Fader (instancia_alvo.baseframe.cabecalho.ball, 1)
need_start = false
end
@@ -939,9 +939,9 @@ local function move_janela (baseframe, iniciando, instancia, just_updating)
if (not esta_instancia:IsAtiva() and esta_instancia.iniciada) then
esta_instancia:ResetaGump()
gump:Fade (esta_instancia.baseframe, "in", 0.2)
gump:Fade (esta_instancia.baseframe.cabecalho.ball, "in", 0.2)
gump:Fade (esta_instancia.baseframe.cabecalho.atributo_icon, "in", 0.2)
Details.FadeHandler.Fader (esta_instancia.baseframe, "in", 0.2)
Details.FadeHandler.Fader (esta_instancia.baseframe.cabecalho.ball, "in", 0.2)
Details.FadeHandler.Fader (esta_instancia.baseframe.cabecalho.atributo_icon, "in", 0.2)
if (esta_instancia.modo == modo_raid) then
_detalhes.raid = nil
@@ -2560,12 +2560,12 @@ local function button_stretch_scripts (baseframe, backgrounddisplay, instancia)
button:SetScript ("OnEnter", function (self)
self.mouse_over = true
if (not _detalhes.disable_stretch_button) then
gump:Fade (self, "ALPHA", 1)
Details.FadeHandler.Fader (self, "ALPHA", 1)
end
end)
button:SetScript ("OnLeave", function (self)
self.mouse_over = false
gump:Fade (self, "ALPHA", 0)
Details.FadeHandler.Fader (self, "ALPHA", 0)
end)
button:SetScript ("OnMouseDown", function (self, button)
@@ -3560,7 +3560,7 @@ function gump:CriaJanelaPrincipal (ID, instancia, criando)
baseframe.button_stretch:SetHeight (16)
baseframe.button_stretch:Show()
gump:Fade (baseframe.button_stretch, "ALPHA", 0)
Details.FadeHandler.Fader (baseframe.button_stretch, "ALPHA", 0)
button_stretch_scripts (baseframe, backgrounddisplay, instancia)
@@ -3698,7 +3698,7 @@ function gump:CriaJanelaPrincipal (ID, instancia, criando)
lockFunctionOnClick (baseframe.lock_button, nil, nil, true)
end
gump:Fade (baseframe.lock_button, -1, 3.0)
Details.FadeHandler.Fader (baseframe.lock_button, -1, 3.0)
-- scripts ------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -4079,7 +4079,7 @@ function gump:CreateNewLine (instancia, index)
barra_scripts (new_row, instancia, index)
--> hide
gump:Fade (new_row, 1)
Details.FadeHandler.Fader (new_row, 1)
--> adds the window container
instancia.barras [index] = new_row
@@ -4833,7 +4833,7 @@ function _detalhes:InstanceWallpaper (texture, anchor, alpha, texcoord, width, h
elseif (type (texture) == "boolean" and not texture) then
self.wallpaper.enabled = false
return gump:Fade (self.baseframe.wallpaper, "in")
return Details.FadeHandler.Fader (self.baseframe.wallpaper, "in")
elseif (type (texture) == "table") then
anchor = texture.anchor or wallpaper.anchor
@@ -4924,7 +4924,7 @@ function _detalhes:InstanceWallpaper (texture, anchor, alpha, texcoord, width, h
t:Show()
--t:SetAlpha (alpha)
gump:Fade (t, "ALPHAANIM", alpha)
Details.FadeHandler.Fader (t, "ALPHAANIM", alpha)
end
@@ -5036,9 +5036,9 @@ function _detalhes:SetWindowAlphaForCombat (entering_in_combat, true_hide, alpha
self.baseframe:Hide()
self.rowframe:Hide()
self.windowSwitchButton:Hide()
--gump:Fade (self.baseframe, _unpack (_detalhes.windows_fade_in))
--gump:Fade (self.rowframe, _unpack (_detalhes.windows_fade_in))
--gump:Fade (self.windowSwitchButton, _unpack (_detalhes.windows_fade_in))
--Details.FadeHandler.Fader (self.baseframe, _unpack (_detalhes.windows_fade_in))
--Details.FadeHandler.Fader (self.rowframe, _unpack (_detalhes.windows_fade_in))
--Details.FadeHandler.Fader (self.windowSwitchButton, _unpack (_detalhes.windows_fade_in))
--self:SetIconAlpha (nil, true)
@@ -5052,8 +5052,8 @@ function _detalhes:SetWindowAlphaForCombat (entering_in_combat, true_hide, alpha
self.baseframe:SetAlpha (1)
self:InstanceAlpha(min (amount, self.color[4]))
gump:Fade(self.rowframe, "ALPHAANIM", rowsamount)
gump:Fade(self.baseframe, "ALPHAANIM", rowsamount)
Details.FadeHandler.Fader(self.rowframe, "ALPHAANIM", rowsamount)
Details.FadeHandler.Fader(self.baseframe, "ALPHAANIM", rowsamount)
--]]
end
@@ -5394,12 +5394,12 @@ function _detalhes:SetIconAlpha (alpha, hide, no_animations)
end
if (hide) then
gump:Fade (self.menu_attribute_string.widget, _unpack (_detalhes.windows_fade_in))
Details.FadeHandler.Fader (self.menu_attribute_string.widget, _unpack (_detalhes.windows_fade_in))
else
if (no_animations) then
self.menu_attribute_string:SetAlpha (alpha)
else
gump:Fade (self.menu_attribute_string.widget, "ALPHAANIM", alpha)
Details.FadeHandler.Fader (self.menu_attribute_string.widget, "ALPHAANIM", alpha)
end
end
end
@@ -5419,7 +5419,7 @@ function _detalhes:SetIconAlpha (alpha, hide, no_animations)
for index, button in _ipairs (SetIconAlphaCacheButtonsTable) do
if (self.menu_icons [index]) then
if (hide) then
--gump:Fade (button, _unpack (_detalhes.windows_fade_in))
--Details.FadeHandler.Fader (button, _unpack (_detalhes.windows_fade_in))
button:Hide()
else
button:Show()
@@ -5427,7 +5427,7 @@ function _detalhes:SetIconAlpha (alpha, hide, no_animations)
--if (no_animations) then
-- button:SetAlpha (alpha)
--else
-- gump:Fade (button, "ALPHAANIM", alpha)
-- Details.FadeHandler.Fader (button, "ALPHAANIM", alpha)
--end
end
end
@@ -5437,12 +5437,12 @@ function _detalhes:SetIconAlpha (alpha, hide, no_animations)
if (#_detalhes.ToolBar.Shown > 0) then
for index, button in ipairs (_detalhes.ToolBar.Shown) do
if (hide) then
gump:Fade (button, _unpack (_detalhes.windows_fade_in))
Details.FadeHandler.Fader (button, _unpack (_detalhes.windows_fade_in))
else
if (no_animations) then
button:SetAlpha (alpha)
else
gump:Fade (button, "ALPHAANIM", alpha)
Details.FadeHandler.Fader (button, "ALPHAANIM", alpha)
end
end
end
@@ -8365,7 +8365,7 @@ function _detalhes:HideMainIcon (value)
if (value) then
self.hide_icon = true
gump:Fade (self.baseframe.cabecalho.atributo_icon, 1)
Details.FadeHandler.Fader (self.baseframe.cabecalho.atributo_icon, 1)
if (self.toolbar_side == 1) then
self.baseframe.cabecalho.ball:SetTexCoord (unpack (COORDS_LEFT_BALL_NO_ICON))
@@ -8388,7 +8388,7 @@ function _detalhes:HideMainIcon (value)
else
self.hide_icon = false
gump:Fade (self.baseframe.cabecalho.atributo_icon, 0)
Details.FadeHandler.Fader (self.baseframe.cabecalho.atributo_icon, 0)
if (self.toolbar_side == 1) then
+2 -2
View File
@@ -710,7 +710,7 @@ do
for key, value in pairs (currentInstance) do
if (_detalhes.instance_defaults[key] ~= nil) then
if (type (value) == "table") then
savedObject[key] = table_deepcopy(value)
savedObject[key] = Details.CopyTable(value)
else
savedObject[key] = value
end
@@ -737,7 +737,7 @@ do
for key, value in pairs (skinObject) do
if (key ~= "skin" and not _detalhes.instance_skin_ignored_values[key]) then
if (type (value) == "table") then
instance[key] = table_deepcopy (value)
instance[key] = Details.CopyTable (value)
else
instance[key] = value
end
+14 -14
View File
@@ -242,7 +242,7 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo
end
info:ShowTabs()
gump:Fade (info, 0)
Details.FadeHandler.Fader (info, 0)
Details:UpdateBreakdownPlayerList()
--check which tab was selected and reopen that tab
@@ -397,9 +397,9 @@ function _detalhes:FechaJanelaInfo (fromEscape)
if (info.ativo) then --> se a janela tiver aberta
--playerDetailWindow:Hide()
if (fromEscape) then
gump:Fade (info, "in")
Details.FadeHandler.Fader (info, "in")
else
gump:Fade (info, 1)
Details.FadeHandler.Fader (info, 1)
end
info.ativo = false --> sinaliza o addon que a janela esta agora fechada
@@ -506,22 +506,22 @@ end
------------------------------------------------------------------------------------------------------------------------------
local detalhe_infobg_onenter = function (self)
gump:Fade (self.overlay, "OUT")
gump:Fade (self.reportar, "OUT")
Details.FadeHandler.Fader (self.overlay, "OUT")
Details.FadeHandler.Fader (self.reportar, "OUT")
end
local detalhe_infobg_onleave = function (self)
gump:Fade (self.overlay, "IN")
gump:Fade (self.reportar, "IN")
Details.FadeHandler.Fader (self.overlay, "IN")
Details.FadeHandler.Fader (self.reportar, "IN")
end
local detalhes_inforeport_onenter = function (self)
gump:Fade (self:GetParent().overlay, "OUT")
gump:Fade (self, "OUT")
Details.FadeHandler.Fader (self:GetParent().overlay, "OUT")
Details.FadeHandler.Fader (self, "OUT")
end
local detalhes_inforeport_onleave = function (self)
gump:Fade (self:GetParent().overlay, "IN")
gump:Fade (self, "IN")
Details.FadeHandler.Fader (self:GetParent().overlay, "IN")
Details.FadeHandler.Fader (self, "IN")
end
function gump:CriaDetalheInfo (index)
@@ -546,12 +546,12 @@ function gump:CriaDetalheInfo (index)
info.bg.overlay:SetWidth (341)
info.bg.overlay:SetHeight (61)
info.bg.overlay:SetPoint ("TOPLEFT", info.bg, "TOPLEFT", -7, 6)
gump:Fade (info.bg.overlay, 1)
Details.FadeHandler.Fader (info.bg.overlay, 1)
info.bg.reportar = gump:NewDetailsButton (info.bg, nil, nil, _detalhes.Reportar, _detalhes.playerDetailWindow, 10+index, 16, 16,
"Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", nil, "DetailsJanelaInfoReport1")
info.bg.reportar:SetPoint ("BOTTOMLEFT", info.bg.overlay, "BOTTOMRIGHT", -33, 10)
gump:Fade (info.bg.reportar, 1)
Details.FadeHandler.Fader (info.bg.reportar, 1)
info.bg:SetScript ("OnEnter", detalhe_infobg_onenter)
info.bg:SetScript ("OnLeave", detalhe_infobg_onleave)
@@ -679,7 +679,7 @@ function gump:SetaDetalheInfoTexto (index, p, arg1, arg2, arg3, arg4, arg5, arg6
info.bg.PetIcon:Hide()
info.bg.PetText:Hide()
info.bg.PetDps:Hide()
gump:Fade (info.bg.overlay, "IN")
Details.FadeHandler.Fader (info.bg.overlay, "IN")
info.IsPet = false
end
+4 -4
View File
@@ -130,7 +130,7 @@ local _UIParent = UIParent --> wow api locals
_detalhes.janela_report.ativa = true
_detalhes.janela_report.enviar:SetScript ("OnClick", function() func (_G ["Details_Report_CB_1"]:GetChecked(), _G ["Details_Report_CB_2"]:GetChecked(), _detalhes.report_lines) end)
gump:Fade (_detalhes.janela_report, 0)
Details.FadeHandler.Fader (_detalhes.janela_report, 0)
return true
end
@@ -233,7 +233,7 @@ local _UIParent = UIParent --> wow api locals
end
_detalhes.janela_report.ativa = true
gump:Fade (_detalhes.janela_report, 0)
Details.FadeHandler.Fader (_detalhes.janela_report, 0)
end
--> build report frame gump -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -1074,7 +1074,7 @@ local function cria_drop_down (este_gump)
--> close button
window.fechar = CreateFrame ("Button", nil, window, "UIPanelCloseButton")
window.fechar:SetScript ("OnClick", function()
gump:Fade (window, 1)
Details.FadeHandler.Fader (window, 1)
_detalhes.janela_report.ativa = false
end)
@@ -1094,7 +1094,7 @@ local function cria_drop_down (este_gump)
window.enviar:SetHeight (15)
window.enviar:SetText (Loc ["STRING_REPORTFRAME_SEND"])
gump:Fade (window, 1)
Details.FadeHandler.Fader (window, 1)
gump:CreateFlashAnimation (window)
--apply the current skin
+1 -1
View File
@@ -202,7 +202,7 @@ function _detalhes:OpenWelcomeWindow()
for key, value in pairs (instance) do
if (_detalhes.instance_defaults [key] ~= nil) then
if (type (value) == "table") then
savedObject [key] = table_deepcopy (value)
savedObject [key] = Details.CopyTable (value)
else
savedObject [key] = value
end