优化右侧介绍文本,集成容器方便清理
This commit is contained in:
parent
48dd019edf
commit
68cf875e2c
@ -417,7 +417,7 @@ function SM_Collections:GetCreatureDisplayID(itemID, itemType)
|
||||
return itemID
|
||||
end
|
||||
|
||||
-- 创建主界面
|
||||
-- 创建主界面
|
||||
function SM_Collections:CreateMainFrame()
|
||||
if self.MainFrame then
|
||||
return self.MainFrame
|
||||
@ -448,9 +448,16 @@ function SM_Collections:CreateMainFrame()
|
||||
closeBtn:SetPoint("TOPRIGHT", 4, -8)
|
||||
closeBtn:SetScript("OnClick", function() SM_Collections_Frame:Hide() end)
|
||||
|
||||
-- 创建右侧面板容器
|
||||
local rightSidePanel = CreateFrame("Frame", "SM_CollectionsRightSidePanel", SM_Collections_Frame)
|
||||
rightSidePanel:SetSize(190, 400)
|
||||
rightSidePanel:SetPoint("TOPRIGHT", 10, -100)
|
||||
SM_Collections_Frame.RightSidePanel = rightSidePanel
|
||||
self.RightSidePanel = rightSidePanel
|
||||
|
||||
-- 坐骑名称文本 - 使用自定义字体
|
||||
local MountNama = SM_Collections_Frame:CreateFontString(nil, "OVERLAY")
|
||||
MountNama:SetPoint("TOPRIGHT", -80, -100)
|
||||
local MountNama = rightSidePanel:CreateFontString(nil, "OVERLAY")
|
||||
MountNama:SetPoint("TOPLEFT", 5, 0)
|
||||
MountNama:SetFontObject(titleFont)
|
||||
MountNama:SetText("墨洛墨洛根怪兽")
|
||||
MountNama:SetJustifyH("LEFT")
|
||||
@ -458,7 +465,7 @@ function SM_Collections:CreateMainFrame()
|
||||
MountNama:SetTextColor(230 / 255, 150 / 255, 0 / 255)
|
||||
|
||||
-- 右上角介绍文本的框体
|
||||
local introFrame = CreateFrame("Frame", nil, SM_Collections_Frame)
|
||||
local introFrame = CreateFrame("Frame", nil, rightSidePanel)
|
||||
local width = MountNama:GetStringWidth()
|
||||
introFrame:SetSize(width + 80, 80)
|
||||
introFrame:SetPoint("TOPLEFT", MountNama, "BOTTOMLEFT", 0, -10)
|
||||
@ -625,37 +632,46 @@ function SM_Collections:UpdateTabAppearance(selectedTab)
|
||||
end
|
||||
|
||||
-- 显示指定标签页
|
||||
function SM_Collections:ShowTab(tabId)
|
||||
self:UpdateTabAppearance(tabId)
|
||||
|
||||
-- 更彻底地清空当前内容
|
||||
if self.CurrentPanel then
|
||||
self.CurrentPanel:Hide()
|
||||
local children = { self.CurrentPanel:GetChildren() }
|
||||
for _, child in ipairs(children) do
|
||||
child:Hide()
|
||||
end
|
||||
self.CurrentPanel = nil
|
||||
end
|
||||
|
||||
-- 清理内容框架中的所有子元素
|
||||
if self.MainFrame and self.MainFrame.ContentFrame then
|
||||
local children = { self.MainFrame.ContentFrame:GetChildren() }
|
||||
for _, child in ipairs(children) do
|
||||
child:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
-- 根据标签页显示对应内容
|
||||
if tabId == 1 then
|
||||
self:ShowMounts()
|
||||
elseif tabId == 2 then
|
||||
self:ShowCompanions()
|
||||
elseif tabId == 3 then
|
||||
self:ShowCards()
|
||||
elseif tabId == 4 then
|
||||
self:ShowItems()
|
||||
end
|
||||
function SM_Collections:ShowTab(tabId)
|
||||
self:UpdateTabAppearance(tabId)
|
||||
|
||||
-- 更彻底地清空当前内容
|
||||
if self.CurrentPanel then
|
||||
self.CurrentPanel:Hide()
|
||||
local children = { self.CurrentPanel:GetChildren() }
|
||||
for _, child in ipairs(children) do
|
||||
child:Hide()
|
||||
end
|
||||
self.CurrentPanel = nil
|
||||
end
|
||||
|
||||
-- 清理内容框架中的所有子元素
|
||||
if self.MainFrame and self.MainFrame.ContentFrame then
|
||||
local children = { self.MainFrame.ContentFrame:GetChildren() }
|
||||
for _, child in ipairs(children) do
|
||||
child:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
-- 【新增】根据标签页控制右侧面板的显示/隐藏
|
||||
if self.MainFrame and self.MainFrame.RightSidePanel then
|
||||
if tabId == 4 then -- 物品收藏页面
|
||||
self.MainFrame.RightSidePanel:Hide()
|
||||
else -- 其他页面(坐骑、小伙伴、卡牌收藏)
|
||||
self.MainFrame.RightSidePanel:Show()
|
||||
end
|
||||
end
|
||||
|
||||
-- 根据标签页显示对应内容
|
||||
if tabId == 1 then
|
||||
self:ShowMounts()
|
||||
elseif tabId == 2 then
|
||||
self:ShowCompanions()
|
||||
elseif tabId == 3 then
|
||||
self:ShowCards()
|
||||
elseif tabId == 4 then
|
||||
self:ShowItems()
|
||||
end
|
||||
end
|
||||
|
||||
-- 创建左右分栏面板
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user