update np

This commit is contained in:
Bunny67
2018-07-28 21:14:28 +03:00
parent 05914d85e3
commit 31a64d0ca8
6 changed files with 50 additions and 17 deletions
@@ -44,7 +44,7 @@ function mod:ConfigureElement_CPoints(frame)
end end
function mod:ConstructElement_CPoints(parent) function mod:ConstructElement_CPoints(parent)
local frame = CreateFrame("Frame", nil, parent.HealthBar) local frame = CreateFrame("Frame", "$parentComboPoints", parent.HealthBar)
frame:SetPoint("CENTER", parent.HealthBar, "BOTTOM") frame:SetPoint("CENTER", parent.HealthBar, "BOTTOM")
frame:SetWidth(68) frame:SetWidth(68)
frame:SetHeight(1) frame:SetHeight(1)
+1 -2
View File
@@ -127,8 +127,7 @@ function mod:ConfigureElement_Glow(frame)
end end
function mod:ConstructElement_Glow(frame) function mod:ConstructElement_Glow(frame)
local f = CreateFrame("Frame", nil, frame) local f = CreateFrame("Frame", "$parentGlow", frame)
f:SetFrameLevel(frame.HealthBar:GetFrameLevel() - 1)
f:SetBackdrop({edgeFile = LSM:Fetch("border", "ElvUI GlowBorder"), edgeSize = E:Scale(6)}) f:SetBackdrop({edgeFile = LSM:Fetch("border", "ElvUI GlowBorder"), edgeSize = E:Scale(6)})
f:Hide() f:Hide()
@@ -139,7 +139,7 @@ function mod:ConfigureElement_HealthBar(frame, configuring)
end end
function mod:ConstructElement_HealthBar(parent) function mod:ConstructElement_HealthBar(parent)
local frame = CreateFrame("StatusBar", nil, parent) local frame = CreateFrame("StatusBar", "$parentHealthBar", parent)
self:StyleFrame(frame) self:StyleFrame(frame)
--[[ --[[
frame:SetScript("OnSizeChanged", function() frame:SetScript("OnSizeChanged", function()
@@ -29,7 +29,7 @@ function mod:ConfigureElement_Highlight(frame)
end end
function mod:ConstructElement_Highlight(frame) function mod:ConstructElement_Highlight(frame)
local f = CreateFrame("Frame", nil, frame) local f = CreateFrame("Frame", "$parentHighlight", frame)
f.texture = frame.HealthBar:CreateTexture(nil, "ARTWORK") f.texture = frame.HealthBar:CreateTexture(nil, "ARTWORK")
f.texture:SetVertexColor(1, 1, 1, 0.3) f.texture:SetVertexColor(1, 1, 1, 0.3)
f.texture:Hide() f.texture:Hide()
+45 -10
View File
@@ -55,8 +55,8 @@ function mod:SetPlateFrameLevel(frame, level, isTarget)
end end
frame:SetFrameLevel(level+1) frame:SetFrameLevel(level+1)
frame.HealthBar:SetFrameLevel(level+1) frame.HealthBar:SetFrameLevel(level+2)
frame.Glow:SetFrameLevel(frame:GetFrameLevel()-1) frame.Glow:SetFrameLevel(frame.HealthBar:GetFrameLevel()-1)
frame.Buffs:SetFrameLevel(level+1) frame.Buffs:SetFrameLevel(level+1)
frame.Debuffs:SetFrameLevel(level+1) frame.Debuffs:SetFrameLevel(level+1)
end end
@@ -334,6 +334,12 @@ function mod:OnShow(self, isUpdate)
self.UnitFrame.UnitClass = mod:UnitClass(self.UnitFrame.oldName:GetText(), unitType) self.UnitFrame.UnitClass = mod:UnitClass(self.UnitFrame.oldName:GetText(), unitType)
self.UnitFrame.UnitReaction = unitReaction self.UnitFrame.UnitReaction = unitReaction
if unitType == "FRIENDLY_PLAYER" or unitType == "FRIENDLY_NPC" then
self.UnitFrame:EnableMouse(not mod.db.clickThrough.friendly)
else
self.UnitFrame:EnableMouse(not mod.db.clickThrough.enemy)
end
if not self.UnitFrame.UnitClass then if not self.UnitFrame.UnitClass then
queryList[self.UnitFrame.UnitName] = self.UnitFrame queryList[self.UnitFrame.UnitName] = self.UnitFrame
end end
@@ -380,6 +386,9 @@ function mod:OnShow(self, isUpdate)
mod:UpdateElement_All(self.UnitFrame) mod:UpdateElement_All(self.UnitFrame)
self.UnitFrame:Show() self.UnitFrame:Show()
mod:UpdateElement_Filters(self.UnitFrame, "NAME_PLATE_UNIT_ADDED")
mod:ForEachPlate("ResetNameplateFrameLevel") --keep this after `UpdateElement_Filters`
end end
function mod:OnHide(self) function mod:OnHide(self)
@@ -434,21 +443,26 @@ end
function mod:ConfigureAll() function mod:ConfigureAll()
if E.private.nameplates.enable ~= true then return end if E.private.nameplates.enable ~= true then return end
self:StyleFilterConfigureEvents()
self:ForEachPlate("UpdateAllFrame") self:ForEachPlate("UpdateAllFrame")
self:UpdateCVars() self:UpdateCVars()
end end
function mod:ForEachPlate(functionToRun, ...) function mod:ForEachPlate(functionToRun)
for frame in pairs(self.CreatedPlates) do for frame in pairs(self.CreatedPlates) do
if frame and frame.UnitFrame then if frame and frame.UnitFrame then
self[functionToRun](self, frame.UnitFrame, unpack(arg)) self[functionToRun](self, frame.UnitFrame)
end end
end end
if functionToRun == "ResetNameplateFrameLevel" then
mod.CollectedFrameLevelCount = 1
end
end end
function mod:ForEachVisiblePlate(functionToRun, ...) function mod:ForEachVisiblePlate(functionToRun, a1, a2)
for frame in pairs(self.VisiblePlates) do for frame in pairs(self.VisiblePlates) do
self[functionToRun](self, frame, unpack(arg)) self[functionToRun](self, frame, a1, a2)
end end
end end
@@ -507,6 +521,16 @@ function mod:OnCreated(frame)
frame.UnitFrame.plateID = plateID frame.UnitFrame.plateID = plateID
frame.UnitFrame:SetScript("OnEvent", self.OnEvent) frame.UnitFrame:SetScript("OnEvent", self.OnEvent)
--[[
frame.UnitFrame:SetScript("OnEnter", function()
end)
]]
frame.UnitFrame:SetScript("OnMouseDown", function()
if arg1 == "RightButton" then
MouselookStart()
end
end)
frame.UnitFrame:SetScript("OnClick", function() frame.UnitFrame:SetScript("OnClick", function()
frame:Click() frame:Click()
end) end)
@@ -569,10 +593,21 @@ function mod:OnCreated(frame)
self.VisiblePlates[frame.UnitFrame] = true self.VisiblePlates[frame.UnitFrame] = true
end end
function mod:OnEvent(event, unit, ...) function mod:OnEvent()
if not self.unit then return end if not arg1 and not this.unit then return end
if this.unit ~= arg1 then return end
mod:UpdateElement_Cast(self, event, unit, unpack(arg)) if event == "UPDATE_MOUSEOVER_UNIT" then
mod:UpdateElement_Highlight(this)
else
mod:UpdateElement_Cast(this, event, arg1, arg2)
end
end
function mod:RegisterEvents(frame)
if not frame.unit then return end
frame:RegisterEvent("UPDATE_MOUSEOVER_UNIT")
end end
function mod:QueueObject(object) function mod:QueueObject(object)
@@ -609,7 +644,7 @@ function mod:OnUpdate()
frame.alpha = 1 frame.alpha = 1
end end
frame:GetParent():SetAlpha(1) --frame:GetParent():SetAlpha(1)
frame.isTarget = mod.hasTarget and frame.alpha == 1 frame.isTarget = mod.hasTarget and frame.alpha == 1
end end
+1 -2
View File
@@ -792,18 +792,17 @@ E.Options.args.nameplate = {
guiInline = true, guiInline = true,
name = L["Click Through"], name = L["Click Through"],
get = function(info) return E.db.nameplates.clickThrough[ info[getn(info)] ] end, get = function(info) return E.db.nameplates.clickThrough[ info[getn(info)] ] end,
set = function(info, value) E.db.nameplates.clickThrough[ info[getn(info)] ] = value; NP:ConfigureAll() end,
args = { args = {
friendly = { friendly = {
order = 2, order = 2,
type = "toggle", type = "toggle",
name = L["Friendly"], name = L["Friendly"],
--set = function(info, value) E.db.nameplates.clickThrough.friendly = value; NP:SetNamePlateFriendlyClickThrough() end,
}, },
enemy = { enemy = {
order = 3, order = 3,
type = "toggle", type = "toggle",
name = L["Enemy"], name = L["Enemy"],
--set = function(info, value) E.db.nameplates.clickThrough.enemy = value; NP:SetNamePlateEnemyClickThrough() end,
}, },
}, },
}, },