Improvements on skin installation

This commit is contained in:
Tercio Jose
2022-04-28 16:44:04 -03:00
parent 1afb897904
commit dfd3fa8406
4 changed files with 49 additions and 12 deletions
+6
View File
@@ -5662,6 +5662,12 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
--load auto run code --load auto run code
Details:StartAutoRun() Details:StartAutoRun()
Details.isLoaded = true
end
function Details.IsLoaded()
return Details.isLoaded
end end
function _detalhes.parser_functions:ADDON_LOADED (...) function _detalhes.parser_functions:ADDON_LOADED (...)
+13 -4
View File
@@ -6870,22 +6870,31 @@ function _detalhes:RefreshMicroDisplays()
end end
function Details:WaitForSkin() function Details:WaitForSkin()
local skinName = self.skin
local hasSkinInCache = Details.installed_skins_cache[skinName]
if (hasSkinInCache) then
Details:InstallSkin(skinName, hasSkinInCache)
local skin = Details.skins[skinName]
if (skin) then
return skin
end
end
Details.waitingForSkins = Details.waitingForSkins or {} Details.waitingForSkins = Details.waitingForSkins or {}
Details.waitingForSkins[self:GetId()] = self.skin Details.waitingForSkins[self:GetId()] = skinName
local defaultSkin = _detalhes.default_skin_to_use local defaultSkin = _detalhes.default_skin_to_use
skin = _detalhes.skins[defaultSkin] local skin = _detalhes.skins[defaultSkin]
self.skin = defaultSkin self.skin = defaultSkin
return skin return skin
end end
function Details:ChangeSkin(skin_name) function Details:ChangeSkin(skin_name)
if (not skin_name) then if (not skin_name) then
skin_name = self.skin skin_name = self.skin
end end
local this_skin = _detalhes.skins [skin_name] local this_skin = _detalhes.skins[skin_name]
if (not this_skin) then if (not this_skin) then
local tempSkin = Details:WaitForSkin() local tempSkin = Details:WaitForSkin()
this_skin = tempSkin this_skin = tempSkin
+1
View File
@@ -1275,6 +1275,7 @@ local default_global_data = {
["14"] = false, ["14"] = false,
}, },
current_exp_raid_encounters = {}, current_exp_raid_encounters = {},
installed_skins_cache = {},
--> all switch settings (panel shown when right click the title bar) --> all switch settings (panel shown when right click the title bar)
all_switch_config = { all_switch_config = {
+21
View File
@@ -15,6 +15,17 @@ local _
return false -- no skin file return false -- no skin file
end end
if (not skin_table.no_cache) then
--Detatils! can cache the skin installed by other addons or scripts
--This way the skin original table is saved within the addon and can work even if the other addon is outdated or disabled
if (Details.IsLoaded()) then
Details.installed_skins_cache[skin_name] = skin_table
print("Skin added to the skin cache", skin_name)
else
Details:Msg("cannot install a skin without 'skin.no_cache' before 'Details.IsLoaded()' is true.")
end
end
skin_table.author = skin_table.author or "" skin_table.author = skin_table.author or ""
skin_table.version = skin_table.version or "" skin_table.version = skin_table.version or ""
skin_table.site = skin_table.site or "" skin_table.site = skin_table.site or ""
@@ -62,6 +73,7 @@ local _
version = "1.0", version = "1.0",
site = "unknown", site = "unknown",
desc = "This was the first skin made for Details!, inspired in the standard wow interface", desc = "This was the first skin made for Details!, inspired in the standard wow interface",
no_cache = true,
can_change_alpha_head = false, can_change_alpha_head = false,
icon_anchor_main = {-1, 1}, icon_anchor_main = {-1, 1},
@@ -296,6 +308,7 @@ local _
version = "1.0", version = "1.0",
site = "unknown", site = "unknown",
desc = "Simple skin with soft gray color and half transparent frames.", --\n desc = "Simple skin with soft gray color and half transparent frames.", --\n
no_cache = true,
--micro frames --micro frames
micro_frames = { micro_frames = {
@@ -520,6 +533,7 @@ local _
version = "1.0", version = "1.0",
site = "unknown", site = "unknown",
desc = "Same as the first Minimalistic, but this one is more darker and less transparent.", desc = "Same as the first Minimalistic, but this one is more darker and less transparent.",
no_cache = true,
--micro frames --micro frames
micro_frames = { micro_frames = {
@@ -740,6 +754,7 @@ local _
version = "1.0", version = "1.0",
site = "unknown", site = "unknown",
desc = "Light blue, this skin fits on almost all interfaces.\n\nFor ElvUI interfaces, change the window color to black to get an compatible visual.", desc = "Light blue, this skin fits on almost all interfaces.\n\nFor ElvUI interfaces, change the window color to black to get an compatible visual.",
no_cache = true,
--micro frames --micro frames
micro_frames = { micro_frames = {
@@ -1054,6 +1069,7 @@ local _
version = "1.0", version = "1.0",
site = "unknown", site = "unknown",
desc = "Very clean skin without textures and only with a black contour.", desc = "Very clean skin without textures and only with a black contour.",
no_cache = true,
--general --general
can_change_alpha_head = true, can_change_alpha_head = true,
@@ -1314,6 +1330,7 @@ local _
version = "1.0", version = "1.0",
site = "unknown", site = "unknown",
desc = "This skin is based on ElvUI's addons, relying with black and transparent frames.", desc = "This skin is based on ElvUI's addons, relying with black and transparent frames.",
no_cache = true,
--general --general
can_change_alpha_head = true, can_change_alpha_head = true,
@@ -1563,6 +1580,7 @@ local _
version = "1.0", version = "1.0",
site = "unknown", site = "unknown",
desc = "based on AddonSkins for ElvUI, this skin has opaque title bar and background.", desc = "based on AddonSkins for ElvUI, this skin has opaque title bar and background.",
no_cache = true,
--general --general
can_change_alpha_head = true, can_change_alpha_head = true,
@@ -1745,6 +1763,7 @@ local _
version = "1.0", version = "1.0",
site = "unknown", site = "unknown",
desc = "Regular Details! skin but with a dark theme.", desc = "Regular Details! skin but with a dark theme.",
no_cache = true,
--general --general
can_change_alpha_head = true, can_change_alpha_head = true,
@@ -2232,6 +2251,7 @@ local _
version = "1.0", version = "1.0",
site = "unknown", site = "unknown",
desc = "Simple skin with soft gray color and half transparent frames.", --\n desc = "Simple skin with soft gray color and half transparent frames.", --\n
no_cache = true,
--micro frames --micro frames
micro_frames = { micro_frames = {
@@ -2490,6 +2510,7 @@ local _
version = "1.0", version = "1.0",
site = "unknown", site = "unknown",
desc = "Simple skin with soft gray color and half transparent frames.", --\n desc = "Simple skin with soft gray color and half transparent frames.", --\n
no_cache = true,
--micro frames --micro frames
micro_frames = { micro_frames = {