Skip to content

Commit 79f749c

Browse files
committed
feat: 兼容官方仓库搜索功能覆盖
1 parent 52cfb36 commit 79f749c

File tree

1 file changed

+34
-29
lines changed

1 file changed

+34
-29
lines changed

MY_BagEx/src/MY_BagEx_GenericFilters.lua

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -257,24 +257,27 @@ local function Hook()
257257

258258
local ui = X.UI(frame)
259259
local nX = nPaddingX
260-
261-
nX = nX + ui:Append('WndCheckBox', {
262-
name = 'CheckBox_TimeLtd',
263-
x = nX, y = 56, alpha = 200,
264-
text = _L['Time Limited'],
265-
checked = l_bBankTimeLtd,
266-
onCheck = function(bChecked)
267-
if bChecked then
268-
X.UI('Normal/BigBankPanel/WndCheckBox_Compare'):Check(false)
260+
local bOfficial = not not frame:Lookup('WndContainer_Other/Wnd_Search')
261+
262+
if not bOfficial then
263+
nX = nX + ui:Append('WndCheckBox', {
264+
name = 'CheckBox_TimeLtd',
265+
x = nX, y = 56, alpha = 200,
266+
text = _L['Time Limited'],
267+
checked = l_bBankTimeLtd,
268+
onCheck = function(bChecked)
269+
if bChecked then
270+
X.UI('Normal/BigBankPanel/WndCheckBox_Compare'):Check(false)
271+
end
272+
l_bBankTimeLtd = bChecked
273+
DoFilterBank(true)
269274
end
270-
l_bBankTimeLtd = bChecked
271-
DoFilterBank(true)
272-
end
273-
}):Width() + 3
275+
}):Width() + 3
276+
end
274277

275278
nX = nX + ui:Append('WndCheckBox', {
276279
name = 'WndCheckBox_Compare',
277-
x = nX, y = 56,
280+
x = bOfficial and 560 or nX, y = bOfficial and 52 or 56,
278281
text = _L['Compare with bag'],
279282
checked = l_bCompareBank,
280283
onCheck = function(bChecked)
@@ -289,21 +292,23 @@ local function Hook()
289292
local nW = nX - nPaddingX
290293
nX = nPaddingX
291294

292-
if not frame:Lookup('WndContainer_Other/Wnd_Search') then
293-
ui:Append('WndEditBox', {
294-
name = 'WndEditBox_KeyWord',
295-
x = nX + 3, y = 80, w = nW, h = 21,
296-
text = l_szBankFilter,
297-
placeholder = _L['Search'],
298-
onChange = function(txt)
299-
local nLen = txt:len()
300-
nLen = math.max(nLen, 15)
301-
nLen = math.min(nLen, 25)
302-
X.UI(this):Width(nLen * 10)
303-
l_szBankFilter = txt
304-
DoFilterBank(true)
305-
end,
306-
})
295+
if not bOfficial then
296+
if not frame:Lookup('WndContainer_Other/Wnd_Search') then
297+
ui:Append('WndEditBox', {
298+
name = 'WndEditBox_KeyWord',
299+
x = nX + 3, y = 80, w = nW, h = 21,
300+
text = l_szBankFilter,
301+
placeholder = _L['Search'],
302+
onChange = function(txt)
303+
local nLen = txt:len()
304+
nLen = math.max(nLen, 15)
305+
nLen = math.min(nLen, 25)
306+
X.UI(this):Width(nLen * 10)
307+
l_szBankFilter = txt
308+
DoFilterBank(true)
309+
end,
310+
})
311+
end
307312
end
308313

309314
HookTableFunc(frame, 'OnFrameKeyDown', OnFrameKeyDown, { bHookReturn = true })

0 commit comments

Comments
 (0)