Skip to content

Commit

Permalink
Improvements on skin installation
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Apr 28, 2022
1 parent 1afb897 commit dfd3fa8
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 12 deletions.
6 changes: 6 additions & 0 deletions core/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5662,6 +5662,12 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1

--load auto run code
Details:StartAutoRun()

Details.isLoaded = true
end

function Details.IsLoaded()
return Details.isLoaded
end

function _detalhes.parser_functions:ADDON_LOADED (...)
Expand Down
17 changes: 13 additions & 4 deletions frames/window_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6870,22 +6870,31 @@ function _detalhes:RefreshMicroDisplays()
end

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[self:GetId()] = self.skin
Details.waitingForSkins[self:GetId()] = skinName

local defaultSkin = _detalhes.default_skin_to_use
skin = _detalhes.skins[defaultSkin]
local skin = _detalhes.skins[defaultSkin]
self.skin = defaultSkin
return skin
end

function Details:ChangeSkin(skin_name)

if (not skin_name) then
skin_name = self.skin
end

local this_skin = _detalhes.skins [skin_name]
local this_skin = _detalhes.skins[skin_name]
if (not this_skin) then
local tempSkin = Details:WaitForSkin()
this_skin = tempSkin
Expand Down
1 change: 1 addition & 0 deletions functions/profiles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,7 @@ local default_global_data = {
["14"] = false,
},
current_exp_raid_encounters = {},
installed_skins_cache = {},

--> all switch settings (panel shown when right click the title bar)
all_switch_config = {
Expand Down
37 changes: 29 additions & 8 deletions functions/skins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ local _
if (not skin_table.file) then
return false -- no skin file
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.version = skin_table.version or ""
Expand Down Expand Up @@ -62,6 +73,7 @@ local _
version = "1.0",
site = "unknown",
desc = "This was the first skin made for Details!, inspired in the standard wow interface",
no_cache = true,

can_change_alpha_head = false,
icon_anchor_main = {-1, 1},
Expand Down Expand Up @@ -296,6 +308,7 @@ local _
version = "1.0",
site = "unknown",
desc = "Simple skin with soft gray color and half transparent frames.", --\n
no_cache = true,

--micro frames
micro_frames = {
Expand Down Expand Up @@ -519,7 +532,8 @@ local _
author = "Details!",
version = "1.0",
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 = {
Expand Down Expand Up @@ -740,7 +754,8 @@ local _
version = "1.0",
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.",

no_cache = true,

--micro frames
micro_frames = {
left = "DETAILS_STATUSBAR_PLUGIN_PATTRIBUTE",
Expand Down Expand Up @@ -1054,7 +1069,8 @@ local _
version = "1.0",
site = "unknown",
desc = "Very clean skin without textures and only with a black contour.",

no_cache = true,

--general
can_change_alpha_head = true,

Expand Down Expand Up @@ -1314,7 +1330,8 @@ local _
version = "1.0",
site = "unknown",
desc = "This skin is based on ElvUI's addons, relying with black and transparent frames.",

no_cache = true,

--general
can_change_alpha_head = true,

Expand Down Expand Up @@ -1563,7 +1580,8 @@ local _
version = "1.0",
site = "unknown",
desc = "based on AddonSkins for ElvUI, this skin has opaque title bar and background.",

no_cache = true,

--general
can_change_alpha_head = true,

Expand Down Expand Up @@ -1745,7 +1763,8 @@ local _
version = "1.0",
site = "unknown",
desc = "Regular Details! skin but with a dark theme.",

no_cache = true,

--general
can_change_alpha_head = true,

Expand Down Expand Up @@ -2232,7 +2251,8 @@ local _
version = "1.0",
site = "unknown",
desc = "Simple skin with soft gray color and half transparent frames.", --\n

no_cache = true,

--micro frames
micro_frames = {
color = {1, 1, 1, 1},
Expand Down Expand Up @@ -2490,7 +2510,8 @@ local _
version = "1.0",
site = "unknown",
desc = "Simple skin with soft gray color and half transparent frames.", --\n

no_cache = true,

--micro frames
micro_frames = {
color = {1, 1, 1, 1},
Expand Down

0 comments on commit dfd3fa8

Please sign in to comment.