2023-07-14 19:35:33 +00:00
|
|
|
|
XTableManager = XTableManager or {}
|
|
|
|
|
|
2024-09-01 20:49:41 +00:00
|
|
|
|
XTableManager.TableLoadType =
|
|
|
|
|
{
|
|
|
|
|
Tab = 1,
|
|
|
|
|
Bytes = 2
|
2023-07-14 19:35:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-01 20:49:41 +00:00
|
|
|
|
local router = require("XManager/XTableLoaders/XTableLoadRouter")
|
|
|
|
|
local tabLoader = require("XManager/XTableLoaders/XTableTabLoader")
|
|
|
|
|
local bytesLoader = require("XManager/XTableLoaders/XTableBytesLoader")
|
2023-07-14 19:35:33 +00:00
|
|
|
|
|
2024-09-01 20:49:41 +00:00
|
|
|
|
XTableManager.ForceRelease = false
|
2023-07-14 19:35:33 +00:00
|
|
|
|
|
|
|
|
|
|
2024-09-01 20:49:41 +00:00
|
|
|
|
--============= 外部函数 ============
|
|
|
|
|
--为了兼容已有的业务调用需求,因此接口上无法做到统一,所以两个loader接受的参数是不同的
|
|
|
|
|
function XTableManager.ReadAllByIntKey(path, xTable, identifier)
|
|
|
|
|
if router.GetLoadType(path) == XTableManager.TableLoadType.Tab then
|
|
|
|
|
return tabLoader.ReadAllByIntKey(path, xTable, identifier)
|
|
|
|
|
else
|
|
|
|
|
return bytesLoader.ReadAllByIntKey(path, xTable, identifier)
|
2023-07-14 19:35:33 +00:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2024-09-01 20:49:41 +00:00
|
|
|
|
function XTableManager.ReadAllByStringKey(path, xTable, identifier)
|
|
|
|
|
if router.GetLoadType(path) == XTableManager.TableLoadType.Tab then
|
|
|
|
|
return tabLoader.ReadAllByStringKey(path, xTable, identifier)
|
|
|
|
|
else
|
|
|
|
|
return bytesLoader.ReadAllByStringKey(path, xTable, identifier)
|
2023-07-14 19:35:33 +00:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2024-09-01 20:49:41 +00:00
|
|
|
|
function XTableManager.ReadByIntKey(path, xTable, identifier)
|
|
|
|
|
if router.GetLoadType(path) == XTableManager.TableLoadType.Tab then
|
|
|
|
|
return tabLoader.ReadByIntKey(path, xTable, identifier)
|
|
|
|
|
else
|
|
|
|
|
return bytesLoader.ReadByIntKey(path, xTable, identifier)
|
2023-07-14 19:35:33 +00:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2024-09-01 20:49:41 +00:00
|
|
|
|
function XTableManager.ReadByStringKey(path, xTable, identifier)
|
|
|
|
|
if router.GetLoadType(path) == XTableManager.TableLoadType.Tab then
|
|
|
|
|
return tabLoader.ReadByStringKey(path, xTable, identifier)
|
2023-07-14 19:35:33 +00:00
|
|
|
|
else
|
2024-09-01 20:49:41 +00:00
|
|
|
|
return bytesLoader.ReadByStringKey(path, xTable, identifier)
|
2023-07-14 19:35:33 +00:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2024-09-01 20:49:41 +00:00
|
|
|
|
function XTableManager.ReadArray(path, xTable, identifier)
|
|
|
|
|
return tabLoader.ReadArray(path, xTable, identifier)
|
2023-07-14 19:35:33 +00:00
|
|
|
|
end
|
|
|
|
|
|
2024-09-01 20:49:41 +00:00
|
|
|
|
function XTableManager.ReleaseAll(unload)
|
|
|
|
|
bytesLoader.ReleaseCache()
|
2023-07-14 19:35:33 +00:00
|
|
|
|
end
|
|
|
|
|
|
2024-09-01 20:49:41 +00:00
|
|
|
|
function XTableManager.CheckTableExist(path)
|
|
|
|
|
return CS.XTableManager.CheckTableExist(path)
|
2023-07-14 19:35:33 +00:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
2024-09-01 20:49:41 +00:00
|
|
|
|
function XTableManager.ReleaseTable(path)
|
|
|
|
|
--TODO 增加表格释放接口
|
|
|
|
|
if router.GetLoadType(path) == XTableManager.TableLoadType.Tab then
|
2023-07-14 19:35:33 +00:00
|
|
|
|
return
|
|
|
|
|
end
|
2024-09-01 20:49:41 +00:00
|
|
|
|
bytesLoader.ReleaseFull(path)
|
|
|
|
|
end
|