add: talentbackground module
parent
354fe44944
commit
6945ad473e
33
Core.lua
33
Core.lua
|
|
@ -1,16 +1,25 @@
|
|||
local addonName, DX = ...
|
||||
_G[addonName] = DX
|
||||
DX.Modules = {}
|
||||
|
||||
local f = CreateFrame("Frame")
|
||||
f:RegisterEvent("ADDON_LOADED")
|
||||
function DX:AddModule(name, func)
|
||||
DX.Modules[name] = {
|
||||
Init = func,
|
||||
Enabled = true
|
||||
}
|
||||
end
|
||||
|
||||
f:SetScript("OnEvent", function(self, event, ...)
|
||||
if event == "ADDON_LOADED" and ... == addonName then
|
||||
self:UnregisterEvent("ADDON_LOADED")
|
||||
DX:Initialize()
|
||||
local coreFrame = CreateFrame("Frame")
|
||||
coreFrame:RegisterEvent("PLAYER_LOGIN")
|
||||
|
||||
coreFrame:SetScript("OnEvent", function(self, event)
|
||||
if event == "PLAYER_LOGIN" then
|
||||
print("|cffFF4500DX Tweaks:|r Loading modules")
|
||||
for name, module in pairs(DX.Modules) do
|
||||
if module.Enabled then
|
||||
module.Init()
|
||||
print("|cffFF4500DX Tweaks:|r " .. name .. " loaded")
|
||||
end
|
||||
end
|
||||
self:UnregisterEvent("PLAYER_LOGIN")
|
||||
end
|
||||
end)
|
||||
|
||||
function DX:Initialize()
|
||||
print("|cffFF4500DX Tweaks|r geladen!")
|
||||
end
|
||||
end)
|
||||
|
|
@ -27,4 +27,5 @@ libs\LibSharedMedia-3.0\LibSharedMedia-3.0.lua
|
|||
Media.lua
|
||||
Core.lua
|
||||
|
||||
# Modules
|
||||
# Modules
|
||||
modules\talentbackground\TalentBackground.lua
|
||||
|
|
@ -3,4 +3,9 @@ local LSM = LibStub("LibSharedMedia-3.0")
|
|||
-- -----
|
||||
-- FONT
|
||||
-- -----
|
||||
LSM:Register('font', 'DX Narrow', [[Interface\Addons\DX_Tweaks\media\fonts\DX_Narrow.ttf]])
|
||||
LSM:Register('font', 'DX Narrow', [[Interface\Addons\DX_Tweaks\media\fonts\DX_Narrow.ttf]])
|
||||
|
||||
-- -----
|
||||
-- BACKGROUND
|
||||
-- -----
|
||||
LSM:Register('background', 'DX TalentBG', [[Interface\AddOns\DX_Tweaks\media\textures\talent_bg.tga]])
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.0 MiB |
|
|
@ -0,0 +1,51 @@
|
|||
local addonName, DX = ...
|
||||
|
||||
local LSM = LibStub("LibSharedMedia-3.0")
|
||||
|
||||
local function LoadTalentBackground()
|
||||
local eventFrame = CreateFrame("Frame")
|
||||
|
||||
local function ApplyBG()
|
||||
local frame = _G.PlayerSpellsFrame
|
||||
if not frame or not frame.TalentsFrame then return end
|
||||
|
||||
local bg = frame.TalentsFrame.Background
|
||||
if bg then
|
||||
local bgPath = LSM:Fetch("background", "DX TalentBG")
|
||||
bg:SetAtlas(nil)
|
||||
bg:SetTexture(bgPath)
|
||||
bg:SetAlpha(1)
|
||||
bg:SetDesaturated(false)
|
||||
bg:SetVertexColor(1, 1, 1, 1)
|
||||
bg:SetDrawLayer("BACKGROUND", -8)
|
||||
bg:SetHorizTile(false)
|
||||
bg:SetVertTile(false)
|
||||
end
|
||||
end
|
||||
|
||||
local function SetupHooks()
|
||||
local frame = _G.PlayerSpellsFrame
|
||||
if not frame then return end
|
||||
|
||||
hooksecurefunc(frame, "Show", function()
|
||||
C_Timer.After(0.05, ApplyBG)
|
||||
end)
|
||||
if frame:IsVisible() then
|
||||
ApplyBG()
|
||||
end
|
||||
end
|
||||
|
||||
if C_AddOns.IsAddOnLoaded("Blizzard_PlayerSpells") then
|
||||
SetupHooks()
|
||||
else
|
||||
eventFrame:SetScript("OnEvent", function(self, event, name)
|
||||
if name == "Blizzard_PlayerSpells" then
|
||||
SetupHooks()
|
||||
self:UnregisterEvent("ADDON_LOADED")
|
||||
end
|
||||
end)
|
||||
eventFrame:RegisterEvent("ADDON_LOADED")
|
||||
end
|
||||
end
|
||||
|
||||
DX:AddModule("TalentBackground", LoadTalentBackground)
|
||||
Loading…
Reference in New Issue