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
+31 -29
View File
@@ -64,7 +64,7 @@ function _detalhes:ApplyBasicKeys()
--> load default profile keys
for key, value in pairs (_detalhes.default_profile) do
if (type (value) == "table") then
local ctable = table_deepcopy (value)
local ctable = Details.CopyTable (value)
self [key] = ctable
else
self [key] = value
@@ -86,7 +86,7 @@ function _detalhes:LoadGlobalAndCharacterData()
--> it exists?
if (not _detalhes_database) then
_detalhes_database = table_deepcopy (_detalhes.default_player_data)
_detalhes_database = Details.CopyTable (_detalhes.default_player_data)
end
--> load saved values
@@ -95,7 +95,7 @@ function _detalhes:LoadGlobalAndCharacterData()
--> check if key exists, e.g. a new key was added
if (_detalhes_database [key] == nil) then
if (type (value) == "table") then
_detalhes_database [key] = table_deepcopy (_detalhes.default_player_data [key])
_detalhes_database [key] = Details.CopyTable (_detalhes.default_player_data [key])
else
_detalhes_database [key] = value
end
@@ -107,7 +107,7 @@ function _detalhes:LoadGlobalAndCharacterData()
for key2, value2 in pairs (_detalhes.default_player_data [key]) do
if (_detalhes_database [key] [key2] == nil) then
if (type (value2) == "table") then
_detalhes_database [key] [key2] = table_deepcopy (_detalhes.default_player_data [key] [key2])
_detalhes_database [key] [key2] = Details.CopyTable (_detalhes.default_player_data [key] [key2])
else
_detalhes_database [key] [key2] = value2
end
@@ -117,7 +117,7 @@ function _detalhes:LoadGlobalAndCharacterData()
--> copy the key from saved table to details object
if (type (value) == "table") then
_detalhes [key] = table_deepcopy (_detalhes_database [key])
_detalhes [key] = Details.CopyTable (_detalhes_database [key])
else
_detalhes [key] = _detalhes_database [key]
end
@@ -126,7 +126,7 @@ function _detalhes:LoadGlobalAndCharacterData()
--> check and build the default container for account database
if (not _detalhes_global) then
_detalhes_global = table_deepcopy (_detalhes.default_global_data)
_detalhes_global = Details.CopyTable (_detalhes.default_global_data)
end
for key, value in pairs (_detalhes.default_global_data) do
@@ -134,7 +134,7 @@ function _detalhes:LoadGlobalAndCharacterData()
--> check if key exists
if (_detalhes_global [key] == nil) then
if (type (value) == "table") then
_detalhes_global [key] = table_deepcopy (_detalhes.default_global_data [key])
_detalhes_global [key] = Details.CopyTable (_detalhes.default_global_data [key])
else
_detalhes_global [key] = value
end
@@ -155,7 +155,7 @@ function _detalhes:LoadGlobalAndCharacterData()
for key2, value2 in pairs (_detalhes.default_global_data [key]) do
if (_detalhes_global [key] [key2] == nil) then
if (type (value2) == "table") then
_detalhes_global [key] [key2] = table_deepcopy (_detalhes.default_global_data [key] [key2])
_detalhes_global [key] [key2] = Details.CopyTable (_detalhes.default_global_data [key] [key2])
else
_detalhes_global [key] [key2] = value2
end
@@ -166,7 +166,7 @@ function _detalhes:LoadGlobalAndCharacterData()
--> copy the key from saved table to details object
if (type (value) == "table") then
_detalhes [key] = table_deepcopy (_detalhes_global [key])
_detalhes [key] = Details.CopyTable (_detalhes_global [key])
else
_detalhes [key] = _detalhes_global [key]
end
@@ -201,7 +201,7 @@ function _detalhes:LoadCombatTables()
-- pets
_detalhes.tabela_pets = _detalhes.container_pets:NovoContainer()
if (_detalhes_database.tabela_pets) then
_detalhes.tabela_pets.pets = table_deepcopy (_detalhes_database.tabela_pets)
_detalhes.tabela_pets.pets = Details.CopyTable (_detalhes_database.tabela_pets)
end
_detalhes:UpdateContainerCombatentes()
@@ -318,7 +318,7 @@ function _detalhes:LoadConfig()
--> buffs
_detalhes.savedbuffs = _detalhes_database.savedbuffs
_detalhes.Buffs:BuildTables()
--> initialize parser
_detalhes.capture_current = {}
for captureType, captureValue in pairs (_detalhes.capture_real) do
@@ -327,7 +327,7 @@ function _detalhes:LoadConfig()
--> row animations
_detalhes:SetUseAnimations()
--> initialize spell cache
_detalhes:ClearSpellCache()
@@ -365,7 +365,7 @@ function _detalhes:LoadConfig()
-- if (_detalhes.always_use_profile and type (_detalhes.always_use_profile) == "string") then
-- _detalhes_database.active_profile = _detalhes.always_use_profile
-- end
--> character first run
if (_detalhes_database.active_profile == "") then
_detalhes.character_first_run = true
@@ -374,15 +374,18 @@ function _detalhes:LoadConfig()
_detalhes:GetProfile (current_profile_name, true)
_detalhes:SaveProfileSpecial()
end
--> load profile and active instances
local current_profile_name = _detalhes:GetCurrentProfileName()
--> check if exists, if not, create one
local profile = _detalhes:GetProfile (current_profile_name, true)
--> instances
_detalhes.tabela_instancias = _detalhes_database.tabela_instancias or {}
--so if the instances are loaded, the taint happen
--if I break the tabela_instancias the addon won't taint
--if true then return end --if I return here, the addon taints
--> fix for version 1.21.0
if (#_detalhes.tabela_instancias > 0) then --> only happens once after the character logon
--if (current_profile_name:find (UnitName ("player"))) then
@@ -390,16 +393,16 @@ function _detalhes:LoadConfig()
local instance = _detalhes.tabela_instancias [index]
if (instance) then
saved_skin.__was_opened = instance.ativa
saved_skin.__pos = table_deepcopy (instance.posicao)
saved_skin.__pos = Details.CopyTable (instance.posicao)
saved_skin.__locked = instance.isLocked
saved_skin.__snap = table_deepcopy (instance.snap)
saved_skin.__snap = Details.CopyTable (instance.snap)
saved_skin.__snapH = instance.horizontalSnap
saved_skin.__snapV = instance.verticalSnap
for key, value in pairs (instance) do
if (_detalhes.instance_defaults [key] ~= nil) then
if (_detalhes.instance_defaults [key] ~= nil) then
if (type (value) == "table") then
saved_skin [key] = table_deepcopy (value)
saved_skin [key] = Details.CopyTable (value)
else
saved_skin [key] = value
end
@@ -407,40 +410,39 @@ function _detalhes:LoadConfig()
end
end
end
for index, instance in _detalhes:ListInstances() do
_detalhes.local_instances_config [index] = {
pos = table_deepcopy (instance.posicao),
pos = Details.CopyTable (instance.posicao),
is_open = instance.ativa,
attribute = instance.atributo,
sub_attribute = instance.sub_atributo,
mode = instance.modo or 2,
modo = instance.modo or 2,
segment = instance.segmento,
snap = table_deepcopy (instance.snap),
snap = Details.CopyTable (instance.snap),
horizontalSnap = instance.horizontalSnap,
verticalSnap = instance.verticalSnap,
sub_atributo_last = instance.sub_atributo_last,
isLocked = instance.isLocked
}
if (_detalhes.local_instances_config [index].isLocked == nil) then
_detalhes.local_instances_config [index].isLocked = false
end
end
--end
_detalhes.tabela_instancias = {}
end
--_detalhes:ReativarInstancias()
--> apply the profile
_detalhes:ApplyProfile (current_profile_name, true)
--> custom
_detalhes.custom = _detalhes_global.custom
_detalhes.refresh:r_atributo_custom()
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+11 -14
View File
@@ -1,6 +1,3 @@
local Details = _G.Details
local DF = _G.DetailsFramework
local C_Timer = _G.C_Timer
@@ -129,12 +126,12 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd()
--> immediatly finishes the segment just started
Details:SairDoCombate()
--> update all windows
Details:InstanciaCallFunction (Details.gump.Fade, "in", nil, "barras")
Details:InstanciaCallFunction (Details.AtualizaSegmentos)
Details:InstanciaCallFunction (Details.AtualizaSoloMode_AfertReset)
Details:InstanciaCallFunction (Details.ResetaGump)
Details:InstanciaCallFunction(Details.FadeHandler.Fader, "IN", nil, "barras")
Details:InstanciaCallFunction(Details.AtualizaSegmentos)
Details:InstanciaCallFunction(Details.AtualizaSoloMode_AfertReset)
Details:InstanciaCallFunction(Details.ResetaGump)
Details:RefreshMainWindow (-1, true)
if (DetailsMythicPlusFrame.DevelopmentDebug) then
@@ -253,7 +250,7 @@ function DetailsMythicPlusFrame.MergeTrashCleanup (isFromSchedule)
end
--> update all windows
Details:InstanciaCallFunction (Details.gump.Fade, "in", nil, "barras")
Details:InstanciaCallFunction (Details.FadeHandler.Fader, "IN", nil, "barras")
Details:InstanciaCallFunction (Details.AtualizaSegmentos)
Details:InstanciaCallFunction (Details.AtualizaSoloMode_AfertReset)
Details:InstanciaCallFunction (Details.ResetaGump)
@@ -351,11 +348,11 @@ function DetailsMythicPlusFrame.MergeRemainingTrashAfterAllBossesDone()
end
--> update all windows
Details:InstanciaCallFunction (Details.gump.Fade, "in", nil, "barras")
Details:InstanciaCallFunction (Details.AtualizaSegmentos)
Details:InstanciaCallFunction (Details.AtualizaSoloMode_AfertReset)
Details:InstanciaCallFunction (Details.ResetaGump)
Details:RefreshMainWindow (-1, true)
Details:InstanciaCallFunction(Details.FadeHandler.Fader, "IN", nil, "barras")
Details:InstanciaCallFunction(Details.AtualizaSegmentos)
Details:InstanciaCallFunction(Details.AtualizaSoloMode_AfertReset)
Details:InstanciaCallFunction(Details.ResetaGump)
Details:RefreshMainWindow(-1, true)
end
Details:SendEvent ("DETAILS_DATA_SEGMENTREMOVED")
+13 -13
View File
@@ -37,7 +37,7 @@ function _detalhes:CreateProfile (name)
end
--> copy the default table
local new_profile = table_deepcopy (_detalhes.default_profile)
local new_profile = Details.CopyTable (_detalhes.default_profile)
new_profile.instances = {}
--> add to global container
@@ -126,7 +126,7 @@ function _detalhes:SetProfileCProp (name, cprop, value)
if (profile) then
if (type (value) == "table") then
rawset (profile, cprop, table_deepcopy (value))
rawset (profile, cprop, Details.CopyTable (value))
else
rawset (profile, cprop, value)
end
@@ -171,7 +171,7 @@ function _detalhes:ResetProfile (profile_name)
local instance = _detalhes:GetInstance (1)
local exported = instance:ExportSkin()
exported.__was_opened = instance:IsEnabled()
exported.__pos = table_deepcopy (instance:GetPosition())
exported.__pos = Details.CopyTable (instance:GetPosition())
exported.__locked = instance.isLocked
exported.__snap = {}
exported.__snapH = false
@@ -239,7 +239,7 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
--> the entire key doesn't exist
if (profile [key] == nil) then
if (type (value) == "table") then
profile [key] = table_deepcopy (_detalhes.default_profile [key])
profile [key] = Details.CopyTable (_detalhes.default_profile [key])
else
profile [key] = value
end
@@ -257,10 +257,10 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
if (type (value) == "table") then
if (key == "class_specs_coords") then
value = table_deepcopy (_detalhes.default_profile.class_specs_coords)
value = Details.CopyTable (_detalhes.default_profile.class_specs_coords)
end
local ctable = table_deepcopy (value)
local ctable = Details.CopyTable (value)
_detalhes [key] = ctable
else
_detalhes [key] = value
@@ -341,7 +341,7 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
--> copy skin
for key, value in pairs (skin) do
if (type (value) == "table") then
instance [key] = table_deepcopy (value)
instance [key] = Details.CopyTable (value)
else
instance [key] = value
end
@@ -374,7 +374,7 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
if (_detalhes.profile_save_pos) then
--print ("is profile save pos", skin.__pos.normal.x, skin.__pos.normal.y)
if (skin.__pos) then
instance.posicao = table_deepcopy (skin.__pos)
instance.posicao = Details.CopyTable (skin.__pos)
else
if (not instance.posicao) then
print ("|cFFFF2222Details!: Position for a window wasn't found! Moving it to the center of the screen.|r\nType '/details exitlog' to check for errors.")
@@ -386,7 +386,7 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
end
instance.isLocked = skin.__locked
instance.snap = table_deepcopy (skin.__snap) or {}
instance.snap = Details.CopyTable (skin.__snap) or {}
instance.horizontalSnap = skin.__snapH
instance.verticalSnap = skin.__snapV
else
@@ -534,7 +534,7 @@ function _detalhes:SaveProfile (saveas)
local current_value = _detalhes [key]
if (type (current_value) == "table") then
local ctable = table_deepcopy (current_value)
local ctable = Details.CopyTable (current_value)
profile [key] = ctable
else
profile [key] = current_value
@@ -548,9 +548,9 @@ function _detalhes:SaveProfile (saveas)
for index, instance in ipairs (_detalhes.tabela_instancias) do
local exported = instance:ExportSkin()
exported.__was_opened = instance:IsEnabled()
exported.__pos = table_deepcopy (instance:GetPosition())
exported.__pos = Details.CopyTable (instance:GetPosition())
exported.__locked = instance.isLocked
exported.__snap = table_deepcopy (instance.snap)
exported.__snap = Details.CopyTable (instance.snap)
exported.__snapH = instance.horizontalSnap
exported.__snapV = instance.verticalSnap
profile.instances [index] = exported
@@ -1420,7 +1420,7 @@ function _detalhes:SaveProfileSpecial()
local current_value = _detalhes_database [key] or _detalhes_global [key] or _detalhes.default_player_data [key] or _detalhes.default_global_data [key]
if (type (current_value) == "table") then
local ctable = table_deepcopy (current_value)
local ctable = Details.CopyTable (current_value)
profile [key] = ctable
else
profile [key] = current_value
+2 -2
View File
@@ -58,9 +58,9 @@
do
local fade_func = function (row, state)
if (state) then
_detalhes.gump:Fade (row, "out")
Details.FadeHandler.Fader (row, "out")
else
_detalhes.gump:Fade (row, "in")
Details.FadeHandler.Fader (row, "in")
end
end
local fade_desc = "Default animation, makes the bar fade in or fade out when showing or hiding in the window"
+4 -4
View File
@@ -31,14 +31,14 @@ function _detalhes:SaveLocalInstanceConfig()
local a1, a2 = instance:GetDisplay()
local t = {
pos = table_deepcopy (instance:GetPosition()),
pos = Details.CopyTable (instance:GetPosition()),
is_open = instance:IsEnabled(),
attribute = a1 or 1,
sub_attribute = a2 or 1,
modo = instance:GetMode() or 2,
mode = instance:GetMode() or 2,
segment = instance:GetSegment() or 0,
snap = table_deepcopy (instance.snap),
snap = Details.CopyTable (instance.snap),
horizontalSnap = instance.horizontalSnap,
verticalSnap = instance.verticalSnap,
sub_atributo_last = instance.sub_atributo_last or {1, 1, 1, 1, 1},
@@ -54,10 +54,10 @@ function _detalhes:SaveLocalInstanceConfig()
local cprofile = _detalhes:GetProfile()
local skin = cprofile.instances [instance:GetId()]
if (skin) then
t.pos = table_deepcopy (skin.__pos)
t.pos = Details.CopyTable (skin.__pos)
t.horizontalSnap = skin.__snapH
t.verticalSnap = skin.__snapV
t.snap = table_deepcopy (skin.__snap)
t.snap = Details.CopyTable (skin.__snap)
t.is_open = skin.__was_opened
t.isLocked = skin.__locked
end
+6 -6
View File
@@ -383,7 +383,7 @@ function SlashCmdList.DETAILS (msg, editbox)
_detalhes.tabela_historico:adicionar (combat)
_detalhes:InstanciaCallFunction (_detalhes.gump.Fade, "in", nil, "barras")
_detalhes:InstanciaCallFunction (Details.FadeHandler.Fader, "in", nil, "barras")
_detalhes:InstanciaCallFunction (_detalhes.AtualizaSegmentos) -- atualiza o instancia.showing para as novas tabelas criadas
_detalhes:InstanciaCallFunction (_detalhes.AtualizaSoloMode_AfertReset) -- verifica se precisa zerar as tabela da janela solo mode
_detalhes:InstanciaCallFunction (_detalhes.ResetaGump) --_detalhes:ResetaGump ("de todas as instancias")
@@ -553,11 +553,11 @@ function SlashCmdList.DETAILS (msg, editbox)
_detalhes.ResetButton:SetBackdropColor (0, 0, 1, 1)
--vardump (_detalhes.ResetButton)
--Details.VarDump (_detalhes.ResetButton)
elseif (command == "mini") then
local instance = _detalhes.tabela_instancias [1]
--vardump ()
--Details.VarDump ()
--print (instance, instance.StatusBar.options, instance.StatusBar.left)
print (instance.StatusBar.options [instance.StatusBar.left.mainPlugin.real_name].textSize)
print (instance.StatusBar.left.options.textSize)
@@ -693,8 +693,8 @@ function SlashCmdList.DETAILS (msg, editbox)
local f = MacroFrameTextBackground
local backdrop = MacroFrameTextBackground:GetBackdrop()
vardump (backdrop)
vardump (backdrop.insets)
Details.VarDump (backdrop)
Details.VarDump (backdrop.insets)
print ("bgcolor:",f:GetBackdropColor())
print ("bordercolor",f:GetBackdropBorderColor())
@@ -1433,7 +1433,7 @@ function SlashCmdList.DETAILS (msg, editbox)
--> clear memory
collectgarbage()
_detalhes:InstanciaCallFunction (_detalhes.gump.Fade, "in", nil, "barras")
_detalhes:InstanciaCallFunction (Details.FadeHandler.Fader, "in", nil, "barras")
_detalhes:InstanciaCallFunction (_detalhes.AtualizaSegmentos)
_detalhes:InstanciaCallFunction (_detalhes.AtualizaSoloMode_AfertReset)
_detalhes:InstanciaCallFunction (_detalhes.ResetaGump)
+2 -2
View File
@@ -192,7 +192,7 @@
local func, errortext = loadstring (t [INDEX_FUNCTION])
if (func) then
DetailsFramework:SetEnvironment(func)
tinsert (exec, { func = func, data = data, attributes = table_deepcopy (t [INDEX_MATRIX]), is_user = true })
tinsert (exec, { func = func, data = data, attributes = Details.CopyTable (t [INDEX_MATRIX]), is_user = true })
else
_detalhes:Msg ("|cFFFF9900error compiling script for time data (charts)|r: ", errortext)
end
@@ -200,7 +200,7 @@
--> plugin
local func = t [INDEX_FUNCTION]
DetailsFramework:SetEnvironment(func)
tinsert (exec, { func = func, data = data, attributes = table_deepcopy (t [INDEX_MATRIX]) })
tinsert (exec, { func = func, data = data, attributes = Details.CopyTable (t [INDEX_MATRIX]) })
end
end