Skip to content

Commit 5ac2c87

Browse files
committed
fix: 修复新版聊天界面兼容问题
1 parent 0c70add commit 5ac2c87

File tree

5 files changed

+48
-45
lines changed

5 files changed

+48
-45
lines changed

MY_Chat/src/MY_AutoHideChat.lua

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ local D = {}
4242

4343
-- get sys chat bg alpha
4444
function D.GetBgAlpha()
45-
return Station.Lookup('Lowest2/ChatPanel1'):Lookup('Wnd_Message', 'Shadow_Back'):GetAlpha() / 255
45+
for _, k in X.pairs_c(X.CONSTANT.CHAT_PANEL_INDEX_LIST) do
46+
local hFrame = X.GetChatPanel(k)
47+
if hFrame then
48+
return hFrame:Lookup('Wnd_Message', 'Shadow_Back'):GetAlpha() / 255
49+
end
50+
end
4651
end
4752

4853
-- show panel
@@ -66,8 +71,8 @@ function D.ShowChatPanel(nShowFrame, nDelayFrame, callback)
6671
return
6772
elseif m_nState == STATE.HIDE then
6873
-- show each
69-
for i = 1, 10 do
70-
local hFrame = Station.Lookup('Lowest2/ChatPanel' .. i)
74+
for _, k in X.pairs_c(X.CONSTANT.CHAT_PANEL_INDEX_LIST) do
75+
local hFrame = X.GetChatPanel(k)
7176
if hFrame then
7277
hFrame:SetMousePenetrable(false)
7378
end
@@ -91,8 +96,8 @@ function D.ShowChatPanel(nShowFrame, nDelayFrame, callback)
9196
-- calc new alpha
9297
local nAlpha = math.min(math.ceil((nFrame - nDelayFrame - nStartFrame) / nShowFrame * (255 - nStartAlpha) + nStartAlpha), 255)
9398
-- alpha each panel
94-
for i = 1, 10 do
95-
local hFrame = Station.Lookup('Lowest2/ChatPanel' .. i)
99+
for _, k in X.pairs_c(X.CONSTANT.CHAT_PANEL_INDEX_LIST) do
100+
local hFrame = X.GetChatPanel(k)
96101
if hFrame then
97102
hFrame:SetAlpha(nAlpha)
98103
hFrame:Lookup('Wnd_Message', 'Shadow_Back'):SetAlpha(nAlpha * D.fAhBgAlpha)
@@ -163,8 +168,8 @@ function D.HideChatPanel(nHideFrame, nDelayFrame, callback)
163168
nAlpha = 255
164169
end
165170
-- alpha each panel
166-
for i = 1, 10 do
167-
local hFrame = Station.Lookup('Lowest2/ChatPanel' .. i)
171+
for _, k in X.pairs_c(X.CONSTANT.CHAT_PANEL_INDEX_LIST) do
172+
local hFrame = X.GetChatPanel(k)
168173
if hFrame then
169174
hFrame:SetAlpha(nAlpha)
170175
hFrame:Lookup('Wnd_Message', 'Shadow_Back'):SetAlpha(nAlpha * D.fAhBgAlpha)
@@ -188,7 +193,7 @@ end
188193

189194
-- 初始化/生效 设置
190195
function D.Apply()
191-
local shaBack = Station.Lookup('Lowest2/ChatPanel1/Wnd_Message', 'Shadow_Back')
196+
local shaBack = X.GetChatPanel(1):Lookup('Wnd_Message', 'Shadow_Back')
192197
local editInput = X.GetChatInput()
193198
if not shaBack or not editInput then
194199
return

MY_Chat/src/MY_ChatCopy.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,8 @@ X.HookChatPanel('AFTER', 'MY_ChatCopy__Namelink', function(h, nIndex)
217217
end)
218218

219219
function D.CheckNamelinkEnable()
220-
for i = 1, 10 do
221-
local h = Station.Lookup('Lowest2/ChatPanel' .. i .. '/Wnd_Message', 'Handle_Message')
222-
or Station.Lookup('Normal1/ChatPanel' .. i .. '/Wnd_Message', 'Handle_Message')
220+
for _, k in X.pairs_c(X.CONSTANT.CHAT_PANEL_INDEX_LIST) do
221+
local h = X.GetChatPanel(k):Lookup('Wnd_Message', 'Handle_Message')
223222
if h then
224223
D.CheckNamelinkHook(h, 0)
225224
end

MY_Chat/src/MY_ChatMosaics.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ X.RegisterExit('MY_ChatMosaics', D.OnMosaicsDisable)
8383
function D.ResetMosaics()
8484
-- re mosaics
8585
D.bForceUpdate = true
86-
for i = 1, 10 do
87-
D.Mosaics(Station.Lookup('Lowest2/ChatPanel' .. i .. '/Wnd_Message', 'Handle_Message'))
86+
for _, k in X.pairs_c(X.CONSTANT.CHAT_PANEL_INDEX_LIST) do
87+
D.Mosaics(X.GetChatPanel(k):Lookup('Wnd_Message', 'Handle_Message'))
8888
end
8989
D.bForceUpdate = nil
9090
-- hook chat panel

MY_Chat/src/MY_ChatSwitch.lua

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,15 @@ local CHANNEL_LIST = {
342342
title = _L['CLS'],
343343
onClick = function()
344344
local function Cls(bAll)
345-
for i = 1, 32 do
346-
local h = Station.Lookup('Lowest2/ChatPanel' .. i .. '/Wnd_Message', 'Handle_Message')
347-
local hCheck = Station.Lookup('Lowest2/ChatPanel' .. i .. '/CheckBox_Title')
348-
if h and (bAll or (hCheck and hCheck:IsCheckBoxChecked())) then
349-
h:Clear()
350-
h:FormatAllItemPos()
345+
for _, k in X.pairs_c(X.CONSTANT.CHAT_PANEL_INDEX_LIST) do
346+
local hFrame = X.GetChatPanel(k)
347+
if hFrame then
348+
local h = hFrame:Lookup('Wnd_Message', 'Handle_Message')
349+
local hCheck = hFrame:Lookup('CheckBox_Title')
350+
if h and (bAll or (hCheck and hCheck:IsCheckBoxChecked())) then
351+
h:Clear()
352+
h:FormatAllItemPos()
353+
end
351354
end
352355
end
353356
end

MY_Toolbox/src/MY_LockFrame.lua

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -78,32 +78,28 @@ local D = {
7878
'MY_ThreatRank',
7979
'MY_Recount_UI',
8080
},
81-
tLockID = {
82-
['JX_TargetList'] = 'JX_TargetList', -- 剑心·焦点列表 [Normal/JX_TargetList]
83-
['MY_FocusUI'] = 'MY_FocusUI', -- 茗伊·焦点列表 [Normal/MY_FocusUI]
84-
['WhoSeeMe'] = 'WhoSeeMe', -- 谁在看我 [Normal/WhoSeeMe]
85-
['HatredPanel'] = 'HatredPanel', -- 仇恨列表 [Normal/HatredPanel]
86-
['FightingStatistic'] = 'FightingStatistic', -- 伤害统计 [Normal/FightingStatistic]
87-
['MY_ThreatRank'] = 'MY_ThreatRank', -- 茗伊·仇恨统计 [Normal/MY_ThreatRank]
88-
['MY_Recount_UI'] = 'MY_Recount_UI', -- 茗伊·伤害统计 [Normal/MY_Recount_UI]
89-
['QuestTraceList'] = 'QuestTraceList', -- 任务追踪 [Normal/QuestTraceList]
90-
['Matrix'] = 'Matrix', -- 阵法界面 [Normal/Matrix]
91-
['ChatPanel1'] = 'ChatPanel', -- 聊天面板 [Lowest2/ChatPanel1]
92-
['ChatPanel2'] = 'ChatPanel', -- 聊天面板 [Lowest2/ChatPanel2]
93-
['ChatPanel3'] = 'ChatPanel', -- 聊天面板 [Lowest2/ChatPanel3]
94-
['ChatPanel4'] = 'ChatPanel', -- 聊天面板 [Lowest2/ChatPanel4]
95-
['ChatPanel5'] = 'ChatPanel', -- 聊天面板 [Lowest2/ChatPanel5]
96-
['ChatPanel6'] = 'ChatPanel', -- 聊天面板 [Lowest2/ChatPanel6]
97-
['ChatPanel7'] = 'ChatPanel', -- 聊天面板 [Lowest2/ChatPanel7]
98-
['ChatPanel8'] = 'ChatPanel', -- 聊天面板 [Lowest2/ChatPanel8]
99-
['ChatPanel9'] = 'ChatPanel', -- 聊天面板 [Lowest2/ChatPanel9]
100-
['ChatPanel10'] = 'ChatPanel', -- 聊天面板 [Lowest2/ChatPanel10]
101-
['DynamicActionBar'] = 'DynamicActionBar', -- 动态技能栏 [Lowest1/DynamicActionBar]
102-
['ExteriorAction'] = 'ExteriorAction', -- 外装动作 [Normal/ExteriorAction]
103-
['MentorMessage'] = 'MentorMessage', -- 师徒提示 [Normal/MentorMessage]
104-
['JX_TeamCD'] = 'JX_TeamCD', -- 剑心·团队技能监控 [Normal/JX_TeamCD]
105-
['JX_HeightMeter'] = 'JX_HeightMeter', -- 剑心·高度标线 [Normal/JX_HeightMeter]
106-
},
81+
tLockID = (function()
82+
local t = {
83+
['JX_TargetList'] = 'JX_TargetList', -- 剑心·焦点列表 [Normal/JX_TargetList]
84+
['MY_FocusUI'] = 'MY_FocusUI', -- 茗伊·焦点列表 [Normal/MY_FocusUI]
85+
['WhoSeeMe'] = 'WhoSeeMe', -- 谁在看我 [Normal/WhoSeeMe]
86+
['HatredPanel'] = 'HatredPanel', -- 仇恨列表 [Normal/HatredPanel]
87+
['FightingStatistic'] = 'FightingStatistic', -- 伤害统计 [Normal/FightingStatistic]
88+
['MY_ThreatRank'] = 'MY_ThreatRank', -- 茗伊·仇恨统计 [Normal/MY_ThreatRank]
89+
['MY_Recount_UI'] = 'MY_Recount_UI', -- 茗伊·伤害统计 [Normal/MY_Recount_UI]
90+
['QuestTraceList'] = 'QuestTraceList', -- 任务追踪 [Normal/QuestTraceList]
91+
['Matrix'] = 'Matrix', -- 阵法界面 [Normal/Matrix]
92+
['DynamicActionBar'] = 'DynamicActionBar', -- 动态技能栏 [Lowest1/DynamicActionBar]
93+
['ExteriorAction'] = 'ExteriorAction', -- 外装动作 [Normal/ExteriorAction]
94+
['MentorMessage'] = 'MentorMessage', -- 师徒提示 [Normal/MentorMessage]
95+
['JX_TeamCD'] = 'JX_TeamCD', -- 剑心·团队技能监控 [Normal/JX_TeamCD]
96+
['JX_HeightMeter'] = 'JX_HeightMeter', -- 剑心·高度标线 [Normal/JX_HeightMeter]
97+
}
98+
for _, k in X.pairs_c(X.CONSTANT.CHAT_PANEL_INDEX_LIST) do
99+
t['ChatPanel' .. k] = 'ChatPanel' .. k -- 聊天面板 [Lowest2/ChatPanel1]
100+
end
101+
return t
102+
end)(),
107103
}
108104

109105
local HOOKED_UI = setmetatable({}, { __mode = 'k' })

0 commit comments

Comments
 (0)