第一次发版v0.1.0
This commit is contained in:
65
Target.lua
Normal file
65
Target.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
NanamiPlates_Target = {}
|
||||
|
||||
local NP = NanamiPlates
|
||||
local Settings = NP.Settings
|
||||
|
||||
local function ApplyArrowTint(ind)
|
||||
if not ind or not ind.tex then return end
|
||||
local tint = Settings.targetArrowTint or 0
|
||||
if tint <= 0 then
|
||||
ind.tex:SetVertexColor(1, 1, 1, 1)
|
||||
else
|
||||
local acR, acG, acB = NP.GetThemeColor("accent", 1.0, 0.5, 0.8, 1)
|
||||
local r = 1 + (acR - 1) * tint
|
||||
local g = 1 + (acG - 1) * tint
|
||||
local b = 1 + (acB - 1) * tint
|
||||
ind.tex:SetVertexColor(r, g, b, 1)
|
||||
end
|
||||
end
|
||||
|
||||
function NanamiPlates_Target.UpdateTarget(nameplate, isTarget)
|
||||
if not nameplate then return end
|
||||
|
||||
local indL = nameplate.targetArrowL
|
||||
local indR = nameplate.targetArrowR
|
||||
if not indL or not indR then return end
|
||||
|
||||
if isTarget and Settings.showTargetGlow then
|
||||
local acR, acG, acB = NP.GetThemeColor("accent", 1.0, 0.5, 0.8, 0.9)
|
||||
ApplyArrowTint(indL)
|
||||
ApplyArrowTint(indR)
|
||||
indL:Show()
|
||||
indR:Show()
|
||||
-- Highlight healthBG border for target
|
||||
if nameplate.healthBG then
|
||||
nameplate.healthBG:SetBackdropBorderColor(acR, acG, acB, 1)
|
||||
end
|
||||
-- Show additive glow overlay (color/alpha synced in UpdateNamePlate)
|
||||
if nameplate.targetGlow then
|
||||
if not nameplate.targetGlow:IsShown() then
|
||||
local barR, barG, barB = nameplate.health:GetStatusBarColor()
|
||||
local lum = 0.299 * barR + 0.587 * barG + 0.114 * barB
|
||||
local glowAlpha = 0.75
|
||||
if lum > 0.5 then
|
||||
glowAlpha = 0.75 * math.max(0.15, (1.0 - lum) * 2)
|
||||
end
|
||||
nameplate.targetGlow:SetStatusBarColor(barR, barG, barB, 1)
|
||||
nameplate.targetGlow:SetAlpha(glowAlpha)
|
||||
end
|
||||
nameplate.targetGlow:Show()
|
||||
end
|
||||
else
|
||||
indL:Hide()
|
||||
indR:Hide()
|
||||
-- Restore default border for non-target
|
||||
if nameplate.healthBG then
|
||||
local brR, brG, brB, brA = NP.GetThemeColor("panelBorder", 0.55, 0.30, 0.42, 0.9)
|
||||
nameplate.healthBG:SetBackdropBorderColor(brR, brG, brB, brA)
|
||||
end
|
||||
if nameplate.targetGlow then
|
||||
nameplate.targetGlow:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
NanamiPlates.Target = NanamiPlates_Target
|
||||
Reference in New Issue
Block a user