优化附魔标题文本切换界面时正确隐藏
This commit is contained in:
parent
d080142d42
commit
e86333d977
@ -1802,11 +1802,6 @@ function SM_ItemCollectionUI:HandleEnchantButtonClick(slotType)
|
||||
-- 记录当前预览内容
|
||||
self.currentPreviewContent = self.enchantPreviewFrame
|
||||
|
||||
-- 更新右侧标题为默认文本
|
||||
if self.enchantTitleText then
|
||||
self.enchantTitleText:SetText("武器附魔预览")
|
||||
end
|
||||
|
||||
-- 隐藏分页控件
|
||||
self:HidePageButtons()
|
||||
|
||||
@ -2469,3 +2464,47 @@ function SM_ItemCollectionUI:GetPlayerWeaponID()
|
||||
|
||||
return mainHandID or offHandID
|
||||
end
|
||||
|
||||
-- ... existing code ...
|
||||
function SM_ItemCollectionUI:ForceHideAllRightPanelFontStrings()
|
||||
local rightPanel = SM_Collections.MainFrame and SM_Collections.MainFrame.RightSidePanel
|
||||
if not rightPanel then return end
|
||||
for _, region in ipairs({rightPanel:GetRegions()}) do
|
||||
if region:IsObjectType("FontString") then
|
||||
region:Hide()
|
||||
region:SetText("")
|
||||
end
|
||||
end
|
||||
for _, child in ipairs({rightPanel:GetChildren()}) do
|
||||
if child.IsObjectType and child:IsObjectType("FontString") then
|
||||
child:Hide()
|
||||
child:SetText("")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- 在关键入口调用
|
||||
local _old_ShowItemCollectionUI = SM_ItemCollectionUI.ShowItemCollectionUI
|
||||
function SM_ItemCollectionUI:ShowItemCollectionUI(parent)
|
||||
self:ForceHideAllRightPanelFontStrings()
|
||||
return _old_ShowItemCollectionUI(self, parent)
|
||||
end
|
||||
|
||||
local _old_HandleButtonClick = SM_ItemCollectionUI.HandleButtonClick
|
||||
function SM_ItemCollectionUI:HandleButtonClick(slot)
|
||||
self:ForceHideAllRightPanelFontStrings()
|
||||
return _old_HandleButtonClick(self, slot)
|
||||
end
|
||||
|
||||
local _old_HideEnchantUI = SM_ItemCollectionUI.HideEnchantUI
|
||||
function SM_ItemCollectionUI:HideEnchantUI()
|
||||
self:ForceHideAllRightPanelFontStrings()
|
||||
if _old_HideEnchantUI then return _old_HideEnchantUI(self) end
|
||||
end
|
||||
|
||||
local _old_RestoreRightSidePanel = SM_ItemCollectionUI.RestoreRightSidePanel
|
||||
function SM_ItemCollectionUI:RestoreRightSidePanel(...)
|
||||
self:ForceHideAllRightPanelFontStrings()
|
||||
if _old_RestoreRightSidePanel then return _old_RestoreRightSidePanel(self, ...) end
|
||||
end
|
||||
-- ... existing code ...
|
||||
|
||||
@ -326,6 +326,33 @@ end
|
||||
function SM_Collections:ShowTab(tabID)
|
||||
if not self.MainFrame or not self.MainFrame.ContentFrame then return end
|
||||
|
||||
|
||||
-- 如果当前处于附魔模式,需要先恢复正常显示
|
||||
if SM_ItemCollectionUI.inEnchantMode then
|
||||
print("从附魔模式切换到普通模式")
|
||||
-- 隐藏附魔相关元素
|
||||
if SM_ItemCollectionUI.enchantPreviewFrame then
|
||||
SM_ItemCollectionUI.enchantPreviewFrame:Hide()
|
||||
end
|
||||
|
||||
-- 清理附魔模型和标题引用,确保下次能正确创建
|
||||
if SM_ItemCollectionUI.enchantPlayerModel then
|
||||
SM_ItemCollectionUI.enchantPlayerModel:Hide()
|
||||
SM_ItemCollectionUI.enchantPlayerModel = nil
|
||||
end
|
||||
|
||||
if SM_ItemCollectionUI.enchantTitleText then
|
||||
SM_ItemCollectionUI.enchantTitleText:Hide()
|
||||
SM_ItemCollectionUI.enchantTitleText = nil
|
||||
end
|
||||
|
||||
-- 恢复右侧面板
|
||||
SM_ItemCollectionUI:RestoreRightSidePanel()
|
||||
|
||||
-- 取消附魔模式标记
|
||||
SM_ItemCollectionUI.inEnchantMode = false
|
||||
end
|
||||
|
||||
-- 更新左上角图标
|
||||
self:UpdateCornerIcon(tabID)
|
||||
|
||||
@ -371,22 +398,28 @@ function SM_Collections:ShowTab(tabID)
|
||||
-- 坐骑收藏,显示召唤按钮并设置文本为"随机召唤坐骑"
|
||||
self.MainFrame.RightSidePanel.CallButon:Show()
|
||||
self.MainFrame.RightSidePanel.CallButon.String:SetText("随机召唤坐骑")
|
||||
self.MainFrame.RightSidePanel.CallButon:SetNormalTexture("Interface\\ICONS\\Ability_Mount_RidingHorse.blp")
|
||||
self.MainFrame.RightSidePanel.CallButon:SetHighlightTexture("Interface\\ICONS\\Ability_Mount_RidingHorse.blp")
|
||||
self.MainFrame.RightSidePanel.CallButon:SetPushedTexture("Interface\\ICONS\\Ability_Mount_RidingHorse.blp")
|
||||
self.MainFrame.RightSidePanel.CallButon:SetScript("OnClick", function()
|
||||
SendAddonMessage("SM_C_SUMMON_MOUNT", 0, "GUILD")
|
||||
end)
|
||||
self.MainFrame.RightSidePanel.CallButon:SetNormalTexture(
|
||||
"Interface\\ICONS\\Ability_Mount_RidingHorse.blp")
|
||||
self.MainFrame.RightSidePanel.CallButon:SetHighlightTexture(
|
||||
"Interface\\ICONS\\Ability_Mount_RidingHorse.blp")
|
||||
self.MainFrame.RightSidePanel.CallButon:SetPushedTexture(
|
||||
"Interface\\ICONS\\Ability_Mount_RidingHorse.blp")
|
||||
self.MainFrame.RightSidePanel.CallButon:SetScript("OnClick", function()
|
||||
SendAddonMessage("SM_C_SUMMON_MOUNT", 0, "GUILD")
|
||||
end)
|
||||
elseif tabID == 2 then
|
||||
-- 小伙伴收藏,显示召唤按钮并设置文本为"随机召唤小伙伴"
|
||||
self.MainFrame.RightSidePanel.CallButon:Show()
|
||||
self.MainFrame.RightSidePanel.CallButon.String:SetText("随机召唤小伙伴")
|
||||
self.MainFrame.RightSidePanel.CallButon:SetNormalTexture("Interface\\ICONS\\Ability_Hunter_BeastCall.blp")
|
||||
self.MainFrame.RightSidePanel.CallButon:SetHighlightTexture("Interface\\ICONS\\Ability_Hunter_BeastCall.blp")
|
||||
self.MainFrame.RightSidePanel.CallButon:SetPushedTexture("Interface\\ICONS\\Ability_Hunter_BeastCall.blp")
|
||||
self.MainFrame.RightSidePanel.CallButon:SetScript("OnClick", function()
|
||||
SendAddonMessage("SM_C_SUMMON_COMPANION_RANDOM", 0, "GUILD")
|
||||
end)
|
||||
self.MainFrame.RightSidePanel.CallButon:SetNormalTexture(
|
||||
"Interface\\ICONS\\Ability_Hunter_BeastCall.blp")
|
||||
self.MainFrame.RightSidePanel.CallButon:SetHighlightTexture(
|
||||
"Interface\\ICONS\\Ability_Hunter_BeastCall.blp")
|
||||
self.MainFrame.RightSidePanel.CallButon:SetPushedTexture(
|
||||
"Interface\\ICONS\\Ability_Hunter_BeastCall.blp")
|
||||
self.MainFrame.RightSidePanel.CallButon:SetScript("OnClick", function()
|
||||
SendAddonMessage("SM_C_SUMMON_COMPANION_RANDOM", 0, "GUILD")
|
||||
end)
|
||||
elseif tabID == 3 then
|
||||
-- 卡牌收藏,隐藏召唤按钮
|
||||
self.MainFrame.RightSidePanel.CallButon:Hide()
|
||||
@ -408,6 +441,13 @@ function SM_Collections:ShowTab(tabID)
|
||||
self:ShowItems()
|
||||
end
|
||||
|
||||
-- 隐藏附魔标题文本
|
||||
if SM_ItemCollectionUI and SM_ItemCollectionUI.enchantTitleText then
|
||||
SM_ItemCollectionUI.enchantTitleText:Hide()
|
||||
SM_ItemCollectionUI.enchantTitleText:SetText("")
|
||||
SM_ItemCollectionUI.enchantTitleText = nil
|
||||
end
|
||||
|
||||
self.MainFrame.selectedTab = tabID
|
||||
self.CurrentTab = tabID
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user