unitframes

This commit is contained in:
Bunny67
2017-12-23 16:59:47 +03:00
parent f5d7682f92
commit 5d02fd5c31
8 changed files with 87 additions and 22 deletions
@@ -64,7 +64,7 @@ local function Path(self, ...)
* self - the parent object * self - the parent object
* event - the event triggering the update (string) * event - the event triggering the update (string)
--]] --]]
return (self.CombatIndicator.Override or Update) (self, ...) return (self.CombatIndicator.Override or Update) (self, unpack(arg))
end end
local function ForceUpdate(element) local function ForceUpdate(element)
@@ -4,9 +4,9 @@
<Script file="health.lua"/> <Script file="health.lua"/>
<Script file="raidtargetindicator.lua"/> <Script file="raidtargetindicator.lua"/>
<Script file="leaderindicator.lua"/> <Script file="leaderindicator.lua"/>
<!--<Script file="combatindicator.lua"/> <Script file="combatindicator.lua"/>
<Script file="restingindicator.lua"/> <Script file="restingindicator.lua"/>
<Script file="pvpindicator.lua"/>--> <!--<Script file="pvpindicator.lua"/>-->
<Script file="portrait.lua"/> <Script file="portrait.lua"/>
<!-- <!--
<Script file="range.lua"/> <Script file="range.lua"/>
@@ -64,7 +64,7 @@ local function Path(self, ...)
* self - the parent object * self - the parent object
* event - the event triggering the update (string) * event - the event triggering the update (string)
--]] --]]
return (self.RestingIndicator.Override or Update) (self, ...) return (self.RestingIndicator.Override or Update) (self, unpack(arg))
end end
local function ForceUpdate(element) local function ForceUpdate(element)
+9 -18
View File
@@ -232,19 +232,12 @@ local function InitializeSecureMenu()
local menu local menu
if(unitType == 'party') then if(unitType == 'party') then
menu = 'PARTY' 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 elseif(UnitIsUnit(unit, 'player')) then
menu = 'SELF' menu = 'SELF'
elseif(UnitIsUnit(unit, 'pet')) then elseif(UnitIsUnit(unit, 'pet')) then
menu = 'PET' menu = 'PET'
elseif(UnitIsPlayer(unit)) then elseif(UnitIsPlayer(unit)) then
if(UnitInRaid(unit)) then if(UnitInRaid(unit) or UnitInParty(unit)) then
menu = 'RAID_PLAYER'
elseif(UnitInParty(unit)) then
menu = 'PARTY' menu = 'PARTY'
else else
menu = 'PLAYER' menu = 'PLAYER'
@@ -299,13 +292,15 @@ local function initObject(unit, style, styleFunc, header, ...)
-- We have to force update the frames when PEW fires. -- We have to force update the frames when PEW fires.
object:RegisterEvent('PLAYER_ENTERING_WORLD', object.UpdateAllElements) object:RegisterEvent('PLAYER_ENTERING_WORLD', object.UpdateAllElements)
if(not header) then object:SetScript("OnClick", function()
-- No header means it's a frame created through :Spawn(). if arg1 == "RightButton" then
object.menu = togglemenu togglemenu(this, object.unit)
object:SetScript("OnClick", function() else
TargetUnit(object.unit) TargetUnit(this.unit)
end) end
end)
if(not header) then
-- Other target units are handled by :HandleUnit(). -- Other target units are handled by :HandleUnit().
if(suffix == 'target') then if(suffix == 'target') then
enableTargetUpdate(object) enableTargetUpdate(object)
@@ -316,10 +311,6 @@ local function initObject(unit, style, styleFunc, header, ...)
-- Used to update frames when they change position in a group. -- Used to update frames when they change position in a group.
object:RegisterEvent('RAID_ROSTER_UPDATE', object.UpdateAllElements) object:RegisterEvent('RAID_ROSTER_UPDATE', object.UpdateAllElements)
object:SetScript("OnClick", function()
TargetUnit(object.unit)
end)
if(num > 1) then if(num > 1) then
if(object:GetParent() == header) then if(object:GetParent() == header) then
object.hasChildren = true 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/"> <Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="CombatIndicator.lua"/>
<Script file="Health.lua"/> <Script file="Health.lua"/>
<Script file="Name.lua"/> <Script file="Name.lua"/>
<Script file="Portrait.lua"/> <Script file="Portrait.lua"/>
@@ -6,4 +7,5 @@
<Script file="InfoPanel.lua"/> <Script file="InfoPanel.lua"/>
<Script file="RaidIcon.lua"/> <Script file="RaidIcon.lua"/>
<Script file="RaidRoleIcons.lua"/> <Script file="RaidRoleIcons.lua"/>
<Script file="RestingIndicator.lua"/>
</Ui> </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.Portrait3D = self:Construct_Portrait(frame, "model")
frame.Portrait2D = self:Construct_Portrait(frame, "texture") frame.Portrait2D = self:Construct_Portrait(frame, "texture")
frame.RaidTargetIndicator = UF:Construct_RaidIcon(frame) 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.InfoPanel = self:Construct_InfoPanel(frame)
frame:SetPoint("BOTTOMLEFT", E.UIParent, "BOTTOM", -413, 68) frame:SetPoint("BOTTOMLEFT", E.UIParent, "BOTTOM", -413, 68)
@@ -83,6 +85,10 @@ function UF:Update_PlayerFrame(frame, db)
UF:Configure_InfoPanel(frame) UF:Configure_InfoPanel(frame)
UF:Configure_RestingIndicator(frame)
UF:Configure_CombatIndicator(frame)
UF:Configure_HealthBar(frame) UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame) UF:UpdateNameSettings(frame)