mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 08:24:44 +00:00
test range
This commit is contained in:
@@ -8,8 +8,7 @@
|
|||||||
<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"/>-->
|
|
||||||
<Script file="castbar.lua"/>
|
<Script file="castbar.lua"/>
|
||||||
<Script file="tags.lua"/>
|
<Script file="tags.lua"/>
|
||||||
<Script file="masterlooterindicator.lua"/>
|
<Script file="masterlooterindicator.lua"/>
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ local oUF = ns.oUF
|
|||||||
local _FRAMES = {}
|
local _FRAMES = {}
|
||||||
local OnRangeFrame
|
local OnRangeFrame
|
||||||
|
|
||||||
local UnitInRange, UnitIsConnected = UnitInRange, UnitIsConnected
|
local getn, tinsert, tremove = table.getn, table.insert, table.remove
|
||||||
|
local CheckInteractDistance, UnitIsConnected = CheckInteractDistance, UnitIsConnected
|
||||||
|
|
||||||
local function Update(self, event)
|
local function Update(self, event)
|
||||||
local element = self.Range
|
local element = self.Range
|
||||||
@@ -49,7 +50,7 @@ local function Update(self, event)
|
|||||||
local inRange
|
local inRange
|
||||||
local connected = UnitIsConnected(unit)
|
local connected = UnitIsConnected(unit)
|
||||||
if(connected) then
|
if(connected) then
|
||||||
inRange = UnitInRange(unit)
|
inRange = CheckInteractDistance(unit, 4)
|
||||||
if(not inRange) then
|
if(not inRange) then
|
||||||
self:SetAlpha(element.outsideAlpha)
|
self:SetAlpha(element.outsideAlpha)
|
||||||
else
|
else
|
||||||
@@ -79,13 +80,13 @@ 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.Range.Override or Update) (self, ...)
|
return (self.Range.Override or Update) (self, unpack(arg))
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Internal updating method
|
-- Internal updating method
|
||||||
local timer = 0
|
local timer = 0
|
||||||
local function OnRangeUpdate(_, elapsed)
|
local function OnRangeUpdate()
|
||||||
timer = timer + elapsed
|
timer = timer + arg1
|
||||||
|
|
||||||
if(timer >= .20) then
|
if(timer >= .20) then
|
||||||
for _, object in next, _FRAMES do
|
for _, object in next, _FRAMES do
|
||||||
@@ -110,7 +111,7 @@ local function Enable(self)
|
|||||||
OnRangeFrame:SetScript('OnUpdate', OnRangeUpdate)
|
OnRangeFrame:SetScript('OnUpdate', OnRangeUpdate)
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(_FRAMES, self)
|
tinsert(_FRAMES, self)
|
||||||
OnRangeFrame:Show()
|
OnRangeFrame:Show()
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@@ -122,13 +123,13 @@ local function Disable(self)
|
|||||||
if(element) then
|
if(element) then
|
||||||
for index, frame in next, _FRAMES do
|
for index, frame in next, _FRAMES do
|
||||||
if(frame == self) then
|
if(frame == self) then
|
||||||
table.remove(_FRAMES, index)
|
tremove(_FRAMES, index)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self:SetAlpha(element.insideAlpha)
|
self:SetAlpha(element.insideAlpha)
|
||||||
|
|
||||||
if(#_FRAMES == 0) then
|
if(getn(_FRAMES) == 0) then
|
||||||
OnRangeFrame:Hide()
|
OnRangeFrame:Hide()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
<Script file="PvPIndicator.lua"/>
|
<Script file="PvPIndicator.lua"/>
|
||||||
<Script file="RaidIcon.lua"/>
|
<Script file="RaidIcon.lua"/>
|
||||||
<Script file="RaidRoleIcons.lua"/>
|
<Script file="RaidRoleIcons.lua"/>
|
||||||
|
<Script file="Range.lua"/>
|
||||||
<Script file="RestingIndicator.lua"/>
|
<Script file="RestingIndicator.lua"/>
|
||||||
<Script file="FrameGlow.lua"/>
|
<Script file="FrameGlow.lua"/>
|
||||||
</Ui>
|
</Ui>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
local E, L, V, P, G = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||||
|
local UF = E:GetModule("UnitFrames");
|
||||||
|
|
||||||
|
function UF:Construct_Range()
|
||||||
|
local Range = {insideAlpha = 1, outsideAlpha = E.db.unitframe.OORAlpha}
|
||||||
|
Range.Override = UF.UpdateRange
|
||||||
|
|
||||||
|
return Range
|
||||||
|
end
|
||||||
|
|
||||||
|
function UF:Configure_Range(frame)
|
||||||
|
local range = frame.Range
|
||||||
|
if frame.db.rangeCheck then
|
||||||
|
if not frame:IsElementEnabled('Range') then
|
||||||
|
frame:EnableElement('Range')
|
||||||
|
end
|
||||||
|
|
||||||
|
range.outsideAlpha = E.db.unitframe.OORAlpha
|
||||||
|
else
|
||||||
|
if frame:IsElementEnabled('Range') then
|
||||||
|
frame:DisableElement('Range')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -31,6 +31,7 @@ function UF:Construct_PartyFrames()
|
|||||||
self.RaidTargetIndicator = UF:Construct_RaidIcon(self)
|
self.RaidTargetIndicator = UF:Construct_RaidIcon(self)
|
||||||
|
|
||||||
self.GPS = UF:Construct_GPS(self)
|
self.GPS = UF:Construct_GPS(self)
|
||||||
|
self.Range = UF:Construct_Range(self)
|
||||||
self.unitframeType = "party"
|
self.unitframeType = "party"
|
||||||
|
|
||||||
UF:Update_StatusBars()
|
UF:Update_StatusBars()
|
||||||
@@ -116,6 +117,8 @@ function UF:Update_PartyFrames(frame, db)
|
|||||||
|
|
||||||
UF:Configure_RaidRoleIcons(frame)
|
UF:Configure_RaidRoleIcons(frame)
|
||||||
|
|
||||||
|
UF:Configure_Range(frame)
|
||||||
|
|
||||||
frame:UpdateAllElements("ElvUI_UpdateAllElements")
|
frame:UpdateAllElements("ElvUI_UpdateAllElements")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user