mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 16:34:45 +00:00
93f5762a44
update #56 fix #38 fix #69
54 lines
1.7 KiB
Lua
54 lines
1.7 KiB
Lua
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
|
local UF = E:GetModule("UnitFrames");
|
|
|
|
local RestingTextures = {
|
|
["DEFAULT"] = [[Interface\CharacterFrame\UI-StateIcon]],
|
|
["RESTING"] = [[Interface\AddOns\ElvUI\media\textures\resting]],
|
|
["RESTING1"] = [[Interface\AddOns\ElvUI\media\textures\resting1]]
|
|
}
|
|
|
|
function UF:Construct_RestingIndicator(frame)
|
|
return frame.RaisedElementParent.TextureParent:CreateTexture(nil, "OVERLAY")
|
|
end
|
|
|
|
function UF:Configure_RestingIndicator(frame)
|
|
if not frame.VARIABLES_SET then return end
|
|
|
|
local Icon = frame.RestingIndicator
|
|
local db = frame.db.RestIcon
|
|
|
|
if db.enable then
|
|
if not frame:IsElementEnabled("RestingIndicator") then
|
|
frame:EnableElement("RestingIndicator")
|
|
end
|
|
|
|
if db.defaultColor then
|
|
Icon:SetVertexColor(1, 1, 1, 1)
|
|
Icon:SetDesaturated(false)
|
|
else
|
|
Icon:SetVertexColor(db.color.r, db.color.g, db.color.b, db.color.a)
|
|
Icon:SetDesaturated(true)
|
|
end
|
|
|
|
if db.texture == "CUSTOM" and db.customTexture then
|
|
Icon:SetTexture(db.customTexture)
|
|
Icon:SetTexCoord(0, 1, 0, 1)
|
|
elseif db.texture ~= "DEFAULT" and RestingTextures[db.texture] then
|
|
Icon:SetTexture(RestingTextures[db.texture])
|
|
Icon:SetTexCoord(0, 1, 0, 1)
|
|
else
|
|
Icon:SetTexture(RestingTextures.DEFAULT)
|
|
Icon:SetTexCoord(0, .5, 0, .421875)
|
|
end
|
|
|
|
E:Size(Icon, db.size)
|
|
Icon:ClearAllPoints()
|
|
if frame.ORIENTATION ~= "RIGHT" and (frame.USE_PORTRAIT and not frame.USE_PORTRAIT_OVERLAY) then
|
|
E:Point(Icon, "CENTER", frame.Portrait, db.anchorPoint, db.xOffset, db.yOffset)
|
|
else
|
|
E:Point(Icon, "CENTER", frame.Health, db.anchorPoint, db.xOffset, db.yOffset)
|
|
end
|
|
elseif frame:IsElementEnabled("RestingIndicator") then
|
|
frame:DisableElement("RestingIndicator")
|
|
end
|
|
end |