Skip to content

Commit 69a87d3

Browse files
committed
feat: 新增获取聊天界面的库兼容函数
1 parent 1ec7b09 commit 69a87d3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Boilerplate_!Base/src/lib/Chat.lua

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ function X.GetChatInput()
2222
return frame and frame:Lookup('Edit_Input')
2323
end
2424

25+
function X.GetChatPanel(k)
26+
return Station.SearchFrame('ChatPanel' .. k)
27+
or Station.SearchFrame('ChatPanel_Normal' .. k)
28+
end
29+
2530
-- 海鳗里面抠出来的
2631
-- 聊天复制并发布
2732
function X.RepeatChatLine(hTime)
@@ -1610,8 +1615,7 @@ end
16101615

16111616
local HOOKED_UI = setmetatable({}, { __mode = 'k' })
16121617
local function Hook(i)
1613-
local frame = Station.SearchFrame('ChatPanel' .. i)
1614-
or Station.SearchFrame('ChatPanel_Normal' .. i)
1618+
local frame = X.GetChatPanel(i)
16151619
local h = frame and frame:Lookup('Wnd_Message', 'Handle_Message')
16161620
if h and not HOOKED_UI[h] then
16171621
HOOKED_UI[h] = true
@@ -1622,8 +1626,7 @@ end
16221626
X.RegisterEvent('CHAT_PANEL_OPEN', 'ChatPanelHook', function(event) Hook(arg0) end)
16231627

16241628
local function Unhook(i)
1625-
local frame = Station.SearchFrame('ChatPanel' .. i)
1626-
or Station.SearchFrame('ChatPanel_Normal' .. i)
1629+
local frame = X.GetChatPanel(i)
16271630
local h = frame and frame:Lookup('Wnd_Message', 'Handle_Message')
16281631
if h and HOOKED_UI[h] then
16291632
HOOKED_UI[h] = nil

0 commit comments

Comments
 (0)