完成多出修改
修复拾取界面点击无效问题 修复宠物训练界面不显示训练点问题 新增天赋分享到聊天界面 修复飞行界面无法关闭问题 修复术士宠物的显示问题 为天赋界面添加默认数据库支持 框架现在也可自主选择是否启用 玩家框架和目标框架可取消显示3D头像以及透明度修改 背包和银行也添加透明度自定义支持 优化tooltip性能和背包物品显示方式 修复布局模式在ui缩放后不能正常定位的问题 添加硬核模式危险和死亡的工会通报 添加拾取和已拾取的框体 等等
This commit is contained in:
100
Tooltip.lua
100
Tooltip.lua
@@ -147,6 +147,11 @@ function SFrames.FloatingTooltip:Initialize()
|
||||
bg:SetAllPoints(bgFrame)
|
||||
GameTooltip._nanamiBGTex = bg
|
||||
|
||||
bgFrame:SetScript("OnUpdate", function()
|
||||
if not GameTooltip:IsVisible() then
|
||||
this:Hide()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
@@ -191,16 +196,27 @@ function SFrames.FloatingTooltip:Initialize()
|
||||
GameTooltipStatusBar.SetStatusBarColor = function() return end
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
-- Flag: true when tooltip was positioned via GameTooltip_SetDefaultAnchor
|
||||
-- (world mouseover units). False for bag/bank/inventory item tooltips
|
||||
-- that have their own anchoring — those should NOT be cursor-followed.
|
||||
--------------------------------------------------------------------------
|
||||
local ttUsesDefaultAnchor = false
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
-- Track mouseover name/level for health estimation
|
||||
--------------------------------------------------------------------------
|
||||
local ttMouseName, ttMouseLevel
|
||||
local ttHadUnit = false
|
||||
|
||||
local barEvents = CreateFrame("Frame", nil, GameTooltipStatusBar)
|
||||
barEvents:RegisterEvent("UPDATE_MOUSEOVER_UNIT")
|
||||
barEvents:SetScript("OnEvent", function()
|
||||
ttMouseName = UnitName("mouseover")
|
||||
ttMouseLevel = UnitLevel("mouseover")
|
||||
if UnitExists("mouseover") then
|
||||
ttHadUnit = true
|
||||
end
|
||||
end)
|
||||
|
||||
local function TT_Abbreviate(val)
|
||||
@@ -242,6 +258,7 @@ function SFrames.FloatingTooltip:Initialize()
|
||||
local orig_SetOwner = GameTooltip.SetOwner
|
||||
GameTooltip.SetOwner = function(self, owner, anchor, xOff, yOff)
|
||||
ttOwner = owner
|
||||
ttUsesDefaultAnchor = false
|
||||
return orig_SetOwner(self, owner, anchor, xOff, yOff)
|
||||
end
|
||||
|
||||
@@ -312,43 +329,64 @@ function SFrames.FloatingTooltip:Initialize()
|
||||
end
|
||||
end)
|
||||
|
||||
-- OnUpdate: throttled backdrop/bar refresh and cursor tracking
|
||||
-- OnUpdate: line formatting (once) + cursor tracking (every frame)
|
||||
local orig_OnUpdate = GameTooltip:GetScript("OnUpdate")
|
||||
local ttThrottle = 0
|
||||
local ttFormatThrottle = 0
|
||||
GameTooltip:SetScript("OnUpdate", function()
|
||||
if orig_OnUpdate then orig_OnUpdate() end
|
||||
|
||||
ttThrottle = ttThrottle + arg1
|
||||
if ttThrottle < 0.05 then return end
|
||||
ttThrottle = 0
|
||||
local isCursorMode = ttUsesDefaultAnchor and SFramesDB
|
||||
and SFramesDB.tooltipMode == "CURSOR" and not ttIsMapMarker
|
||||
|
||||
TT_ApplyBackdrop(this)
|
||||
TT_SyncBGFrame()
|
||||
if not ttIsMapMarker then
|
||||
TT_ShowBar(UnitExists("mouseover"))
|
||||
if isCursorMode then
|
||||
local hasUnit = UnitExists("mouseover")
|
||||
|
||||
if ttHadUnit and not hasUnit then
|
||||
TT_ShowBar(false)
|
||||
if GameTooltip._nanamiBGFrame then
|
||||
GameTooltip._nanamiBGFrame:Hide()
|
||||
end
|
||||
this:Hide()
|
||||
return
|
||||
end
|
||||
|
||||
if not hasUnit then
|
||||
TT_ShowBar(false)
|
||||
end
|
||||
|
||||
local x, y = GetCursorPosition()
|
||||
local uiScale = UIParent:GetEffectiveScale()
|
||||
local ttScale = this:GetScale() or 1
|
||||
if uiScale and uiScale > 0 and ttScale > 0 then
|
||||
local effScale = uiScale * ttScale
|
||||
local tx = (x / effScale) + 16
|
||||
local ty = (y / effScale) - 16
|
||||
this:ClearAllPoints()
|
||||
this:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", tx, ty)
|
||||
TT_SyncBGFrame()
|
||||
end
|
||||
end
|
||||
|
||||
ttFormatThrottle = ttFormatThrottle + arg1
|
||||
if ttFormatThrottle < 0.05 then return end
|
||||
ttFormatThrottle = 0
|
||||
|
||||
if not linesFormatted then
|
||||
linesFormatted = true
|
||||
if not ttIsMapMarker and UnitExists("mouseover") then
|
||||
SFrames.FloatingTooltip:FormatLines(this)
|
||||
end
|
||||
end
|
||||
|
||||
if SFramesDB and SFramesDB.tooltipMode == "CURSOR" and not ttIsMapMarker then
|
||||
local x, y = GetCursorPosition()
|
||||
local scale = UIParent:GetEffectiveScale()
|
||||
if scale and scale > 0 then
|
||||
this:ClearAllPoints()
|
||||
this:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", (x / scale) + 16, (y / scale) - 16)
|
||||
end
|
||||
TT_SyncBGFrame()
|
||||
end
|
||||
end)
|
||||
|
||||
-- OnHide: hide bg frame, reset flag and owner tracking
|
||||
-- OnHide: hide bg frame, health bar, reset flags and owner tracking
|
||||
local orig_OnHide = GameTooltip:GetScript("OnHide")
|
||||
GameTooltip:SetScript("OnHide", function()
|
||||
linesFormatted = false
|
||||
ttOwner = nil
|
||||
ttHadUnit = false
|
||||
TT_ShowBar(false)
|
||||
if GameTooltip._nanamiBGFrame then
|
||||
GameTooltip._nanamiBGFrame:Hide()
|
||||
end
|
||||
@@ -416,9 +454,11 @@ function SFrames.FloatingTooltip:Initialize()
|
||||
else
|
||||
orig_GameTooltip_SetDefaultAnchor(tooltip, parent)
|
||||
end
|
||||
ttUsesDefaultAnchor = true
|
||||
end
|
||||
end
|
||||
SFrames.FloatingTooltip:ApplyConfig()
|
||||
SFrames.FloatingTooltip:ApplyScale()
|
||||
|
||||
-- WorldMapTooltip: raw textures on a child frame (SetBackdrop is unreliable)
|
||||
if WorldMapTooltip and not WorldMapTooltip._nanamiBG then
|
||||
@@ -451,15 +491,35 @@ function SFrames.FloatingTooltip:Initialize()
|
||||
if SFrames.ItemCompare and SFrames.ItemCompare.HookTooltips then
|
||||
SFrames.ItemCompare:HookTooltips()
|
||||
end
|
||||
|
||||
if SFrames.Movers and SFrames.Movers.RegisterMover and self.anchor then
|
||||
SFrames.Movers:RegisterMover("Tooltip", self.anchor, "提示框",
|
||||
"BOTTOMRIGHT", "UIParent", "BOTTOMRIGHT", -20, 100)
|
||||
end
|
||||
end
|
||||
|
||||
function SFrames.FloatingTooltip:ApplyConfig()
|
||||
if SFramesDB and SFramesDB.tooltipX and SFramesDB.tooltipY and self.anchor then
|
||||
if not self.anchor then return end
|
||||
local pos = SFramesDB and SFramesDB.Positions and SFramesDB.Positions["Tooltip"]
|
||||
if pos and pos.point and pos.relativePoint then
|
||||
self.anchor:ClearAllPoints()
|
||||
self.anchor:SetPoint(pos.point, UIParent, pos.relativePoint, pos.xOfs or 0, pos.yOfs or 0)
|
||||
elseif SFramesDB and SFramesDB.tooltipX and SFramesDB.tooltipY then
|
||||
self.anchor:ClearAllPoints()
|
||||
self.anchor:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", SFramesDB.tooltipX, SFramesDB.tooltipY)
|
||||
end
|
||||
end
|
||||
|
||||
function SFrames.FloatingTooltip:ApplyScale()
|
||||
local scale = SFramesDB and SFramesDB.tooltipScale or 1.0
|
||||
if scale < 0.5 then scale = 0.5 end
|
||||
if scale > 2.0 then scale = 2.0 end
|
||||
GameTooltip:SetScale(scale)
|
||||
if GameTooltip._nanamiBGFrame then
|
||||
GameTooltip._nanamiBGFrame:SetScale(scale)
|
||||
end
|
||||
end
|
||||
|
||||
function SFrames.FloatingTooltip:ToggleAnchor(show)
|
||||
if not self.anchor then return end
|
||||
if show then
|
||||
|
||||
Reference in New Issue
Block a user