聊天重做前缓存

This commit is contained in:
rucky
2026-04-09 09:46:47 +08:00
parent 6e18269bfd
commit e915bbd74a
39 changed files with 8501 additions and 2308 deletions

View File

@@ -962,12 +962,7 @@ function TSUI.CreateReagentSlot(parent, i)
GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
local ok
if S.currentMode == "craft" then
local link = GetCraftItemLink and GetCraftItemLink(S.selectedIndex)
if link then
ok = pcall(GameTooltip.SetCraftItem, GameTooltip, S.selectedIndex, this.reagentIndex)
else
ok = pcall(GameTooltip.SetCraftSpell, GameTooltip, S.selectedIndex)
end
ok = pcall(GameTooltip.SetCraftItem, GameTooltip, S.selectedIndex, this.reagentIndex)
else
ok = pcall(GameTooltip.SetTradeSkillItem, GameTooltip, S.selectedIndex, this.reagentIndex)
end
@@ -1521,6 +1516,7 @@ end
function TSUI.UpdateProfTabs()
TSUI.ScanProfessions()
local currentSkillName = API.GetSkillLineName()
local numVisible = 0
for i = 1, 10 do
local tab = S.profTabs[i]
if not tab then break end
@@ -1544,10 +1540,16 @@ function TSUI.UpdateProfTabs()
tab.glow:Hide(); tab.checked:Hide()
end
tab:Show()
numVisible = numVisible + 1
else
tab.profName = nil; tab.active = false; tab:Hide()
end
end
if S.encBtn and S.MainFrame then
S.encBtn:ClearAllPoints()
S.encBtn:SetPoint("TOPLEFT", S.MainFrame, "TOPRIGHT", 2,
-(6 + numVisible * (42 + 4) + 10))
end
end
function TSUI.IsTabSwitching()
@@ -1932,6 +1934,24 @@ function TSUI:Initialize()
end
end)
dIF:SetScript("OnLeave", function() GameTooltip:Hide() end)
dIF:SetScript("OnMouseUp", function()
if IsShiftKeyDown() and S.selectedIndex then
local link = API.GetItemLink(S.selectedIndex)
if link then
if ChatFrameEditBox and ChatFrameEditBox:IsVisible() then
ChatFrameEditBox:Insert(link)
else
if ChatFrame_OpenChat then
ChatFrame_OpenChat(link)
elseif ChatFrameEditBox then
ChatFrameEditBox:Show()
ChatFrameEditBox:SetText(link)
ChatFrameEditBox:SetFocus()
end
end
end
end
end)
local dName = det:CreateFontString(nil, "OVERLAY")
dName:SetFont(font, 13, "OUTLINE")
@@ -2128,6 +2148,52 @@ function TSUI:Initialize()
end)
TSUI.CreateProfTabs(MF)
-- ── 食物药剂百科 按钮(职业图标条底部)───────────────────────────────
do
local TAB_SZ, TAB_GAP, TAB_TOP = 42, 4, 6
local encBtn = CreateFrame("Button", nil, MF)
encBtn:SetWidth(TAB_SZ); encBtn:SetHeight(TAB_SZ)
encBtn:SetPoint("TOPLEFT", MF, "TOPRIGHT", 2, -(TAB_TOP + 10))
encBtn:SetFrameStrata("HIGH")
encBtn: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 },
})
encBtn:SetBackdropColor(T.slotBg[1], T.slotBg[2], T.slotBg[3], T.slotBg[4])
encBtn:SetBackdropBorderColor(T.slotBorder[1], T.slotBorder[2], T.slotBorder[3], T.slotBorder[4])
local ico = encBtn:CreateTexture(nil, "ARTWORK")
ico:SetTexture("Interface\\Icons\\INV_Potion_97")
ico:SetTexCoord(0.08, 0.92, 0.08, 0.92)
ico:SetPoint("TOPLEFT", encBtn, "TOPLEFT", 4, -4)
ico:SetPoint("BOTTOMRIGHT", encBtn, "BOTTOMRIGHT", -4, 4)
local hl = encBtn:CreateTexture(nil, "HIGHLIGHT")
hl:SetTexture("Interface\\Buttons\\ButtonHilight-Square")
hl:SetBlendMode("ADD"); hl:SetAlpha(0.3); hl:SetAllPoints(ico)
encBtn:SetScript("OnEnter", function()
this:SetBackdropBorderColor(T.slotSelected[1], T.slotSelected[2], T.slotSelected[3], 1)
GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
GameTooltip:SetText("食物药剂百科", 1, 0.82, 0.60)
GameTooltip:AddLine("查看各职业消耗品推荐列表", 0.8, 0.8, 0.8)
GameTooltip:AddLine("Shift+点击物品可插入聊天", 0.6, 0.6, 0.65)
GameTooltip:Show()
end)
encBtn:SetScript("OnLeave", function()
this:SetBackdropBorderColor(T.slotBorder[1], T.slotBorder[2], T.slotBorder[3], T.slotBorder[4])
GameTooltip:Hide()
end)
encBtn:SetScript("OnClick", function()
if SFrames.ConsumableUI then SFrames.ConsumableUI:Toggle() end
end)
encBtn:Show()
S.encBtn = encBtn
end
-- ────────────────────────────────────────────────────────────────────────
MF:Hide()
tinsert(UISpecialFrames, "SFramesTradeSkillFrame")
end