Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions MY_!Base/src/lib/Base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ elseif _GAME_BRANCH_ == 'zhtw' then
end
-- 游戏发行版编码
local _GAME_EDITION_ = string.lower(szVersionLineName .. '_' .. szVersionEx)
-- BVT内网开发版自动转正式服,获取社区订阅数据
if szVersionEx == 'bvt' and szVersionLineName == 'classic' then
_GAME_EDITION_ = string.lower(szVersionLineName .. '_yq')
end

-- 游戏版本号
local _GAME_VERSION_ = string.lower(szVersion)
-- 游戏运行方式,本地、云端
Expand Down
37 changes: 2 additions & 35 deletions MY_!Base/src/lib/Curl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ local RRWP_FREE = {}
local RRWC_FREE = {}
local CALL_AJAX = {}
local AJAX_TAG = X.NSFormatString('{$NS}_AJAX#')
local AJAX_BRIDGE_WAIT = 10000
local AJAX_BRIDGE_PATH = X.PACKET_INFO.DATA_ROOT .. '#cache/curl/'

local function CreateWebPageFrame()
local szRequestID, hFrame
Expand Down Expand Up @@ -226,8 +224,6 @@ function X.Ajax(settings)
X.DEBUG_LEVEL.LOG
)
--[[#DEBUG END]]
local bridgewait = GetTime() + AJAX_BRIDGE_WAIT
local bridgewaitkey = X.NSFormatString('{$NS}_AJAX_') .. id
local fulfilled = false
settings.callback = function(html, status)
if fulfilled then
Expand Down Expand Up @@ -262,42 +258,13 @@ function X.Ajax(settings)
else
X.SafeCallWithThis(settings.config, onerror, html, status)
end
X.XpCall(settings.closebridge)
end
if connected then
resolve()
else
X.DelayCall(bridgewaitkey, bridgewait - GetTime(), resolve)
end
resolve()
end

-------------------------------
-- each driver handlers
-------------------------------
-- bridge
local bridgekey = X.NSFormatString('{$NS}RRDF_TO_') .. id
local bridgein = AJAX_BRIDGE_PATH .. id .. '.' .. X.ENVIRONMENT.GAME_LANG .. '.jx3dat'
local bridgeout = AJAX_BRIDGE_PATH .. id .. '.result.' .. X.ENVIRONMENT.GAME_LANG .. '.jx3dat'
local bridgetimeout = GetTime() + config.timeout
settings.closebridge = function()
CPath.DelFile(bridgein)
CPath.DelFile(bridgeout)
X.DelayCall(bridgewaitkey, false)
X.BreatheCall(bridgekey, false)
X.DelayCall(bridgekey, false)
X.RegisterExit(bridgekey, false)
end
X.SaveLUAData(bridgein, config, { encoder = 'luatext', passphrase = false })
X.BreatheCall(bridgekey, 200, function()
local data = X.LoadLUAData(bridgeout, { passphrase = false })
if X.IsTable(data) then
settings.callback(data.content, data.status)
elseif GetTime() > bridgetimeout then
settings.callback()
end
end)
X.DelayCall(bridgekey, config.timeout, settings.closebridge)
X.RegisterExit(bridgekey, settings.closebridge)

local canajax, errmsg = X.CanAjax(driver, method)
if not canajax then
Expand Down Expand Up @@ -636,7 +603,7 @@ end
function X.EnsureAjax(options)
local key = GetStringCRC(X.EncodeLUAData({options.url, options.data}))
local configs, i, dc = {{'curl', 'post'}, {'origin', 'post'}, {'origin', 'get'}, {'webcef', 'get'}}, 1, nil
-- 移除无法访问的调用方式,但至少保留一个用于尝试桥接通信
-- 移除无法访问的调用方式,但至少保留一种驱动用于依次重试
for i, config in X.ipairs_r(configs) do
if i >= 1 and not X.CanAjax(config[1], config[2]) then
table.remove(configs, i)
Expand Down
Loading