完成多出修改
修复拾取界面点击无效问题 修复宠物训练界面不显示训练点问题 新增天赋分享到聊天界面 修复飞行界面无法关闭问题 修复术士宠物的显示问题 为天赋界面添加默认数据库支持 框架现在也可自主选择是否启用 玩家框架和目标框架可取消显示3D头像以及透明度修改 背包和银行也添加透明度自定义支持 优化tooltip性能和背包物品显示方式 修复布局模式在ui缩放后不能正常定位的问题 添加硬核模式危险和死亡的工会通报 添加拾取和已拾取的框体 等等
This commit is contained in:
@@ -582,6 +582,11 @@ function SFrames.Party:Initialize()
|
||||
end)
|
||||
|
||||
self:UpdateAll()
|
||||
|
||||
if SFrames.Movers and SFrames.Movers.RegisterMover and self.parent then
|
||||
SFrames.Movers:RegisterMover("PartyFrame", self.parent, "小队",
|
||||
"TOPLEFT", "UIParent", "TOPLEFT", 15, -150)
|
||||
end
|
||||
end
|
||||
|
||||
function SFrames.Party:CreateAuras(index)
|
||||
@@ -1042,6 +1047,7 @@ function SFrames.Party:UpdateAuras(unit)
|
||||
SFrames.Tooltip:ClearLines()
|
||||
SFrames.Tooltip:SetUnitDebuff(unit, i)
|
||||
local timeLeft = SFrames:GetAuraTimeLeft(unit, i, false)
|
||||
SFrames.Tooltip:Hide()
|
||||
if timeLeft and timeLeft > 0 then
|
||||
local newExp = GetTime() + timeLeft
|
||||
if not b.expirationTime or math.abs(b.expirationTime - newExp) > 2 then
|
||||
@@ -1093,6 +1099,7 @@ function SFrames.Party:UpdateAuras(unit)
|
||||
SFrames.Tooltip:ClearLines()
|
||||
SFrames.Tooltip:SetUnitBuff(unit, i)
|
||||
local timeLeft = SFrames:GetAuraTimeLeft(unit, i, true)
|
||||
SFrames.Tooltip:Hide()
|
||||
if timeLeft and timeLeft > 0 then
|
||||
local newExp = GetTime() + timeLeft
|
||||
if not b.expirationTime or math.abs(b.expirationTime - newExp) > 2 then
|
||||
|
||||
232
Units/Pet.lua
232
Units/Pet.lua
@@ -7,6 +7,220 @@ local function Clamp(value, minValue, maxValue)
|
||||
return value
|
||||
end
|
||||
|
||||
function SFrames.Pet:ShowContextMenu()
|
||||
if not self.contextMenu then
|
||||
self.contextMenu = CreateFrame("Frame", "SFramesPetContextDD", UIParent, "UIDropDownMenuTemplate")
|
||||
end
|
||||
UIDropDownMenu_Initialize(self.contextMenu, function()
|
||||
local info
|
||||
|
||||
info = {}
|
||||
info.text = "查看属性"
|
||||
info.notCheckable = 1
|
||||
info.func = function()
|
||||
ToggleCharacter("PetPaperDollFrame")
|
||||
end
|
||||
UIDropDownMenu_AddButton(info)
|
||||
|
||||
local hasPetUI, isHunterPet = HasPetUI()
|
||||
if isHunterPet then
|
||||
info = {}
|
||||
info.text = "重命名"
|
||||
info.notCheckable = 1
|
||||
info.func = function() SFrames.Pet:ShowRenameDialog() end
|
||||
UIDropDownMenu_AddButton(info)
|
||||
|
||||
info = {}
|
||||
info.text = "解散宠物"
|
||||
info.notCheckable = 1
|
||||
info.func = function() if PetDismiss then PetDismiss() end end
|
||||
UIDropDownMenu_AddButton(info)
|
||||
|
||||
info = {}
|
||||
info.text = "放弃宠物"
|
||||
info.notCheckable = 1
|
||||
info.textR = 1; info.textG = 0.3; info.textB = 0.3
|
||||
info.func = function() if PetAbandon then PetAbandon() end end
|
||||
UIDropDownMenu_AddButton(info)
|
||||
else
|
||||
info = {}
|
||||
info.text = "解散宠物"
|
||||
info.notCheckable = 1
|
||||
info.func = function() if PetDismiss then PetDismiss() end end
|
||||
UIDropDownMenu_AddButton(info)
|
||||
end
|
||||
|
||||
info = {}
|
||||
info.text = CANCEL or "取消"
|
||||
info.notCheckable = 1
|
||||
info.func = function() CloseDropDownMenus() end
|
||||
UIDropDownMenu_AddButton(info)
|
||||
end, "MENU")
|
||||
ToggleDropDownMenu(1, nil, self.contextMenu, "SFramesPetFrame", 106, 27)
|
||||
end
|
||||
|
||||
function SFrames.Pet:CreateRenameFrame()
|
||||
local T = SFrames.ActiveTheme
|
||||
local font = SFrames:GetFont()
|
||||
local outline = (SFrames.Media and SFrames.Media.fontOutline) or "OUTLINE"
|
||||
|
||||
local f = CreateFrame("Frame", "SFramesPetRenameDialog", UIParent)
|
||||
f:SetWidth(300)
|
||||
f:SetHeight(120)
|
||||
f:SetPoint("CENTER", UIParent, "CENTER", 0, 80)
|
||||
f:SetFrameStrata("DIALOG")
|
||||
f:SetToplevel(true)
|
||||
f:EnableMouse(true)
|
||||
f:SetMovable(true)
|
||||
f:RegisterForDrag("LeftButton")
|
||||
f:SetScript("OnDragStart", function() this:StartMoving() end)
|
||||
f:SetScript("OnDragStop", function() this:StopMovingOrSizing() end)
|
||||
|
||||
f:SetBackdrop({
|
||||
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
||||
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
|
||||
tile = true, tileSize = 16, edgeSize = 14,
|
||||
insets = { left = 3, right = 3, top = 3, bottom = 3 },
|
||||
})
|
||||
f:SetBackdropColor(T.panelBg[1], T.panelBg[2], T.panelBg[3], T.panelBg[4])
|
||||
f:SetBackdropBorderColor(T.panelBorder[1], T.panelBorder[2], T.panelBorder[3], T.panelBorder[4])
|
||||
|
||||
local shadow = CreateFrame("Frame", nil, f)
|
||||
shadow:SetPoint("TOPLEFT", f, "TOPLEFT", -4, 4)
|
||||
shadow:SetPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT", 4, -4)
|
||||
shadow:SetBackdrop({
|
||||
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
||||
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
|
||||
tile = true, tileSize = 16, edgeSize = 16,
|
||||
insets = { left = 4, right = 4, top = 4, bottom = 4 },
|
||||
})
|
||||
shadow:SetBackdropColor(0, 0, 0, 0.45)
|
||||
shadow:SetBackdropBorderColor(0, 0, 0, 0.6)
|
||||
shadow:SetFrameLevel(math.max(0, f:GetFrameLevel() - 1))
|
||||
|
||||
local header = CreateFrame("Frame", nil, f)
|
||||
header:SetPoint("TOPLEFT", f, "TOPLEFT", 3, -3)
|
||||
header:SetPoint("TOPRIGHT", f, "TOPRIGHT", -3, -3)
|
||||
header:SetHeight(26)
|
||||
header:SetBackdrop({ bgFile = "Interface\\Buttons\\WHITE8X8" })
|
||||
header:SetBackdropColor(T.headerBg[1], T.headerBg[2], T.headerBg[3], T.headerBg[4])
|
||||
|
||||
local titleFS = header:CreateFontString(nil, "OVERLAY")
|
||||
titleFS:SetFont(font, 12, outline)
|
||||
titleFS:SetPoint("CENTER", header, "CENTER", 0, 0)
|
||||
titleFS:SetText("宠物重命名")
|
||||
titleFS:SetTextColor(T.gold[1], T.gold[2], T.gold[3])
|
||||
|
||||
local hsep = f:CreateTexture(nil, "ARTWORK")
|
||||
hsep:SetTexture("Interface\\Buttons\\WHITE8X8")
|
||||
hsep:SetHeight(1)
|
||||
hsep:SetPoint("TOPLEFT", f, "TOPLEFT", 4, -29)
|
||||
hsep:SetPoint("TOPRIGHT", f, "TOPRIGHT", -4, -29)
|
||||
hsep:SetVertexColor(T.divider[1], T.divider[2], T.divider[3], T.divider[4])
|
||||
|
||||
local eb = CreateFrame("EditBox", "SFramesPetRenameEditBox", f)
|
||||
eb:SetWidth(260)
|
||||
eb:SetHeight(24)
|
||||
eb:SetPoint("TOP", f, "TOP", 0, -42)
|
||||
eb:SetFont(font, 12, outline)
|
||||
eb:SetAutoFocus(false)
|
||||
eb:SetMaxLetters(24)
|
||||
eb:SetBackdrop({
|
||||
bgFile = "Interface\\Buttons\\WHITE8X8",
|
||||
edgeFile = "Interface\\Buttons\\WHITE8X8",
|
||||
tile = false, tileSize = 0, edgeSize = 1,
|
||||
insets = { left = 1, right = 1, top = 1, bottom = 1 },
|
||||
})
|
||||
eb:SetBackdropColor(T.inputBg[1], T.inputBg[2], T.inputBg[3], T.inputBg[4])
|
||||
eb:SetBackdropBorderColor(T.inputBorder[1], T.inputBorder[2], T.inputBorder[3], T.inputBorder[4])
|
||||
eb:SetTextInsets(8, 8, 0, 0)
|
||||
eb:SetTextColor(1, 1, 1)
|
||||
|
||||
eb:SetScript("OnEnterPressed", function()
|
||||
SFrames.Pet:DoRename(this:GetText())
|
||||
end)
|
||||
eb:SetScript("OnEscapePressed", function()
|
||||
SFrames.Pet.renameFrame:Hide()
|
||||
end)
|
||||
eb:SetScript("OnEditFocusGained", function()
|
||||
this:SetBackdropBorderColor(T.accent[1], T.accent[2], T.accent[3], 1)
|
||||
end)
|
||||
eb:SetScript("OnEditFocusLost", function()
|
||||
this:SetBackdropBorderColor(T.inputBorder[1], T.inputBorder[2], T.inputBorder[3], T.inputBorder[4])
|
||||
end)
|
||||
|
||||
f.editBox = eb
|
||||
|
||||
local function CreateBtn(text, parent)
|
||||
local btn = CreateFrame("Button", nil, parent)
|
||||
btn:SetWidth(120)
|
||||
btn:SetHeight(26)
|
||||
btn:SetBackdrop({
|
||||
bgFile = "Interface\\Buttons\\WHITE8X8",
|
||||
edgeFile = "Interface\\Buttons\\WHITE8X8",
|
||||
tile = false, tileSize = 0, edgeSize = 1,
|
||||
insets = { left = 1, right = 1, top = 1, bottom = 1 },
|
||||
})
|
||||
btn:SetBackdropColor(T.btnBg[1], T.btnBg[2], T.btnBg[3], T.btnBg[4])
|
||||
btn:SetBackdropBorderColor(T.btnBorder[1], T.btnBorder[2], T.btnBorder[3], T.btnBorder[4])
|
||||
local fs = btn:CreateFontString(nil, "OVERLAY")
|
||||
fs:SetFont(font, 11, outline)
|
||||
fs:SetPoint("CENTER", 0, 0)
|
||||
fs:SetText(text)
|
||||
fs:SetTextColor(T.btnText[1], T.btnText[2], T.btnText[3])
|
||||
btn.label = fs
|
||||
btn:SetScript("OnEnter", function()
|
||||
this:SetBackdropColor(T.btnHoverBg[1], T.btnHoverBg[2], T.btnHoverBg[3], T.btnHoverBg[4])
|
||||
this:SetBackdropBorderColor(T.btnHoverBd[1], T.btnHoverBd[2], T.btnHoverBd[3], T.btnHoverBd[4])
|
||||
this.label:SetTextColor(T.btnActiveText[1], T.btnActiveText[2], T.btnActiveText[3])
|
||||
end)
|
||||
btn:SetScript("OnLeave", function()
|
||||
this:SetBackdropColor(T.btnBg[1], T.btnBg[2], T.btnBg[3], T.btnBg[4])
|
||||
this:SetBackdropBorderColor(T.btnBorder[1], T.btnBorder[2], T.btnBorder[3], T.btnBorder[4])
|
||||
this.label:SetTextColor(T.btnText[1], T.btnText[2], T.btnText[3])
|
||||
end)
|
||||
return btn
|
||||
end
|
||||
|
||||
local confirmBtn = CreateBtn("确定", f)
|
||||
confirmBtn:SetPoint("BOTTOMRIGHT", f, "BOTTOM", -4, 10)
|
||||
confirmBtn:SetScript("OnClick", function()
|
||||
SFrames.Pet:DoRename(f.editBox:GetText())
|
||||
end)
|
||||
|
||||
local cancelBtn = CreateBtn("取消", f)
|
||||
cancelBtn:SetPoint("BOTTOMLEFT", f, "BOTTOM", 4, 10)
|
||||
cancelBtn:SetScript("OnClick", function()
|
||||
f:Hide()
|
||||
end)
|
||||
|
||||
f:Hide()
|
||||
table.insert(UISpecialFrames, "SFramesPetRenameDialog")
|
||||
self.renameFrame = f
|
||||
end
|
||||
|
||||
function SFrames.Pet:ShowRenameDialog()
|
||||
if not UnitExists("pet") then return end
|
||||
if not self.renameFrame then
|
||||
self:CreateRenameFrame()
|
||||
end
|
||||
local currentName = UnitName("pet") or ""
|
||||
self.renameFrame.editBox:SetText(currentName)
|
||||
self.renameFrame:Show()
|
||||
self.renameFrame.editBox:SetFocus()
|
||||
self.renameFrame.editBox:HighlightText()
|
||||
end
|
||||
|
||||
function SFrames.Pet:DoRename(name)
|
||||
if not name or name == "" then return end
|
||||
if PetRename then
|
||||
PetRename(name)
|
||||
end
|
||||
if self.renameFrame then
|
||||
self.renameFrame:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
function SFrames.Pet:Initialize()
|
||||
local f = CreateFrame("Button", "SFramesPetFrame", UIParent)
|
||||
f:SetWidth(150)
|
||||
@@ -45,7 +259,7 @@ function SFrames.Pet:Initialize()
|
||||
TargetUnit("pet")
|
||||
end
|
||||
else
|
||||
ToggleDropDownMenu(1, nil, PetFrameDropDown, "SFramesPetFrame", 106, 27)
|
||||
SFrames.Pet:ShowContextMenu()
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -158,6 +372,22 @@ function SFrames.Pet:Initialize()
|
||||
|
||||
self:InitFoodFeature()
|
||||
self:UpdateAll()
|
||||
|
||||
if SFrames.Movers and SFrames.Movers.RegisterMover and self.frame then
|
||||
SFrames.Movers:RegisterMover("PetFrame", self.frame, "宠物",
|
||||
"TOPLEFT", "SFramesPlayerFrame", "BOTTOMLEFT", 10, -55)
|
||||
end
|
||||
|
||||
if StaticPopup_Show then
|
||||
local origStaticPopupShow = StaticPopup_Show
|
||||
StaticPopup_Show = function(which, a1, a2, a3)
|
||||
if which == "RENAME_PET" then
|
||||
SFrames.Pet:ShowRenameDialog()
|
||||
return
|
||||
end
|
||||
return origStaticPopupShow(which, a1, a2, a3)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function SFrames.Pet:UpdateAll()
|
||||
|
||||
101
Units/Player.lua
101
Units/Player.lua
@@ -105,27 +105,52 @@ function SFrames.Player:ApplyConfig()
|
||||
|
||||
local cfg = self:GetConfig()
|
||||
local f = self.frame
|
||||
local db = SFramesDB or {}
|
||||
|
||||
local showPortrait = db.playerShowPortrait ~= false
|
||||
local frameAlpha = tonumber(db.playerFrameAlpha) or 1
|
||||
frameAlpha = Clamp(frameAlpha, 0.1, 1.0)
|
||||
|
||||
f:SetScale(cfg.scale)
|
||||
f:SetWidth(cfg.width)
|
||||
f:SetHeight(cfg.height)
|
||||
f:SetAlpha(frameAlpha)
|
||||
|
||||
if f.portrait then
|
||||
f.portrait:SetWidth(cfg.portraitWidth)
|
||||
f.portrait:SetHeight(cfg.height - 2)
|
||||
end
|
||||
|
||||
if f.portraitBG then
|
||||
f.portraitBG:ClearAllPoints()
|
||||
f.portraitBG:SetPoint("TOPLEFT", f, "TOPLEFT", 0, 0)
|
||||
f.portraitBG:SetPoint("BOTTOMRIGHT", f.portrait, "BOTTOMRIGHT", 1, -1)
|
||||
end
|
||||
|
||||
if f.health then
|
||||
f.health:ClearAllPoints()
|
||||
f.health:SetPoint("TOPLEFT", f.portrait, "TOPRIGHT", 1, 0)
|
||||
f.health:SetPoint("TOPRIGHT", f, "TOPRIGHT", -1, -1)
|
||||
f.health:SetHeight(cfg.healthHeight)
|
||||
if showPortrait then
|
||||
if f.portrait then
|
||||
f.portrait:SetWidth(cfg.portraitWidth)
|
||||
f.portrait:SetHeight(cfg.height - 2)
|
||||
f.portrait:Show()
|
||||
end
|
||||
if f.portraitBG then
|
||||
f.portraitBG:ClearAllPoints()
|
||||
f.portraitBG:SetPoint("TOPLEFT", f, "TOPLEFT", 0, 0)
|
||||
f.portraitBG:SetPoint("BOTTOMRIGHT", f.portrait, "BOTTOMRIGHT", 1, -1)
|
||||
f.portraitBG:Show()
|
||||
end
|
||||
if f.health then
|
||||
f.health:ClearAllPoints()
|
||||
f.health:SetPoint("TOPLEFT", f.portrait, "TOPRIGHT", 1, 0)
|
||||
f.health:SetPoint("TOPRIGHT", f, "TOPRIGHT", -1, -1)
|
||||
f.health:SetHeight(cfg.healthHeight)
|
||||
end
|
||||
if f.classIcon and f.classIcon.overlay then
|
||||
f.classIcon.overlay:ClearAllPoints()
|
||||
f.classIcon.overlay:SetPoint("CENTER", f.portrait, "TOPRIGHT", 0, 0)
|
||||
end
|
||||
else
|
||||
if f.portrait then f.portrait:Hide() end
|
||||
if f.portraitBG then f.portraitBG:Hide() end
|
||||
if f.health then
|
||||
f.health:ClearAllPoints()
|
||||
f.health:SetPoint("TOPLEFT", f, "TOPLEFT", 1, -1)
|
||||
f.health:SetPoint("TOPRIGHT", f, "TOPRIGHT", -1, -1)
|
||||
f.health:SetHeight(cfg.healthHeight)
|
||||
end
|
||||
if f.classIcon and f.classIcon.overlay then
|
||||
f.classIcon.overlay:ClearAllPoints()
|
||||
f.classIcon.overlay:SetPoint("CENTER", f, "TOPLEFT", 8, 0)
|
||||
end
|
||||
end
|
||||
|
||||
if f.healthBGFrame then
|
||||
@@ -147,6 +172,21 @@ function SFrames.Player:ApplyConfig()
|
||||
f.powerBGFrame:SetPoint("BOTTOMRIGHT", f.power, "BOTTOMRIGHT", 1, -1)
|
||||
end
|
||||
|
||||
if f.restOverlay then
|
||||
if showPortrait then f.restOverlay:SetAlpha(1) else f.restOverlay:SetAlpha(0) end
|
||||
end
|
||||
|
||||
if f.castbar then
|
||||
f.castbar:ClearAllPoints()
|
||||
if showPortrait then
|
||||
f.castbar:SetPoint("BOTTOMRIGHT", f, "TOPRIGHT", 0, 6)
|
||||
f.castbar:SetPoint("BOTTOMLEFT", f.portrait, "TOPLEFT", SFrames.Config.castbarHeight + 6, 6)
|
||||
else
|
||||
f.castbar:SetPoint("BOTTOMRIGHT", f, "TOPRIGHT", 0, 6)
|
||||
f.castbar:SetPoint("BOTTOMLEFT", f, "TOPLEFT", SFrames.Config.castbarHeight + 6, 6)
|
||||
end
|
||||
end
|
||||
|
||||
local outline = (SFrames and SFrames.Media and SFrames.Media.fontOutline) or "OUTLINE"
|
||||
local fontPath = SFrames:GetFont()
|
||||
|
||||
@@ -471,7 +511,13 @@ function SFrames.Player:Initialize()
|
||||
SFrames:RegisterEvent("PARTY_MEMBERS_CHANGED", function() self:UpdateLeaderIcon() end)
|
||||
SFrames:RegisterEvent("PARTY_LEADER_CHANGED", function() self:UpdateLeaderIcon() end)
|
||||
SFrames:RegisterEvent("RAID_TARGET_UPDATE", function() self:UpdateRaidIcon() end)
|
||||
SFrames:RegisterEvent("UNIT_PORTRAIT_UPDATE", function() if arg1 == "player" then self.frame.portrait:SetUnit("player") self.frame.portrait:SetCamera(0) self.frame.portrait:SetPosition(-1.0, 0, 0) end end)
|
||||
SFrames:RegisterEvent("UNIT_PORTRAIT_UPDATE", function()
|
||||
if arg1 == "player" and self.frame.portrait and not (SFramesDB and SFramesDB.playerShowPortrait == false) then
|
||||
self.frame.portrait:SetUnit("player")
|
||||
self.frame.portrait:SetCamera(0)
|
||||
self.frame.portrait:SetPosition(-1.0, 0, 0)
|
||||
end
|
||||
end)
|
||||
SFrames:RegisterEvent("UNIT_DISPLAYPOWER", function() if arg1 == "player" then self:UpdatePowerType(); self:UpdatePower() end end)
|
||||
SFrames:RegisterEvent("UPDATE_SHAPESHIFT_FORM", function() self:UpdatePowerType(); self:UpdatePower() end)
|
||||
SFrames:RegisterEvent("PLAYER_UPDATE_RESTING", function() self:UpdateRestingStatus() end)
|
||||
@@ -587,6 +633,12 @@ function SFrames.Player:ScanTrainer()
|
||||
return
|
||||
end
|
||||
|
||||
if SetTrainerServiceTypeFilter then
|
||||
SetTrainerServiceTypeFilter("available", 1)
|
||||
SetTrainerServiceTypeFilter("unavailable", 1)
|
||||
SetTrainerServiceTypeFilter("used", 1)
|
||||
end
|
||||
|
||||
local _, classEn = UnitClass("player")
|
||||
if not classEn or not SFramesDB then self.scanningTrainer = nil return end
|
||||
|
||||
@@ -966,9 +1018,12 @@ function SFrames.Player:UpdateAll()
|
||||
formattedLevel = formattedLevel .. " "
|
||||
end
|
||||
|
||||
self.frame.portrait:SetUnit("player")
|
||||
self.frame.portrait:SetCamera(0)
|
||||
self.frame.portrait:SetPosition(-1.0, 0, 0)
|
||||
local showPortrait = not (SFramesDB and SFramesDB.playerShowPortrait == false)
|
||||
if showPortrait and self.frame.portrait then
|
||||
self.frame.portrait:SetUnit("player")
|
||||
self.frame.portrait:SetCamera(0)
|
||||
self.frame.portrait:SetPosition(-1.0, 0, 0)
|
||||
end
|
||||
|
||||
-- Class Color for Health
|
||||
local localizedClass, class = UnitClass("player")
|
||||
@@ -1477,6 +1532,12 @@ function SFrames.Player:Initialize()
|
||||
CastingBarFrame:UnregisterAllEvents()
|
||||
CastingBarFrame:Hide()
|
||||
end
|
||||
|
||||
-- Register mover
|
||||
if SFrames.Movers and SFrames.Movers.RegisterMover and self.frame then
|
||||
SFrames.Movers:RegisterMover("PlayerFrame", self.frame, "玩家",
|
||||
"CENTER", "UIParent", "CENTER", -200, -100)
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@@ -259,6 +259,11 @@ function SFrames.Raid:Initialize()
|
||||
SFrames:RegisterEvent("RAID_TARGET_UPDATE", function() self:UpdateRaidIcons() end)
|
||||
|
||||
self:UpdateAll()
|
||||
|
||||
if SFrames.Movers and SFrames.Movers.RegisterMover and self.parent then
|
||||
SFrames.Movers:RegisterMover("RaidFrame", self.parent, "团队",
|
||||
"TOPLEFT", "UIParent", "TOPLEFT", 15, -200)
|
||||
end
|
||||
end
|
||||
|
||||
function SFrames.Raid:EnsureFrames()
|
||||
@@ -1003,6 +1008,7 @@ function SFrames.Raid:UpdateAuras(unit)
|
||||
SFrames.Tooltip:SetOwner(UIParent, "ANCHOR_NONE")
|
||||
SFrames.Tooltip:SetUnitBuff(unit, i)
|
||||
local buffName = SFramesScanTooltipTextLeft1:GetText()
|
||||
SFrames.Tooltip:Hide()
|
||||
|
||||
if buffName then
|
||||
for pos, listData in pairs(buffsNeeded) do
|
||||
@@ -1039,6 +1045,7 @@ function SFrames.Raid:UpdateAuras(unit)
|
||||
SFrames.Tooltip:SetOwner(UIParent, "ANCHOR_NONE")
|
||||
SFrames.Tooltip:SetUnitDebuff(unit, i)
|
||||
local debuffName = SFramesScanTooltipTextLeft1:GetText()
|
||||
SFrames.Tooltip:Hide()
|
||||
|
||||
if debuffName then
|
||||
for pos, listData in pairs(buffsNeeded) do
|
||||
|
||||
1306
Units/TalentTree.lua
1306
Units/TalentTree.lua
File diff suppressed because it is too large
Load Diff
162
Units/Target.lua
162
Units/Target.lua
@@ -11,6 +11,10 @@ local function Clamp(value, minValue, maxValue)
|
||||
return value
|
||||
end
|
||||
|
||||
local DIST_BASE_WIDTH = 80
|
||||
local DIST_BASE_HEIGHT = 24
|
||||
local DIST_BASE_FONTSIZE = 14
|
||||
|
||||
function SFrames.Target:GetDistance(unit)
|
||||
if not UnitExists(unit) then return nil end
|
||||
if UnitIsUnit(unit, "player") then return "0 码" end
|
||||
@@ -69,27 +73,60 @@ function SFrames.Target:ApplyConfig()
|
||||
|
||||
local cfg = self:GetConfig()
|
||||
local f = self.frame
|
||||
local db = SFramesDB or {}
|
||||
|
||||
local showPortrait = db.targetShowPortrait ~= false
|
||||
local frameAlpha = tonumber(db.targetFrameAlpha) or 1
|
||||
frameAlpha = Clamp(frameAlpha, 0.1, 1.0)
|
||||
|
||||
f:SetScale(cfg.scale)
|
||||
f:SetWidth(cfg.width)
|
||||
f:SetHeight(cfg.height)
|
||||
f:SetAlpha(frameAlpha)
|
||||
|
||||
if f.portrait then
|
||||
f.portrait:SetWidth(cfg.portraitWidth)
|
||||
f.portrait:SetHeight(cfg.height - 2)
|
||||
end
|
||||
|
||||
if f.portraitBG then
|
||||
f.portraitBG:ClearAllPoints()
|
||||
f.portraitBG:SetPoint("TOPLEFT", f.portrait, "TOPLEFT", -1, 0)
|
||||
f.portraitBG:SetPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT", 0, 0)
|
||||
end
|
||||
|
||||
if f.health then
|
||||
f.health:ClearAllPoints()
|
||||
f.health:SetPoint("TOPLEFT", f, "TOPLEFT", 1, -1)
|
||||
f.health:SetPoint("TOPRIGHT", f.portrait, "TOPLEFT", -1, 0)
|
||||
f.health:SetHeight(cfg.healthHeight)
|
||||
if showPortrait then
|
||||
if f.portrait then
|
||||
f.portrait:SetWidth(cfg.portraitWidth)
|
||||
f.portrait:SetHeight(cfg.height - 2)
|
||||
f.portrait:Show()
|
||||
end
|
||||
if f.portraitBG then
|
||||
f.portraitBG:ClearAllPoints()
|
||||
f.portraitBG:SetPoint("TOPLEFT", f.portrait, "TOPLEFT", -1, 0)
|
||||
f.portraitBG:SetPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT", 0, 0)
|
||||
f.portraitBG:Show()
|
||||
end
|
||||
if f.health then
|
||||
f.health:ClearAllPoints()
|
||||
f.health:SetPoint("TOPLEFT", f, "TOPLEFT", 1, -1)
|
||||
f.health:SetPoint("TOPRIGHT", f.portrait, "TOPLEFT", -1, 0)
|
||||
f.health:SetHeight(cfg.healthHeight)
|
||||
end
|
||||
if f.classIcon and f.classIcon.overlay then
|
||||
f.classIcon.overlay:ClearAllPoints()
|
||||
f.classIcon.overlay:SetPoint("CENTER", f.portrait, "TOPRIGHT", 0, 0)
|
||||
end
|
||||
if f.comboText then
|
||||
f.comboText:ClearAllPoints()
|
||||
f.comboText:SetPoint("CENTER", f.portrait, "CENTER", 0, 0)
|
||||
end
|
||||
else
|
||||
if f.portrait then f.portrait:Hide() end
|
||||
if f.portraitBG then f.portraitBG:Hide() end
|
||||
if f.health then
|
||||
f.health:ClearAllPoints()
|
||||
f.health:SetPoint("TOPLEFT", f, "TOPLEFT", 1, -1)
|
||||
f.health:SetPoint("TOPRIGHT", f, "TOPRIGHT", -1, -1)
|
||||
f.health:SetHeight(cfg.healthHeight)
|
||||
end
|
||||
if f.classIcon and f.classIcon.overlay then
|
||||
f.classIcon.overlay:ClearAllPoints()
|
||||
f.classIcon.overlay:SetPoint("CENTER", f, "TOPRIGHT", -8, 0)
|
||||
end
|
||||
if f.comboText then
|
||||
f.comboText:ClearAllPoints()
|
||||
f.comboText:SetPoint("RIGHT", f.health, "RIGHT", -4, 0)
|
||||
end
|
||||
end
|
||||
|
||||
if f.healthBGFrame then
|
||||
@@ -124,9 +161,20 @@ function SFrames.Target:ApplyConfig()
|
||||
f.powerText:SetFont(fontPath, cfg.valueFont, outline)
|
||||
end
|
||||
|
||||
if f.castbar then
|
||||
f.castbar:ClearAllPoints()
|
||||
if showPortrait then
|
||||
f.castbar:SetPoint("BOTTOMLEFT", f, "TOPLEFT", 0, 6)
|
||||
f.castbar:SetPoint("BOTTOMRIGHT", f.portrait, "TOPRIGHT", -(SFrames.Config.castbarHeight + 6), 6)
|
||||
else
|
||||
f.castbar:SetPoint("BOTTOMLEFT", f, "TOPLEFT", 0, 6)
|
||||
f.castbar:SetPoint("BOTTOMRIGHT", f, "TOPRIGHT", -(SFrames.Config.castbarHeight + 6), 6)
|
||||
end
|
||||
end
|
||||
|
||||
if self.distanceFrame then
|
||||
local dScale = tonumber(SFramesDB and SFramesDB.targetDistanceScale) or 1
|
||||
self.distanceFrame:SetScale(Clamp(dScale, 0.7, 1.8))
|
||||
self:ApplyDistanceScale(dScale)
|
||||
end
|
||||
|
||||
if UnitExists("target") then
|
||||
@@ -134,22 +182,36 @@ function SFrames.Target:ApplyConfig()
|
||||
end
|
||||
end
|
||||
|
||||
function SFrames.Target:ApplyDistanceScale(scale)
|
||||
local f = self.distanceFrame
|
||||
if not f then return end
|
||||
scale = Clamp(tonumber(scale) or 1, 0.7, 1.8)
|
||||
f:SetWidth(DIST_BASE_WIDTH * scale)
|
||||
f:SetHeight(DIST_BASE_HEIGHT * scale)
|
||||
if f.text then
|
||||
local fontPath = SFrames:GetFont()
|
||||
local outline = (SFrames.Media and SFrames.Media.fontOutline) or "OUTLINE"
|
||||
local fontSize = math.max(8, math.floor(DIST_BASE_FONTSIZE * scale + 0.5))
|
||||
f.text:SetFont(fontPath, fontSize, outline)
|
||||
end
|
||||
end
|
||||
|
||||
function SFrames.Target:InitializeDistanceFrame()
|
||||
local f = CreateFrame("Button", "SFramesTargetDistanceFrame", UIParent)
|
||||
f:SetWidth(80)
|
||||
f:SetHeight(24)
|
||||
f:SetFrameStrata("HIGH")
|
||||
local frameScale = (SFramesDB and type(SFramesDB.targetDistanceScale) == "number") and SFramesDB.targetDistanceScale or 1
|
||||
f:SetScale(frameScale)
|
||||
|
||||
|
||||
local dScale = (SFramesDB and type(SFramesDB.targetDistanceScale) == "number") and SFramesDB.targetDistanceScale or 1
|
||||
dScale = Clamp(dScale, 0.7, 1.8)
|
||||
f:SetWidth(DIST_BASE_WIDTH * dScale)
|
||||
f:SetHeight(DIST_BASE_HEIGHT * dScale)
|
||||
|
||||
if SFramesDB and SFramesDB.Positions and SFramesDB.Positions["TargetDistanceFrame"] then
|
||||
local pos = SFramesDB.Positions["TargetDistanceFrame"]
|
||||
f:SetPoint(pos.point, UIParent, pos.relativePoint, pos.xOfs, pos.yOfs)
|
||||
else
|
||||
-- Default position: Center of screen for visibility if first time
|
||||
f:SetPoint("CENTER", UIParent, "CENTER", 0, 100)
|
||||
end
|
||||
|
||||
|
||||
f:SetMovable(true)
|
||||
f:EnableMouse(true)
|
||||
f:RegisterForDrag("LeftButton")
|
||||
@@ -161,29 +223,29 @@ function SFrames.Target:InitializeDistanceFrame()
|
||||
local point, relativeTo, relativePoint, xOfs, yOfs = this:GetPoint()
|
||||
SFramesDB.Positions["TargetDistanceFrame"] = { point = point, relativePoint = relativePoint, xOfs = xOfs, yOfs = yOfs }
|
||||
end)
|
||||
|
||||
|
||||
SFrames:CreateUnitBackdrop(f)
|
||||
f:SetBackdrop(nil) -- Remove border and background for natural look
|
||||
|
||||
f.text = SFrames:CreateFontString(f, 14, "CENTER")
|
||||
f:SetBackdrop(nil)
|
||||
|
||||
local fontSize = math.max(8, math.floor(DIST_BASE_FONTSIZE * dScale + 0.5))
|
||||
f.text = SFrames:CreateFontString(f, fontSize, "CENTER")
|
||||
f.text:SetPoint("CENTER", f, "CENTER", 0, 0)
|
||||
f.text:SetTextColor(1, 0.8, 0.2)
|
||||
f.text:SetShadowColor(0, 0, 0, 1)
|
||||
f.text:SetShadowOffset(1, -1)
|
||||
|
||||
|
||||
SFrames.Target.distanceFrame = f
|
||||
f:Hide()
|
||||
|
||||
-- Distance Updater on the frame itself
|
||||
|
||||
f.timer = 0
|
||||
f:SetScript("OnUpdate", function()
|
||||
if SFramesDB and SFramesDB.targetDistanceEnabled == false then
|
||||
if this:IsShown() then this:Hide() end
|
||||
return
|
||||
end
|
||||
if not UnitExists("target") then
|
||||
if not UnitExists("target") then
|
||||
if this:IsShown() then this:Hide() end
|
||||
return
|
||||
return
|
||||
end
|
||||
this.timer = this.timer + (arg1 or 0)
|
||||
if this.timer >= 0.4 then
|
||||
@@ -391,7 +453,13 @@ function SFrames.Target:Initialize()
|
||||
SFrames:RegisterEvent("UNIT_MAXRAGE", function() if arg1 == "target" then self:UpdatePower() end end)
|
||||
SFrames:RegisterEvent("PLAYER_COMBO_POINTS", function() self:UpdateComboPoints() end)
|
||||
SFrames:RegisterEvent("UNIT_DISPLAYPOWER", function() if arg1 == "target" then self:UpdatePowerType() end end)
|
||||
SFrames:RegisterEvent("UNIT_PORTRAIT_UPDATE", function() if arg1 == "target" then self.frame.portrait:SetUnit("target") self.frame.portrait:SetCamera(0) self.frame.portrait:SetPosition(-1.0, 0, 0) end end)
|
||||
SFrames:RegisterEvent("UNIT_PORTRAIT_UPDATE", function()
|
||||
if arg1 == "target" and self.frame.portrait and not (SFramesDB and SFramesDB.targetShowPortrait == false) then
|
||||
self.frame.portrait:SetUnit("target")
|
||||
self.frame.portrait:SetCamera(0)
|
||||
self.frame.portrait:SetPosition(-1.0, 0, 0)
|
||||
end
|
||||
end)
|
||||
SFrames:RegisterEvent("UNIT_DYNAMIC_FLAGS", function() if arg1 == "target" then self:UpdateAll() end end)
|
||||
SFrames:RegisterEvent("UNIT_FACTION", function() if arg1 == "target" then self:UpdateAll() end end)
|
||||
SFrames:RegisterEvent("RAID_TARGET_UPDATE", function() self:UpdateRaidIcon() end)
|
||||
@@ -413,7 +481,15 @@ function SFrames.Target:Initialize()
|
||||
-- If target already exists on load (e.g. after /reload), show and update it immediately
|
||||
self:OnTargetChanged()
|
||||
|
||||
-- Distance Updater removed from target frame
|
||||
-- Register movers
|
||||
if SFrames.Movers and SFrames.Movers.RegisterMover then
|
||||
SFrames.Movers:RegisterMover("TargetFrame", f, "目标",
|
||||
"CENTER", "UIParent", "CENTER", 200, -100)
|
||||
if SFrames.Target.distanceFrame then
|
||||
SFrames.Movers:RegisterMover("TargetDistanceFrame", SFrames.Target.distanceFrame, "目标距离",
|
||||
"CENTER", "UIParent", "CENTER", 0, 100)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function SFrames.Target:OnTargetChanged()
|
||||
@@ -444,11 +520,14 @@ function SFrames.Target:UpdateAll()
|
||||
self:UpdateRaidIcon()
|
||||
self:UpdateAuras()
|
||||
|
||||
self.frame.portrait:SetUnit("target")
|
||||
self.frame.portrait:SetCamera(0)
|
||||
self.frame.portrait:Hide()
|
||||
self.frame.portrait:Show()
|
||||
self.frame.portrait:SetPosition(-1.0, 0, 0)
|
||||
local showPortrait = not (SFramesDB and SFramesDB.targetShowPortrait == false)
|
||||
if showPortrait and self.frame.portrait then
|
||||
self.frame.portrait:SetUnit("target")
|
||||
self.frame.portrait:SetCamera(0)
|
||||
self.frame.portrait:Hide()
|
||||
self.frame.portrait:Show()
|
||||
self.frame.portrait:SetPosition(-1.0, 0, 0)
|
||||
end
|
||||
|
||||
local name = UnitName("target") or ""
|
||||
local level = UnitLevel("target")
|
||||
@@ -901,11 +980,11 @@ function SFrames.Target:UpdateAuras()
|
||||
if texture then
|
||||
b.icon:SetTexture(texture)
|
||||
|
||||
-- Scrape tooltip for duration
|
||||
SFrames.Tooltip:SetOwner(UIParent, "ANCHOR_NONE")
|
||||
SFrames.Tooltip:ClearLines()
|
||||
SFrames.Tooltip:SetUnitBuff("target", i)
|
||||
local timeLeft = SFrames:GetAuraTimeLeft("target", i, true)
|
||||
SFrames.Tooltip:Hide()
|
||||
if timeLeft and timeLeft > 0 then
|
||||
b.expirationTime = GetTime() + timeLeft
|
||||
b.cdText:SetText(SFrames:FormatTime(timeLeft))
|
||||
@@ -974,6 +1053,7 @@ function SFrames.Target:UpdateAuras()
|
||||
SFrames.Tooltip:ClearLines()
|
||||
SFrames.Tooltip:SetUnitDebuff("target", i)
|
||||
timeLeft = SFrames:GetAuraTimeLeft("target", i, false)
|
||||
SFrames.Tooltip:Hide()
|
||||
end
|
||||
|
||||
if timeLeft and timeLeft > 0 then
|
||||
|
||||
Reference in New Issue
Block a user