mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 08:24:44 +00:00
unitframes
This commit is contained in:
@@ -64,7 +64,7 @@ local function Path(self, ...)
|
||||
* self - the parent object
|
||||
* event - the event triggering the update (string)
|
||||
--]]
|
||||
return (self.CombatIndicator.Override or Update) (self, ...)
|
||||
return (self.CombatIndicator.Override or Update) (self, unpack(arg))
|
||||
end
|
||||
|
||||
local function ForceUpdate(element)
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
<Script file="health.lua"/>
|
||||
<Script file="raidtargetindicator.lua"/>
|
||||
<Script file="leaderindicator.lua"/>
|
||||
<!--<Script file="combatindicator.lua"/>
|
||||
<Script file="combatindicator.lua"/>
|
||||
<Script file="restingindicator.lua"/>
|
||||
<Script file="pvpindicator.lua"/>-->
|
||||
<!--<Script file="pvpindicator.lua"/>-->
|
||||
<Script file="portrait.lua"/>
|
||||
<!--
|
||||
<Script file="range.lua"/>
|
||||
|
||||
@@ -64,7 +64,7 @@ local function Path(self, ...)
|
||||
* self - the parent object
|
||||
* event - the event triggering the update (string)
|
||||
--]]
|
||||
return (self.RestingIndicator.Override or Update) (self, ...)
|
||||
return (self.RestingIndicator.Override or Update) (self, unpack(arg))
|
||||
end
|
||||
|
||||
local function ForceUpdate(element)
|
||||
|
||||
@@ -232,19 +232,12 @@ local function InitializeSecureMenu()
|
||||
local menu
|
||||
if(unitType == 'party') then
|
||||
menu = 'PARTY'
|
||||
elseif(unitType == 'focus') then
|
||||
menu = 'RAID_TARGET_ICON'
|
||||
-- elseif(unitType == 'arenapet' or unitType == 'arena') then
|
||||
elseif(unitType == 'arena') then
|
||||
menu = 'RAID_TARGET_ICON'
|
||||
elseif(UnitIsUnit(unit, 'player')) then
|
||||
menu = 'SELF'
|
||||
elseif(UnitIsUnit(unit, 'pet')) then
|
||||
menu = 'PET'
|
||||
elseif(UnitIsPlayer(unit)) then
|
||||
if(UnitInRaid(unit)) then
|
||||
menu = 'RAID_PLAYER'
|
||||
elseif(UnitInParty(unit)) then
|
||||
if(UnitInRaid(unit) or UnitInParty(unit)) then
|
||||
menu = 'PARTY'
|
||||
else
|
||||
menu = 'PLAYER'
|
||||
@@ -299,13 +292,15 @@ local function initObject(unit, style, styleFunc, header, ...)
|
||||
-- We have to force update the frames when PEW fires.
|
||||
object:RegisterEvent('PLAYER_ENTERING_WORLD', object.UpdateAllElements)
|
||||
|
||||
if(not header) then
|
||||
-- No header means it's a frame created through :Spawn().
|
||||
object.menu = togglemenu
|
||||
object:SetScript("OnClick", function()
|
||||
TargetUnit(object.unit)
|
||||
if arg1 == "RightButton" then
|
||||
togglemenu(this, object.unit)
|
||||
else
|
||||
TargetUnit(this.unit)
|
||||
end
|
||||
end)
|
||||
|
||||
if(not header) then
|
||||
-- Other target units are handled by :HandleUnit().
|
||||
if(suffix == 'target') then
|
||||
enableTargetUpdate(object)
|
||||
@@ -316,10 +311,6 @@ local function initObject(unit, style, styleFunc, header, ...)
|
||||
-- Used to update frames when they change position in a group.
|
||||
object:RegisterEvent('RAID_ROSTER_UPDATE', object.UpdateAllElements)
|
||||
|
||||
object:SetScript("OnClick", function()
|
||||
TargetUnit(object.unit)
|
||||
end)
|
||||
|
||||
if(num > 1) then
|
||||
if(object:GetParent() == header) then
|
||||
object.hasChildren = true
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames");
|
||||
|
||||
--Cache global variables
|
||||
--Lua functions
|
||||
|
||||
--WoW API / Variables
|
||||
|
||||
function UF:Construct_CombatIndicator(frame)
|
||||
local combat = frame.RaisedElementParent.TextureParent:CreateTexture(nil, "OVERLAY")
|
||||
combat:SetWidth(19)
|
||||
combat:SetHeight(19)
|
||||
combat:SetPoint("CENTER", frame.Health, "CENTER", 0, 6)
|
||||
combat:SetVertexColor(0.69, 0.31, 0.31)
|
||||
|
||||
return combat
|
||||
end
|
||||
|
||||
function UF:Configure_CombatIndicator(frame)
|
||||
if frame.db.combatIcon and not frame:IsElementEnabled('CombatIndicator') then
|
||||
frame:EnableElement("CombatIndicator")
|
||||
elseif not frame.db.combatIcon and frame:IsElementEnabled('CombatIndicator') then
|
||||
frame:DisableElement("CombatIndicator")
|
||||
frame.CombatIndicator:Hide()
|
||||
end
|
||||
end
|
||||
@@ -1,4 +1,5 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/">
|
||||
<Script file="CombatIndicator.lua"/>
|
||||
<Script file="Health.lua"/>
|
||||
<Script file="Name.lua"/>
|
||||
<Script file="Portrait.lua"/>
|
||||
@@ -6,4 +7,5 @@
|
||||
<Script file="InfoPanel.lua"/>
|
||||
<Script file="RaidIcon.lua"/>
|
||||
<Script file="RaidRoleIcons.lua"/>
|
||||
<Script file="RestingIndicator.lua"/>
|
||||
</Ui>
|
||||
@@ -0,0 +1,40 @@
|
||||
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames");
|
||||
|
||||
--Cache global variables
|
||||
--Lua functions
|
||||
|
||||
--WoW API / Variables
|
||||
|
||||
function UF:Construct_RestingIndicator(frame)
|
||||
local resting = frame.RaisedElementParent.TextureParent:CreateTexture(nil, "OVERLAY")
|
||||
resting:SetWidth(22)
|
||||
resting:SetHeight(22)
|
||||
|
||||
return resting
|
||||
end
|
||||
|
||||
function UF:Configure_RestingIndicator(frame)
|
||||
if not frame.VARIABLES_SET then return end
|
||||
local rIcon = frame.RestingIndicator
|
||||
local db = frame.db
|
||||
if db.restIcon then
|
||||
if not frame:IsElementEnabled("RestingIndicator") then
|
||||
frame:EnableElement("RestingIndicator")
|
||||
end
|
||||
|
||||
rIcon:ClearAllPoints()
|
||||
if frame.ORIENTATION == "RIGHT" then
|
||||
rIcon:SetPoint("CENTER", frame.Health, "TOPLEFT", -3, 6)
|
||||
else
|
||||
if frame.USE_PORTRAIT and not frame.USE_PORTRAIT_OVERLAY then
|
||||
rIcon:SetPoint("CENTER", frame.Portrait, "TOPLEFT", -3, 6)
|
||||
else
|
||||
rIcon:SetPoint("CENTER", frame.Health, "TOPLEFT", -3, 6)
|
||||
end
|
||||
end
|
||||
elseif frame:IsElementEnabled("RestingIndicator") then
|
||||
frame:DisableElement("RestingIndicator")
|
||||
rIcon:Hide()
|
||||
end
|
||||
end
|
||||
@@ -23,6 +23,8 @@ function UF:Construct_PlayerFrame(frame)
|
||||
frame.Portrait3D = self:Construct_Portrait(frame, "model")
|
||||
frame.Portrait2D = self:Construct_Portrait(frame, "texture")
|
||||
frame.RaidTargetIndicator = UF:Construct_RaidIcon(frame)
|
||||
frame.RestingIndicator = self:Construct_RestingIndicator(frame)
|
||||
frame.CombatIndicator = self:Construct_CombatIndicator(frame)
|
||||
frame.InfoPanel = self:Construct_InfoPanel(frame)
|
||||
|
||||
frame:SetPoint("BOTTOMLEFT", E.UIParent, "BOTTOM", -413, 68)
|
||||
@@ -83,6 +85,10 @@ function UF:Update_PlayerFrame(frame, db)
|
||||
|
||||
UF:Configure_InfoPanel(frame)
|
||||
|
||||
UF:Configure_RestingIndicator(frame)
|
||||
|
||||
UF:Configure_CombatIndicator(frame)
|
||||
|
||||
UF:Configure_HealthBar(frame)
|
||||
|
||||
UF:UpdateNameSettings(frame)
|
||||
|
||||
Reference in New Issue
Block a user